Ethereum
Pronto para usar isso em produção?
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
Ethereum
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
eth_getBlockByNumber fetches a block on Ethereum mainnet by its height or by a named tag. Pass a hex height for an exact block, or a tag — latest for the current head, safe for a justified block, finalized for one that's economically irreversible, earliest for genesis. The block object is identical to what eth_getBlockByHash returns: header roots, timestamp, EIP-1559 baseFeePerGas, gas metrics, post-Merge withdrawals, and either full transactions or their hashes. With one block per 12-second slot, walking heights sequentially walks the chain in time. Send requests to https://ethereum.therpc.io/YOUR_API_KEY (chain ID 1, native coin ETH).
latest to surface the freshest block's timestamp, gas usage, and transaction count on a monitor.finalized block so any query built on top of it can't be invalidated by a head reorg.includeTransactions=false to get just the hashes, then fetch all receipts in one shot with eth_getBlockReceipts.| # | Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|---|
| 1 | blockTag | string | Sim | The block to retrieve. |
| 2 | includeTransactions | boolean | Sim | When true, transactions[] contains full transaction objects. When false, only hashes. |
| Tipo | Descrição |
|---|---|
| object | null | Same block object as eth_getBlockByHash. Returns null if the block does not exist. |
Try it live in the Ethereum playground.
| Código | Mensagem | Causa |
|---|---|---|
-32602 | Invalid params | Block number is malformed or block tag is unrecognised. |
"true". Quoted, it gets misread and you may silently receive hashes when you wanted full transactions.eth_getTransactionReceipt over a block's transactions when you need them all — one eth_getBlockReceipts call returns every receipt and saves you dozens of round-trips.includeTransactions=true can run 1–2 MB. If you're only after metadata, request hashes only and hydrate transactions selectively.Parâmetros
hex block number or "latest"/"earliest"/"pending"/"safe"/"finalized"
true = full tx objects, false = tx hashes only