eth_getBlockTransactionCountByNumber
Returns the number of transactions in the block with the given block number.
Parameters
- block number: (string) [Required] A string representing the number of a block.
Returns
An integer representing the number of transactions in the block.
Example
Request
curl https://rpc.testnet.radiustech.xyz/<YOUR-RPC-ENDPOINT> \
  -X POST \
  -H "Content-Type: application/json" \
  -d '
{
  "jsonrpc": "2.0",     
  "method": "eth_getBlockTransactionCountByNumber",
  "params": [
    "1738267480915"
  ],
  "id": 1
}
'Response
{
  "jsonrpc": "2.0",
  "result": 1,
  "id": 1
}This method does not work as expected using cast, but we are looking into it.
Workaround: Use curl or eth_getBlockTransactionCountByHash instead.
Request
cast rpc eth_getBlockTransactionCountByNumber \
  1738267480915 \
  --rpc-url https://rpc.testnet.radiustech.xyz/<YOUR-RPC-ENDPOINT>Response
Error: server returned an error response: error code -32602: Invalid params, data: "invalid type: integer `1738267480915`, expected a string at line 1 column 13"Last updated
Was this helpful?

