> For the complete documentation index, see [llms.txt](https://sodex.com/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sodex.com/documentation/for-developers/api-reference/json-rpc/eth-getblocktransactioncountbyhash.md).

# eth\_getBlockTransactionCountByHash

POST `https://mainnet.valuechain.xyz`

Returns the number of transactions in a block matching the given hash.

## Parameters

| Name        | Type | Required | Description         |
| ----------- | ---- | -------- | ------------------- |
| `blockHash` | hash | Yes      | 32-byte block hash. |

## Result

**Count** (quantity): Hex-encoded transaction count.

## Example

### Response

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x1"
}
```

## Code examples

### cURL

```bash
curl --request POST \
  --url https://mainnet.valuechain.xyz \
  --header 'Content-Type: application/json' \
  --data '{"jsonrpc": "2.0", "id": 1, "method": "eth_getBlockTransactionCountByHash", "params": ["0x565381ec3a896e084662587ed4eba8f3b6745ffeff7b1d7b672b4b1bb724f3b5"]}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({"jsonrpc": "2.0", "id": 1, "method": "eth_getBlockTransactionCountByHash", "params": ["0x565381ec3a896e084662587ed4eba8f3b6745ffeff7b1d7b672b4b1bb724f3b5"]})
};

fetch('https://mainnet.valuechain.xyz', options)
  .then((res) => res.json())
  .then((res) => console.log(res))
  .catch((err) => console.error(err));
```

### Python

```python
import requests

url = "https://mainnet.valuechain.xyz"
payload = {
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_getBlockTransactionCountByHash",
  "params": [
    "0x565381ec3a896e084662587ed4eba8f3b6745ffeff7b1d7b672b4b1bb724f3b5"
  ]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
```
