eth_getTransactionReceipt
Returns the receipt of a transaction given transaction hash. Note that the receipt is not available for pending transactions.
Parameters
transaction hash
: [Required] A string representing the hash (32 bytes) of a transaction.
Returns
A transaction receipt object, or null when no receipt was found. The transaction receipt object will contain the following keys and their values:
blockHash
: 32 bytes. Hash of the block including this transaction.blockNumber
: Block number including this transaction.contractAddress
: 20 bytes. The contract address created if the transaction was a contract creation, otherwisenull
.cumulativeGasUsed
: The total amount of gas used when this transaction was executed in the block.effectiveGasPrice
: The actual value per gas deducted from the sender's account. Before EIP-1559, equal to the gas price.from
: 20 bytes. The address of the sender.gasUsed
: The amount of gas used by this specific transaction alone.logs
: (Array) An array of log objects generated by this transaction.logsBloom
: 256 bytes. Bloom filter for light clients to quickly retrieve related logs.- One of the following:
root
: 32 bytes of post-transaction stateroot (pre-Byzantium)status
: Either 1 (success) or 0 (failure)
to
: 20 bytes. The address of the receiver.null
when the transaction is a contract creation transaction.transactionHash
: 32 bytes. The hash of the transaction.transactionIndex
: Hexadecimal of the transaction's index position in the block.type
: the transaction type.
Example
Replace YOUR-API-KEY
with an API key from your Infura dashboard.
Request
- cURL
- WSS
curl https://optimism-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_getTransactionReceipt", "params": ["0xbb3a336e3f823ec18197f1e13ee875700f08f03e2cab75f0d0b118dabb44cba0"], "id": 1}'
wscat -c wss://optimism-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc": "2.0", "method": "eth_getTransactionReceipt", "params": ["0xbb3a336e3f823ec18197f1e13ee875700f08f03e2cab75f0d0b118dabb44cba0"], "id": 1}'
Response
- JSON
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"blockHash": "0x0a79eca9f5ca58a1d5d5030a0fabfdd8e815b8b77a9f223f74d59aa39596e1c7",
"blockNumber": "0x11e5883",
"contractAddress": null,
"cumulativeGasUsed": "0xc5f3e7",
"effectiveGasPrice": "0xa45b9a444",
"from": "0x690b9a9e9aa1c9db991c7721a92d351db4fac990",
"gasUsed": "0x565f",
"logs": [
{
"address": "0x388c818ca8b9251b393131c08a736a67ccb19297",
"blockHash": "0x0a79eca9f5ca58a1d5d5030a0fabfdd8e815b8b77a9f223f74d59aa39596e1c7",
"blockNumber": "0x11e5883",
"data": "0x00000000000000000000000000000000000000000000000011b6b79503fb875d",
"logIndex": "0x187",
"removed": false,
"topics": [
"0x27f12abfe35860a9a927b465bb3d4a9c23c8428174b83f278fe45ed7b4da2662"
],
"transactionHash": "0x7114b4da1a6ed391d5d781447ed443733dcf2b508c515b81c17379dea8a3c9af",
"transactionIndex": "0x76"
}
],
"logsBloom": "0x00000000000000000000000000000000000100004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000",
"status": "0x1",
"to": "0x388c818ca8b9251b393131c08a736a67ccb19297",
"transactionHash": "0x7114b4da1a6ed391d5d781447ed443733dcf2b508c515b81c17379dea8a3c9af",
"transactionIndex": "0x76",
"type": "0x2"
}
}