Polygon
Polygon
Polygon
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
eth_getTransactionReceipt returns the execution receipt for a transaction once it has been mined into a Polygon PoS block, where gas is paid in the network's native MATIC. The receipt is the authoritative record of what happened on-chain: it tells you whether the transaction succeeded or reverted, how much gas it burned, the effective gas price it paid, and every event (log) the call emitted. Send the request to https://polygon.therpc.io/YOUR_API_KEY (chain ID 137, 0x89). Because Polygon seals blocks roughly every two seconds, a receipt usually becomes available within a few seconds of submission.
status: "0x1") or reverted (status: "0x0") once it lands in a block.logs array to pick up emitted events — for example a Transfer from the USDT contract at 0xc2132D05D31c914a87C6611C10748AEb04B58e8F — and update your application state.contractAddress to learn the address of a contract you just deployed; it is non-null only for contract-creation transactions.gasUsed * effectiveGasPrice, useful for accounting given Polygon's typically low per-transaction cost.| # | 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|---|
| 1 | transactionHash | string (hex) | 是 | The hash of the mined transaction. |
| 类型 | 描述 |
|---|---|
| object | null | Receipt object containing: transactionHash, transactionIndex, blockHash, blockNumber, from, to, contractAddress (non-null only for contract deployments), gasUsed, cumulativeGasUsed, effectiveGasPrice, status ("0x1" success / "0x0" revert), logs (array of log objects), logsBloom, type. Returns null f |
Try it live in the Polygon playground.
| 错误码 | 错误信息 | 原因 |
|---|---|---|
-32602 | Invalid params | Transaction hash is malformed. |
null for a transaction still sitting in the mempool. Poll until you get a non-null receipt rather than assuming it is ready — on Polygon this is usually only a couple of blocks (a few seconds), but congestion can stretch it.status of "0x0" means the transaction was included in a block but reverted; the sender still paid for the gas it consumed in MATIC, so always check status before treating an action as successful.eth_getBlockReceipts returns them all in one round trip and is far more efficient than firing one eth_getTransactionReceipt per hash — valuable on a high-throughput chain like Polygon.参数
0x-prefixed 32-byte transaction hash