eth_getBlockTransactionCountByNumber
Returns the number of transactions in the block with the given block number.

REQUEST

1
POST https://<network>.infura.io/v3/YOUR-PROJECT-ID
Copied!

HEADERS

1
Content-Type: application/json
Copied!

REQUEST PARAMS

  • BLOCK PARAMETER [required] - hexadecimal block number, or the string "latest", "earliest" or "pending".

EXAMPLE

1
## JSON-RPC over HTTPS POST
2
## Replace YOUR-PROJECT-ID with a Project ID from your Infura Dashboard
3
## You can also replace mainnet with a different supported network
4
curl https://mainnet.infura.io/v3/YOUR-PROJECT-ID \
5
-X POST \
6
-H "Content-Type: application/json" \
7
-d '{"jsonrpc":"2.0","method":"eth_getBlockTransactionCountByNumber","params": ["latest"],"id":1}'
8
9
## JSON-RPC over WSS
10
## Replace YOUR-PROJECT-ID with a Project ID from your Infura Dashboard
11
## You can also replace mainnet with a different supported network
12
wscat -c wss://mainnet.infura.io/ws/v3/YOUR-PROJECT-ID
13
>{"jsonrpc":"2.0","method":"eth_getBlockTransactionCountByNumber","params": ["latest"],"id":1}
Copied!

RESPONSE

RESULT FIELDS

  • BLOCK TRANSACTION COUNT - a hex code of the integer representing the number of transactions in the provided block

BODY

1
{
2
"jsonrpc": "2.0",
3
"id": 1,
4
"result": "0x9"
5
}
Copied!
Copy link