Optimism API method eth_getTransactionReceipt
retrieves the receipt of a transaction by its hash. This receipt includes details such as the transaction's outcome (status), gas used, and logs generated by the transaction. This method is crucial for confirming transaction execution and for interacting with smart contracts.
Get you own node endpoint today
Start for free and get your app to production levels immediately. No credit card required.
You can sign up with your GitHub, X, Google, or Microsoft account.
Parameters
transactionHash
— the hash of the transaction for which the receipt is being requested.
Response
Transaction receipt
— the receipt object with:blockHash
— the block hash. Identifies the block in which the transaction was included. This field isnull
for transactions that have not yet been included in a block.blockNumber
— the number of the block in which the transaction was included. This field isnull
for transactions that have not yet been included in a block.contractAddress
— the contract address created by the transaction if it was a contract creation transaction. Otherwise, the value isnull
.cumulativeGasUsed
— the total amount of gas used in the block until this transaction was executed.effectiveGasPrice
— the actual value deducted from the sender's account for this transaction.from
— the address of the sender who initiated the transaction.gasUsed
— the amount of gas used by this specific transaction alone.logs
— an array of log objects this transaction generates, if any. Logs are generated by smart contracts.logsBloom
— the bloom filter used by light clients to quickly retrieve logs related to the transaction.status
— the success status of the transaction, represented as1
for success or0
for failure.to
— the recipient's address of the transaction if it was a transaction to an address. For contract creation transactions, this field isnull
.transactionHash
— the hash that uniquely identifies the transaction.transactionIndex
— the index of the transaction within the block.type
— the type of the transaction.0
indicates a regular transfer;2
indicates a contract creation or smart contract function call.l1Fee
— this field represents the cost incurred for executing the transaction on the Ethereum mainnet (Layer 1). It is calculated by multiplying thel1GasPrice
by thel1GasUsed
.l1FeeScalar
— a scaling factor applied to the actual gas consumption on the Ethereum mainnet (Layer 1). This value is used to determine the dynamic costs associated with the transaction. Setting to 1 does not alter the Layer 1 gas usage.l1GasPrice
— the price of gas, measured in Wwei, that the transaction is willing to pay for execution on the Ethereum mainnet (Layer 1).l1GasUsed
— the total amount of gas units the transaction consumes during its execution on the Ethereum mainnet (Layer 1).
The l1Fee
, l1FeeScalar
, l1GasPrice
, and l1GasUsed
fields are specific to Optimism, an Optimistic Rollup solution for scaling Ethereum. These fields provide information about the transaction's interaction with the Layer 1 (Ethereum mainnet) chain, which is necessary for the security and validity of the Optimistic Rollup.
Use case
The eth_getTransactionReceipt
method is essential for:
- DApps that need to confirm the outcome of a transaction, especially after interacting with smart contracts.
- Services that monitor transactions for confirmation, gas usage, and event logging.
- Tools that analyze the efficiency and effects of transactions on the Optimism network.
Try the eth_getTransactionReceipt
RPC method yourself
eth_getTransactionReceipt
RPC method yourself