← zkSync Era overview
zkSync Era · eth
eth_getBlockTransactionCountByHash
Returns the number of transactions in a block from a block matching the given block hash.
Parameters
Block hashrequiredSchema{ "type": "string", "title": "32 byte hex value", "pattern": "^0x[0-9a-f]{64}$" }
Result
Transaction count
Schema
{
"oneOf": [
{
"type": "null",
"title": "Not Found (null)"
},
{
"type": "string",
"title": "Transaction count",
"pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
}
]
}Example request
Endpoint: https://your-zksync-node.azxa.io
JSON-RPC
{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_getBlockTransactionCountByHash",
"params": [
"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"
]
}Example response
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x8"
}Test fixture
Fixture: get-block-n
Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_getBlockTransactionCountByHash",
"params": [
"0x80e911b62f552f563a2544dfef5eb39ec8863d9082c998ca6b657f76e19de38e"
]
}Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x4"
}cURL
curl -X POST https://your-zksync-node.azxa.io \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_getBlockTransactionCountByHash","params":["0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"]}'