Skip to main content
POST
/
be84184cd12967be5a65d06651c60085
eth_getBlockTransactionCountByNumber
curl --request POST \
  --url https://plasma-mainnet.core.chainstack.com/be84184cd12967be5a65d06651c60085 \
  --header 'Content-Type: application/json' \
  --data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "eth_getBlockTransactionCountByNumber",
  "params": [
    "latest"
  ]
}'
{
  "jsonrpc": "<string>",
  "id": 123,
  "result": {}
}
Plasma API method that returns the number of transactions in a block by block number.

Parameters

  • quantity or tag — the block number in hex format or block tag (latest, earliest, pending, safe, finalized)

Response

  • quantity — the number of transactions in the block

eth_getBlockTransactionCountByNumber code examples

const { JsonRpcProvider } = require("ethers");

const provider = new JsonRpcProvider("CHAINSTACK_NODE_URL");

async function call() {
  const result = await provider.send("eth_getBlockTransactionCountByNumber", [
    "latest"
  ]);
  console.log(result);
}

call();

Body

application/json
id
integer
default:1
jsonrpc
string
default:2.0
method
string
default:eth_getBlockTransactionCountByNumber
params
string[]

Block number or tag (latest, earliest, pending).

Response

200 - application/json

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

jsonrpc
string
id
integer
result
object | null