eth_getBlockTransactionCountByNumber
Returns the number of transactions in the block with the given block number.
Example
## using block numbers
curl https://bsc-<network>.web3api.com/v1/YOUR-API-KEY
-X POST
-H "Content-Type: application/json"
-d "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockTransactionCountByNumber\",\"params\": [\"0x6DF59C\"],\"id\":1}"
## using pre-defined strings
curl https://bsc-<network>.web3api.com/v1/YOUR-API-KEY
-X POST
-H "Content-Type: application/json"
-d "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockTransactionCountByNumber\",\"params\": [\"latest\"],\"id\":1}"
## using block numbers
curl -X POST 'https://bsc-<network>.web3api.com/v1/YOUR-API-KEY' \
-H 'Content-Type: application/json' \
--data-raw '{"jsonrpc":"2.0","method":"eth_getBlockTransactionCountByNumber","params": ["0x6DF59C"],"id":1}'
## using pre-defined strings
curl -X POST 'https://bsc-<network>.web3api.com/v1/YOUR-API-KEY' \
-H 'Content-Type: application/json' \
--data-raw '{"jsonrpc":"2.0","method":"eth_getBlockTransactionCountByNumber","params": ["latest"],"id":1}'
BLOCK PARAMETER
- An int
block number in the form of hex, appended with 0x such as 0x6DF59C
, or pre-defined strings latest
, earliest
, pending
.
Result Fields
BLOCK TRANSACTION COUNT
- A hex code of an integer representing the number of transactions in the specified block.
Body
{
"jsonrpc":"2.0",
"id":1,
"result":"0x91"
}