eth_getBlockByNumber - Optimism
Returns information about a block by block number.
Currently, Optimistic Ethereum blocks only include a single transaction. If you query eth_getBlockByNumber or eth_getBlockByHash, you should expect to only see one transaction.

Parameters

  • QUANTITY|TAG - integer of a block number, or the string "earliest", "latest" or "pending", as in the default block parameter.
  • Boolean - If true it returns the full transaction objects, if false only the hashes of the transactions.
1
params: [
2
'0x1b4',
3
true
4
]
Copied!

Returns

Request
Curl
Postman
1
curl https://opt-mainnet.g.alchemy.com/v2/your-api-key \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x1b4", true],"id":0}'
Copied!
1
URL: https://opt-mainnet.g.alchemy.com/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"eth_getBlockByNumber",
7
"params":["0x1b4", true],
8
"id":0
9
}
Copied!
Result
1
{
2
"jsonrpc": "2.0",
3
"id": 0,
4
"result": {
5
"difficulty": "0x2",
6
"extraData": "0xd98301090a846765746889676f312e31352e3133856c696e7578000000000000138670a98dc89f978cb46c35cf92c6308bc63660af42e30e6639e401e11da77c693dde6324c8ec5ed641ecc2f82b8d747d6ffcd7f4e03c7694dde6b12f5b252000",
7
"gasLimit": "0xa7d8c0",
8
"gasUsed": "0x379e70",
9
"hash": "0x02b853cf50bc1c335b70790f93d5a390a35a166bea9c895e685cc866e4961cae",
10
"logsBloom": "0x00000000000000000000000000400100000000000000000000040000000000000000000000000000000000900002000100000000000000000000000000000000000000000001000000000008104000000000000000000000000000400000000000000000000000000000000000000000200000000040000000000010000000000008000000040000000000000000000000000000002000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000002000100000000000000000000000000020000000000000000000000000000000000200008000000000000000000000000000000000000000000000000",
11
"miner": "0x0000000000000000000000000000000000000000",
12
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
13
"nonce": "0x0000000000000000",
14
"number": "0x1b4",
15
"parentHash": "0x17433dcb86d75391996efcef54b00846f1375551009328c98e2f17da793c9414",
16
"receiptsRoot": "0x437d8dec027b1798878814d484fcf1cfb315f0b401767f150613e7ce1bb67d8c",
17
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
18
"size": "0x2cc",
19
"stateRoot": "0x86830e056ff5841c615b0a3f1d0dac42bd0e27ca1206593b25f6d358c3c7fe24",
20
"timestamp": "0x60d34b60",
21
"totalDifficulty": "0x369",
22
"transactions": [
23
{
24
"blockHash": "0x02b853cf50bc1c335b70790f93d5a390a35a166bea9c895e685cc866e4961cae",
25
"blockNumber": "0x1b4",
26
"from": "0x3b179dcfc5faa677044c27dce958e4bc0ad696a6",
27
"gas": "0x11cbbdc",
28
"gasPrice": "0x0",
29
"hash": "0x2642e960d3150244e298d52b5b0f024782253e6d0b2c9a01dd4858f7b4665a3f",
30
"input": "0xd294f093",
31
"nonce": "0xa2",
32
"to": "0x4a16a42407aa491564643e1dfc1fd50af29794ef",
33
"transactionIndex": "0x0",
34
"value": "0x0",
35
"v": "0x38",
36
"r": "0x6fca94073a0cf3381978662d46cf890602d3e9ccf6a31e4b69e8ecbd995e2bee",
37
"s": "0xe804161a2b56a37ca1f6f4c4b8bce926587afa0d9b1acc5165e6556c959d583",
38
"queueOrigin": "sequencer",
39
"txType": "",
40
"l1TxOrigin": null,
41
"l1BlockNumber": "0xc1a65c",
42
"l1Timestamp": "0x60d34b60",
43
"index": "0x1b3",
44
"queueIndex": null,
45
"rawTransaction": "0xf86681a28084011cbbdc944a16a42407aa491564643e1dfc1fd50af29794ef8084d294f09338a06fca94073a0cf3381978662d46cf890602d3e9ccf6a31e4b69e8ecbd995e2beea00e804161a2b56a37ca1f6f4c4b8bce926587afa0d9b1acc5165e6556c959d583"
46
}
47
],
48
"transactionsRoot": "0x874e61dfee4625c52bf64a90805f60c03cfd37eb35f43f46fa1f755b80a12223",
49
"uncles": []
50
}
51
}
Copied!
Optimism API
Alchemy Documentation
Copy link
Contents