Optimism
Optimism
Optimism
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
eth_getTransactionReceipt returns the execution receipt for a transaction that has already been included in an OP Mainnet block — the canonical OP Stack rollup (chain ID 10, 0xa) that settles to Ethereum L1 and pays gas in ETH. Given a transaction hash, it reports whether execution succeeded or reverted, how much gas was burned, the effective gas price paid, and every log the transaction emitted. Because OP Mainnet produces a fresh block roughly every 2 seconds from its single sequencer, receipts become available quickly after submission. Send the request to https://optimism.therpc.io/YOUR_API_KEY.
status field (0x1 success, 0x0 revert).logs to update application state — for example, picking up Transfer events from an ERC-20 or a Swap from a Velodrome pool.contractAddress field, which is non-null only for deployment transactions.gasUsed * effectiveGasPrice (note that OP Stack also charges a separate L1 data fee for posting the transaction to Ethereum).| # | 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|---|
| 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 Optimism playground.
| 错误码 | 错误信息 | 原因 |
|---|---|---|
-32602 | Invalid params | Transaction hash is malformed. |
null. Poll until you get a non-null receipt rather than assuming it is ready; on OP Mainnet's ~2s blocks this is usually only a brief wait, but never treat the first null as a failure.status: "0x0" means the transaction was included in a block but reverted — gas was still consumed and the L1 data fee still applies, so the sender pays even though no state change stuck.eth_getBlockReceipts returns them all in a single call and is far more efficient than one eth_getTransactionReceipt per transaction.参数
0x-prefixed 32-byte transaction hash