eth
eth_getBlockByNumber
Returns information about a block by its block number.
Returns information about a block by its block number.
Parameters
| # | Type | Description |
|---|---|---|
| 1 | string | Block number as a hex string, or a block tag ("latest", "earliest", "pending"). |
| 2 | bool | If true, returns full transaction objects; if false, returns only transaction hashes. |
Returns
object | null -- A block object, or null if no block was found. The object contains:
| Field | Type | Description |
|---|---|---|
number | string | Block number (hex) |
hash | string | Block hash (32 bytes) |
parentHash | string | Hash of the parent block |
nonce | string | Always "0x0000000000000000" on PoS |
sha3Uncles | string | SHA3 of the uncles data |
logsBloom | string | Bloom filter for the logs (256 bytes) |
transactionsRoot | string | Root of the transaction trie |
stateRoot | string | Root of the state trie |
receiptsRoot | string | Root of the receipts trie |
miner | string | Address of the block proposer |
difficulty | string | Always "0x0" on PoS |
totalDifficulty | string | Cumulative difficulty |
extraData | string | Extra data field |
size | string | Block size in bytes (hex) |
gasLimit | string | Maximum gas allowed in the block (hex) |
gasUsed | string | Total gas used by all transactions (hex) |
timestamp | string | Unix timestamp of the block (hex) |
transactions | array | Transaction hashes or full transaction objects |
uncles | array | Always empty on PoS |
baseFeePerGas | string | Base fee per gas (EIP-1559, hex) |
Example
curl -s -X POST https://rpc.pulsechain.box \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBlockByNumber",
"params": ["0x100000", false],
"id": 1
}'
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"number": "0x100000",
"hash": "0x...",
"parentHash": "0x...",
"timestamp": "0x...",
"gasLimit": "0x1c9c380",
"gasUsed": "0x...",
"miner": "0x...",
"baseFeePerGas": "0x...",
"transactions": [],
"..."
}
}
TRY IT
Notes
- Set the second parameter to
falseto return only transaction hashes, which is significantly faster and uses less bandwidth for blocks with many transactions. - Set it to
trueto get full transaction objects includingfrom,to,value,input,gas, etc. - Returns
nullfor block numbers that do not exist yet. - The block tag
"latest"returns the most recently mined block,"earliest"returns the genesis block (block 0), and"pending"returns the pending block being assembled. - Block
0x100000(1,048,576 in decimal) is used in the example as a known historical block on PulseChain.
