eth
eth_getBlockByHash
Returns information about a block by its hash.
Returns information about a block by its hash.
Parameters
| # | Type | Description |
|---|---|---|
| 1 | string | The hash of the block (32 bytes). |
| 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 the same fields as eth_getBlockByNumber:
| 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_getBlockByHash",
"params": ["0x88e96d4537bea4d9c05d12549907b32561d3bf31f45aae734cdc119f13406cb6", false],
"id": 1
}'
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"number": "0x1",
"hash": "0x88e96d4537bea4d9c05d12549907b32561d3bf31f45aae734cdc119f13406cb6",
"parentHash": "0x3b8a456c4a2b647bb4acb79e8044e1e7bfe7c7e718bac956dea9956a31c5ec3b",
"timestamp": "0x645a0468",
"gasLimit": "0x1c9c380",
"gasUsed": "0x0",
"miner": "0x0000000000000000000000000000000000000000",
"baseFeePerGas": "0x3b9aca00",
"transactions": [],
"..."
}
}
TRY IT
Notes
- This method is functionally identical to
eth_getBlockByNumberbut uses the block hash as the identifier instead of the block number. - Block hashes are unique identifiers and are preferred when you need to reference a specific block unambiguously, especially during chain reorganizations.
- Returns
nullif no block with the given hash exists. - Set the second parameter to
falsefor transaction hashes only (faster) ortruefor full transaction objects. - The example uses the hash of block 1.
