Ethereum
هل أنت مستعد لاستدعاء هذا في الإنتاج؟
الخطة المجانية تغطي المشاريع الشخصية. الدفع حسب الاستخدام يتوسع دون بطاقة.
Ethereum
الخطة المجانية تغطي المشاريع الشخصية. الدفع حسب الاستخدام يتوسع دون بطاقة.
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.| # | الاسم | النوع | مطلوب | الوصف |
|---|---|---|---|---|
| 1 | blockTag | string | نعم | The block to retrieve. |
| 2 | includeTransactions | boolean | نعم | When true, transactions[] contains full transaction objects. When false, only hashes. |
| النوع | الوصف |
|---|---|
| object | null | Same block object as eth_getBlockByHash. Returns null if the block does not exist. |
Try it live in the Ethereum playground.
| الكود | الرسالة | السبب |
|---|---|---|
-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.المعاملات
hex block number or "latest"/"earliest"/"pending"/"safe"/"finalized"
true = full tx objects, false = tx hashes only