eth_getBlockByNumber
Returns information about a block by number.
Example
curl https://bsc-<network>.web3api.com/v1/YOUR-API-KEY
-X POST
-H "Content-Type: application/json"
-d "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\": [\"0x6F3225\", false],\"id\":1}"
curl -X POST 'https://bsc-<network>.web3api.com/v1/YOUR-API-KEY' \
-H 'Content-Type: application/json' \
--data-raw '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params": ["0x6F3225", false],"id":1}'
BLOCK PARAMETER
- Anint
block number in the form of hex, appended with 0x such as0x6D7FE0
, or pre-defined stringslatest
,earliest
,pending
.SHOW TRANSACTION DETAILS FLAG
- Aboolean
parameter. Whentrue
, returns the full transaction information of each transaction hash included within the block. Whenfalse
, only returns transaction hashes within the block.
Web3API's Composer accepts int
block numbers, which will be auto-converted to a hex representation before being sent to a node.
Result Fields
BLOCK
- A block object, or null when no block was found with the number specified.
Within the block object, the following block information are available.
difficulty
: integer of the difficulty for this block.extraData
: the "extra data" field of this block.gasLimit
: the maximum gas allowed in this block.gasUsed
: the total used gas by all transactions in this block.hash
: 32 Bytes - hash of the block. Null when the returned block is the pending block.logsBloom
: 256 Bytes - the bloom filter for the logs of the block. Null when the returned block is the pending block.miner
: 20 Bytes - the address of the beneficiary to whom the mining rewards were given.mixHash
-nonce
: 8 Bytes - hash of the generated proof-of-work. Null when the returned block is the pending block.number
: the block number. Null when the returned block is the pending block.parentHash
: 32 Bytes - hash of the parent block.receiptsRoot
: 32 Bytes - the root of the receipts trie of the block.sha3Uncles
: 32 Bytes - SHA3 of the uncles data in the block.size
: integer the size of this block in bytes.stateRoot
: 32 Bytes - the root of the final state trie of the block.timestamp
: the unix timestamp for when the block was collated.totalDifficulty
: integer of the total difficulty of the chain until this block.transactions
: Array - Array of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter.transactionsRoot
: 32 Bytes - the root of the transaction trie of the block.uncles
: an Array of uncle hashes.
Body
{
"jsonrpc":"2.0",
"id":1,
"result":{
"difficulty":"0x2",
"extraData":"0xd883010007846765746888676f312e31352e35856c696e7578000000fc3ca6b7c2bfa0f0018488d389673b8267cc1eb7d25c0a16e92889dafa8fbd5446d55a004602c9f8c3ac3444610d8a3091376fe87d29e44bb88d5dec0b885b718ca1f36700",
"gasLimit":"0x2dc9ffa",
"gasUsed":"0x1e60464",
"hash":"0x1fb2230a6b5bf856bb4df3c80cbf95b84454169a5a133fffaf8505a05f960aeb",
"logsBloom":"0x8deb8ebc5ffd151c0764c558d00009996a5a967dce4cfa333378b128eecf03243b19d66ebc1e1d677d69fcea9e8b0722ede6bc11ba22289b0710bdf5663f72e9b27f7b57d3859c83e5bbee9a1efb98f6fe1f49a8dc6ed96bdf04ba79d077fe75ebaff72dbf5ac9eb9faaf2c33d254bf2cb3597dda5be3ff19e7f7c9794d6c5bfc2649af11955981169af274e3db41cb34c66dc85fa39cbdc7f81295cea20edd25b5a25d2e9c14d4d064ecf48b2ceee7972658213df605b661fff23aa00b013e634df65ee9200791f7595358b2fc7f17def555e1194a196b27a32f8fbe9eee19f76b94e3284d0450b493ab4ab3f640fb066bdff7dcbcbf37be82636991ff8e4ee",
"miner":"0x7ae2f5b9e386cd1b50a4550696d957cb4900f03a",
"mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000",
"nonce":"0x0000000000000000",
"number":"0x6e05b6",
"parentHash":"0x67551efb54174d16002405e2847756e4e7555cfca44ff5823c695a8c07992c5a",
"receiptsRoot":"0x01e794163bb70020ad2286149bd4794827aa560ca41be6f0f606e7ac50ad1734",
"sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"size":"0x17faa",
"stateRoot":"0xc1414eee14dc067b8044f398f5a9b123edc56130f91a2114515d901d387a4852",
"timestamp":"0x60950792",
"totalDifficulty":"0xdb7f02",
"transactions":[
"0x2fa91f0bd9dc0ac4c3809efa40778d518968497bc585d3b478559e4cd55f4a23",
"0x6232bd82064c316cd7ece24e8e2025670a53d31574f20f9da2b857d64f972d30",
"0xef1ad0aa81163162ca013c375ce222a09eae4ebe8f7b567b72905e11f1258ba1",
],
"transactionsRoot":"0x0f2b87218f5f85740725b04f911f6027c34ebeba808f84d02d6afb17f06399af",
"uncles":[
]
}
}
Last updated