eth_getBlockByNumber
Returns information about a block by block number.
Params
- a string array containing (required):QUANTITY|TAG(hex string|string, required)
- integer block number in hex string format, or the string"earliest"
,"latest"
or"pending"
, as in the default block parameter.Boolean(boolean, required)
- iftrue
it returns the full transaction objects, iffalse
only the hashes of the transactions.
Object
- A block object, or null
when no block was found.number(hex string)
.QUANTITY
- the block number.null
when its pending block.hash(hex string)
.DATA
, 32 Bytes - hash of the block.null
when its pending block.parentHash(hex string)
.DATA
, 32 Bytes - hash of the parent block.nonce(hex string)
.DATA
, 8 Bytes - hash of the generated proof-of-work.null
when its pending block.sha3Uncles(hex string)
.DATA
, 32 Bytes - SHA3 of the uncles data in the block.logsBloom(hex string)
.DATA
, 256 Bytes - the bloom filter for the logs of the block.null
when its pending block.transactionsRoot(hex string)
.DATA
, 32 Bytes - the root of the transaction trie of the block.stateRoot(hex string)
.DATA
, 32 Bytes - the root of the final state trie of the block.receiptsRoot(hex string)
.DATA
, 32 Bytes - the root of the receipts trie of the block.miner(hex string)
.DATA
, 20 Bytes - the address of the beneficiary to whom the mining rewards were given.difficulty(hex string)
.QUANTITY
- integer of the difficulty for this block.totalDifficulty(hex string)
.QUANTITY
- integer of the total difficulty of the chain until this block.extraData(hex string)
.DATA
- the “extra data” field of this block.size(hex string)
.QUANTITY
- integer the size of this block in bytes.gasLimit(hex string)
.QUANTITY
- the maximum gas allowed in this block.gasUsed(hex string)
.QUANTITY
- the total used gas by all transactions in this block.timestamp(hex string)
.QUANTITY
- the unix timestamp for when the block was collated.transactions(array of object)
.Array
- Array of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter.uncles(array of hex string)
.Array
- Array of uncle hashes.
curl
TypeScript
curl https://api.blockvision.org/v1/<api key> \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBlockByNumber",
"params": [
"0xd5aa53",
true
],
"id": 1
}'
import { BlockVisionProvider, BvNetwork } from 'blockvision.js'
// Optional parameters, but default to eth-mainnet and default api-key.
const bv = new BlockVisionProvider(BvNetwork.BNB_MAINNET)
// Access standard Ethers.js JSON-RPC node request
bv.getBlock("0xd5aa53").then(console.log)
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"baseFeePerGas": "0x1a8d98d7ad",
"difficulty": "0x2d5083423fdda5",
"extraData": "0x617369612d65617374322d31763932",
"gasLimit": "0x1c9c380",
"gasUsed": "0x0",
"hash": "0x8bde9c914d846005d048330316a5d8bfc141b3a7180b764467a784eb9ae5c5f1",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"miner": "0xea674fdde714fd979de3edf0f56aa9716b898ec8",
"mixHash": "0xc90be6158f0a9da0915f7f0d1b3b770aaff4ac3db16f64d7393ff8380a272163",
"nonce": "0xaeeb0607425725b6",
"number": "0xd5aa53",
"parentHash": "0xb99d400df0c06ba1b66fbbd5518f8f2bd9088ae763304e3fc1de1629c9b9f5de",
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"size": "0x21c",
"stateRoot": "0x9637b2db65e4051d98a5c043250044384bb6f17858a8ac1c502102b698cc341c",
"timestamp": "0x61e13da6",
"totalDifficulty": "0x83e70df932c9ce104df",
"transactions": [],
"transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"uncles": []
}
}
Last modified 1mo ago