L0vdL0vd

eth_getBlockTransactionCountByNumber

Returns the number of transactions in a block, by number.

Архив · Работает на любом прошлом блоке

curl https://eth.l0vdinfra.com/YOUR_KEY \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","id":1,"method":"eth_getBlockTransactionCountByNumber","params":["0x1208a5f"]}'

Пример ответа

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0xae"
}
Параметры и свой эндпоинт

Параметры

blockstringобязательный
Block number in hex (e.g. "0x1208a5f") or a tag: "latest", "safe", "finalized", "earliest" or "pending". L0vd endpoints run archive nodes, so any historical block works.

Возвращает

string Transaction count, hex.

Когда использовать

Count the transactions in a block without downloading them, e.g. to size a backfill or chart activity.

Как читать ответ

Hex integer: 0xae = 174 transactions in block 18,908,895.

Советы

  • Cheaper than eth_getBlockByNumber when only the count matters.

Связанные методы