Skip to main content

Don't have an RPC Node yet?

Start using RPC Nodes in your project today.

Get your free RPC Node

eth_getBlockByNumber

Get Block By Number

POSThttps://site1.moralis-nodes.com/:chain/:apiKey

Retrieves information about a block by its block number. The method can optionally return full transaction objects within the block if the second parameter is set to true; otherwise, it returns only the transaction hashes.

Note

Please refer to RPC schema page for more details on the RPC params and RPC response definitions of the RPC method.

PATH PARAMS
chainstringrequired
The blockchain to interact with.
apiKeystringrequired
Your API key for authentication.
BODY PARAM
Request Bodyobjectrequired
The request payload for retrieving block information by number.
Responses
200Returns detailed information about the requested block.
400Bad Request
404Not Found
429Too Many Requests
500Internal Server Error
curl --request POST \
--url 'https://site1.moralis-nodes.com/eth/YOUR_API_KEY' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_getBlockByNumber"
}
'
Response Example
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"number": "0x10d4f",
"hash": "0x18173058d45f8aa984181fdfbfece01a93a971ea63e008231b2e15f151e0903f",
"transactions": [
{
"blockHash": "0x18173058d45f8aa984181fdfbfece01a93a971ea63e008231b2e15f151e0903f",
"blockNumber": "0x15df",
"from": "0x354f3eD35Ae1a182aF933b793e49d3c86CFcDc63",
"to": "0x354f3eD35Ae1a182aF933b793e49d3c86CFcDc63"
}
],
"parentHash": "0xd584c5509e3a3d4b2d3bbde4c8e8c0adec7f5c560e9d42b8f12f3c039dd40e92",
"nonce": "0x0000000000000000",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"logsBloom": "0x00000000...",
"transactionsRoot": "0x3a1b2c...",
"stateRoot": "0xf1132b...",
"receiptsRoot": "0x140f3e...",
"miner": "0x4e65fda2159562a496f9f3522f89122a3088497a",
"difficulty": "0xffffffff",
"totalDifficulty": "0x222e4800",
"extraData": "0xd783010703846765746887676f312e392e34856c696e7578",
"size": "0x280",
"gasLimit": "0x47e7c4",
"gasUsed": "0x45f3",
"timestamp": "0x5a5b8d80",
"uncles": [
"0x1602e3..."
]
}
}