Polygon
هل أنت مستعد لاستدعاء هذا في الإنتاج؟
الخطة المجانية تغطي المشاريع الشخصية. الدفع حسب الاستخدام يتوسع دون بطاقة.
Polygon
الخطة المجانية تغطي المشاريع الشخصية. الدفع حسب الاستخدام يتوسع دون بطاقة.
eth_getBlockByNumber returns the full block data for a Polygon PoS block at a given height or named tag (latest, finalized, safe, pending, earliest). It is the height-keyed twin of eth_getBlockByHash and the natural way to walk the chain forward in an indexer, since Polygon seals a new Bor block about every 2 seconds. Any transactions it contains paid gas in MATIC. Point the call at https://polygon.therpc.io/YOUR_API_KEY (chain ID 137, 0x89) and choose whether to include full transaction objects or just hashes.
latest block to drive a real-time Polygon monitoring dashboard.finalized block to anchor queries that must survive a Bor reorg — that block's Heimdall checkpoint is already committed to Ethereum.includeTransactions=false) before fetching their receipts in bulk via 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 Polygon playground.
| الكود | الرسالة | السبب |
|---|---|---|
-32602 | Invalid params | Block number is malformed or block tag is unrecognised. |
includeTransactions, not the string "true" — JSON-RPC requires the boolean type.eth_getBlockReceipts call over N separate eth_getTransactionReceipt calls.includeTransactions=true, a heavily loaded Polygon block can return a 1–2 MB payload; budget bandwidth or fetch hashes only and pull details on demand.المعاملات
hex block number or "latest"/"earliest"/"pending"/"safe"/"finalized"
true = full tx objects, false = tx hashes only