eth_getTransactionReceipt - Optimism
This can also be used to track the status of a transaction, since the result will be null until the transaction is mined. However, unlike eth_getTransactionByHash , which returns null for unknown transactions, and a non-null response with 3 null fields for a pending transaction, eth_getTransactionReceipt returns null for both pending and unknown transactions.
This call is also commonly used to get the contract address for a contract creation tx.
Note: The receipt is not available for pending transactions.

Parameters

DATA, 32 Bytes - hash of a transaction
1
params: [
2
'0x09947eaa4920d9d1a5b443c22e3cda1a14baa6b1f8607559de38ac05ff99e5ad'
3
]
Copied!

Returns

Object - A transaction receipt object, or null when no receipt was found:
  • transactionHash: DATA, 32 Bytes - hash of the transaction.
  • transactionIndex: QUANTITY - integer of the transactions index position in the block.
  • blockHash: DATA, 32 Bytes - hash of the block where this transaction was in.
  • blockNumber: QUANTITY - block number where this transaction was in.
  • from: DATA, 20 Bytes - address of the sender.
  • to: DATA, 20 Bytes - address of the receiver. null when its a contract creation transaction.
  • cumulativeGasUsed: QUANTITY - The total amount of gas used when this transaction was executed in the block.
  • gasUsed: QUANTITY - The amount of gas used by this specific transaction alone.
  • contractAddress: DATA, 20 Bytes - The contract address created, if the transaction was a contract creation, otherwise null.
  • logs: Array - Array of log objects, which this transaction generated.
  • logsBloom: DATA, 256 Bytes - Bloom filter for light clients to quickly retrieve related logs.
It also returns either:
  • root : DATA 32 bytes of post-transaction stateroot (pre Byzantium)
  • status: QUANTITY either 1 (success) or 0 (failure)
Request
Curl
Postman
1
curl https://opt-mainnet.g.alchemyapi.io/v2/your-api-key \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d '{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0x09947eaa4920d9d1a5b443c22e3cda1a14baa6b1f8607559de38ac05ff99e5ad"],"id":0}
Copied!
1
URL: https://opt-mainnet.g.alchemyapi.io/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"eth_getTransactionReceipt",
7
"params":["0x09947eaa4920d9d1a5b443c22e3cda1a14baa6b1f8607559de38ac05ff99e5ad"],
8
"id":0
9
}
Copied!
Result
1
{
2
"jsonrpc": "2.0",
3
"id": 0,
4
"result": {
5
"blockHash": "0x7cf4df93eb84897abd5b913e0e8625d1158f7661759c22d4b5995702e576398b",
6
"blockNumber": "0x41fe0",
7
"contractAddress": null,
8
"cumulativeGasUsed": "0x169e81",
9
"from": "0xd44fd1c1fe3f3f0d93a8867af4041ab231783fcb",
10
"gasUsed": "0x169e81",
11
"logs": [
12
{
13
"address": "0x4200000000000000000000000000000000000006",
14
"topics": [
15
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
16
"0x000000000000000000000000d44fd1c1fe3f3f0d93a8867af4041ab231783fcb",
17
"0x0000000000000000000000004200000000000000000000000000000000000011"
18
],
19
"data": "0x0000000000000000000000000000000000000000000000000001f4d05e595b80",
20
"blockNumber": "0x41fe0",
21
"transactionHash": "0x09947eaa4920d9d1a5b443c22e3cda1a14baa6b1f8607559de38ac05ff99e5ad",
22
"transactionIndex": "0x0",
23
"blockHash": "0x7cf4df93eb84897abd5b913e0e8625d1158f7661759c22d4b5995702e576398b",
24
"logIndex": "0x0",
25
"removed": false
26
},
27
{
28
"address": "0x2e4a187732166a0282e52527b931c96146ac7c58",
29
"topics": [
30
"0x92e98423f8adac6e64d0608e519fd1cefb861498385c6dee70d58fc926ddc68c",
31
"0x00000000000000000000000000000000000000000000000000000000384d73c0",
32
"0x0000000000000000000000000000000000000000000000000000000000001314",
33
"0x000000000000000000000000d44fd1c1fe3f3f0d93a8867af4041ab231783fcb"
34
],
35
"data": "0x",
36
"blockNumber": "0x41fe0",
37
"transactionHash": "0x09947eaa4920d9d1a5b443c22e3cda1a14baa6b1f8607559de38ac05ff99e5ad",
38
"transactionIndex": "0x0",
39
"blockHash": "0x7cf4df93eb84897abd5b913e0e8625d1158f7661759c22d4b5995702e576398b",
40
"logIndex": "0x1",
41
"removed": false
42
},
43
{
44
"address": "0x2e4a187732166a0282e52527b931c96146ac7c58",
45
"topics": [
46
"0x0559884fd3a460db3073b7fc896cc77986f16e378210ded43186175bf646fc5f",
47
"0x0000000000000000000000000000000000000000000000000000000038538e40",
48
"0x0000000000000000000000000000000000000000000000000000000000001314"
49
],
50
"data": "0x000000000000000000000000000000000000000000000000000000006108559e",
51
"blockNumber": "0x41fe0",
52
"transactionHash": "0x09947eaa4920d9d1a5b443c22e3cda1a14baa6b1f8607559de38ac05ff99e5ad",
53
"transactionIndex": "0x0",
54
"blockHash": "0x7cf4df93eb84897abd5b913e0e8625d1158f7661759c22d4b5995702e576398b",
55
"logIndex": "0x2",
56
"removed": false
57
},
58
{
59
"address": "0x2e4a187732166a0282e52527b931c96146ac7c58",
60
"topics": [
61
"0xfe25c73e3b9089fac37d55c4c7efcba6f04af04cebd2fc4d6d7dbb07e1e5234f",
62
"0x00000000000000000000000000000000000000000000000e34ac9e997f1d0000"
63
],
64
"data": "0x",
65
"blockNumber": "0x41fe0",
66
"transactionHash": "0x09947eaa4920d9d1a5b443c22e3cda1a14baa6b1f8607559de38ac05ff99e5ad",
67
"transactionIndex": "0x0",
68
"blockHash": "0x7cf4df93eb84897abd5b913e0e8625d1158f7661759c22d4b5995702e576398b",
69
"logIndex": "0x3",
70
"removed": false
71
}
72
],
73
"logsBloom": "0x000000000000000000000000000000a0000000000000000000042000008000000000400000004000000000100000004100000000000200000040000000000000100000000000000004000008002000000000000000000000000000400000000000000000080000000000002020040000400000000400000000000010100000000000000000000000000000000000000000000480002000000000000000000000000000000000000000000008000000000000000000000010000000000000000000400002000000000000000000000008000000002000000000000000000000000000000000001008000000000000000000000000000000000000000000000000",
74
"status": "0x1",
75
"to": "0x2e4a187732166a0282e52527b931c96146ac7c58",
76
"transactionHash": "0x09947eaa4920d9d1a5b443c22e3cda1a14baa6b1f8607559de38ac05ff99e5ad",
77
"transactionIndex": "0x0"
78
}
79
}
Copied!
Optimism API
Alchemy Documentation
Copy link
Contents