get_block
Table function
Retrieves block metadata via eth_getBlockBy* endpoints using the canonical schema.
Overloads
get_block(TRANSPORT)
Fetches the latest head block without expanding transaction bodies.
Parameters
| Name | Type |
|---|---|
| transport | TRANSPORT |
Result columns
| Name | Type |
|---|---|
| hash | BYTES32 |
| parent_hash | BYTES32 |
| miner | ADDRESS |
| number | BLOCK_NUMBER |
| timestamp | TIMESTAMP |
| size | BIGINT |
| gas_limit | GAS |
| gas_used | GAS |
| base_fee_per_gas | BIGINT |
| difficulty | BIGINT |
| total_difficulty | UINT256 |
| transactions_root | BYTES32 |
| state_root | BYTES32 |
| receipts_root | BYTES32 |
| logs_bloom | BYTES256 |
| sha3_uncles | BYTES32 |
| extra_data | BLOB |
| nonce | BLOB |
| blob_gas_used | BIGINT |
| excess_blob_gas | BIGINT |
| parent_beacon_block_root | BYTES32 |
| withdrawals_root | BYTES32 |
| transactions | BYTES32[] |
| transactions_full | STRUCT(hash BYTES32, block_hash BYTES32, block_number BLOCK_NUMBER, transaction_index INTEGER, "from" ADDRESS, "to" ADDRESS, "value" UINT256, gas GAS, gas_price BIGINT, max_fee_per_gas BIGINT, max_priority_fee_per_gas BIGINT, "input" BLOB, nonce BIGINT, "type" INTEGER, v INTEGER, r BYTES32, s BYTES32)[] |
1
SELECT number, hash
2
FROM get_block(
3
$transport -- transport
4
);
Notebook ready in readonly mode.
get_block(TRANSPORT, BIGINT)
Fetches a specific block by height, accepting decimal integers that are converted to hex tags.
Parameters
| Name | Type |
|---|---|
| transport | TRANSPORT |
| block_number | BIGINT |
Result columns
| Name | Type |
|---|---|
| hash | BYTES32 |
| parent_hash | BYTES32 |
| miner | ADDRESS |
| number | BLOCK_NUMBER |
| timestamp | TIMESTAMP |
| size | BIGINT |
| gas_limit | GAS |
| gas_used | GAS |
| base_fee_per_gas | BIGINT |
| difficulty | BIGINT |
| total_difficulty | UINT256 |
| transactions_root | BYTES32 |
| state_root | BYTES32 |
| receipts_root | BYTES32 |
| logs_bloom | BYTES256 |
| sha3_uncles | BYTES32 |
| extra_data | BLOB |
| nonce | BLOB |
| blob_gas_used | BIGINT |
| excess_blob_gas | BIGINT |
| parent_beacon_block_root | BYTES32 |
| withdrawals_root | BYTES32 |
| transactions | BYTES32[] |
| transactions_full | STRUCT(hash BYTES32, block_hash BYTES32, block_number BLOCK_NUMBER, transaction_index INTEGER, "from" ADDRESS, "to" ADDRESS, "value" UINT256, gas GAS, gas_price BIGINT, max_fee_per_gas BIGINT, max_priority_fee_per_gas BIGINT, "input" BLOB, nonce BIGINT, "type" INTEGER, v INTEGER, r BYTES32, s BYTES32)[] |
1
SELECT number, hash
2
FROM get_block(
3
$transport, -- transport
4
4200000 -- block_number
5
);
Notebook ready in readonly mode.
get_block(TRANSPORT, VARCHAR)
Accepts canonical tags (latest, safe, finalized) or a 0x-prefixed block hash.
Parameters
| Name | Type |
|---|---|
| transport | TRANSPORT |
| block_tag_or_hash | VARCHAR |
Result columns
| Name | Type |
|---|---|
| hash | BYTES32 |
| parent_hash | BYTES32 |
| miner | ADDRESS |
| number | BLOCK_NUMBER |
| timestamp | TIMESTAMP |
| size | BIGINT |
| gas_limit | GAS |
| gas_used | GAS |
| base_fee_per_gas | BIGINT |
| difficulty | BIGINT |
| total_difficulty | UINT256 |
| transactions_root | BYTES32 |
| state_root | BYTES32 |
| receipts_root | BYTES32 |
| logs_bloom | BYTES256 |
| sha3_uncles | BYTES32 |
| extra_data | BLOB |
| nonce | BLOB |
| blob_gas_used | BIGINT |
| excess_blob_gas | BIGINT |
| parent_beacon_block_root | BYTES32 |
| withdrawals_root | BYTES32 |
| transactions | BYTES32[] |
| transactions_full | STRUCT(hash BYTES32, block_hash BYTES32, block_number BLOCK_NUMBER, transaction_index INTEGER, "from" ADDRESS, "to" ADDRESS, "value" UINT256, gas GAS, gas_price BIGINT, max_fee_per_gas BIGINT, max_priority_fee_per_gas BIGINT, "input" BLOB, nonce BIGINT, "type" INTEGER, v INTEGER, r BYTES32, s BYTES32)[] |
1
SELECT number, hash
2
FROM get_block(
3
$transport, -- transport
4
'safe' -- block_tag_or_hash
5
);
Notebook ready in readonly mode.
get_block(TRANSPORT, BIGINT, BOOLEAN)
Fetches a block by height and expands the transactions array when include_transactions is true.
Parameters
| Name | Type |
|---|---|
| transport | TRANSPORT |
| block_number | BIGINT |
| include_transactions | BOOLEAN |
Result columns
| Name | Type |
|---|---|
| hash | BYTES32 |
| parent_hash | BYTES32 |
| miner | ADDRESS |
| number | BLOCK_NUMBER |
| timestamp | TIMESTAMP |
| size | BIGINT |
| gas_limit | GAS |
| gas_used | GAS |
| base_fee_per_gas | BIGINT |
| difficulty | BIGINT |
| total_difficulty | UINT256 |
| transactions_root | BYTES32 |
| state_root | BYTES32 |
| receipts_root | BYTES32 |
| logs_bloom | BYTES256 |
| sha3_uncles | BYTES32 |
| extra_data | BLOB |
| nonce | BLOB |
| blob_gas_used | BIGINT |
| excess_blob_gas | BIGINT |
| parent_beacon_block_root | BYTES32 |
| withdrawals_root | BYTES32 |
| transactions | BYTES32[] |
| transactions_full | STRUCT(hash BYTES32, block_hash BYTES32, block_number BLOCK_NUMBER, transaction_index INTEGER, "from" ADDRESS, "to" ADDRESS, "value" UINT256, gas GAS, gas_price BIGINT, max_fee_per_gas BIGINT, max_priority_fee_per_gas BIGINT, "input" BLOB, nonce BIGINT, "type" INTEGER, v INTEGER, r BYTES32, s BYTES32)[] |
1
SELECT number, transactions
2
FROM get_block(
3
$transport, -- transport
4
4200000, -- block_number
5
true -- include_transactions
6
);
Notebook ready in readonly mode.
get_block(TRANSPORT, VARCHAR, BOOLEAN)
Fetches a tag- or hash-addressed block and optionally returns full transaction payloads.
Parameters
| Name | Type |
|---|---|
| transport | TRANSPORT |
| block_tag_or_hash | VARCHAR |
| include_transactions | BOOLEAN |
Result columns
| Name | Type |
|---|---|
| hash | BYTES32 |
| parent_hash | BYTES32 |
| miner | ADDRESS |
| number | BLOCK_NUMBER |
| timestamp | TIMESTAMP |
| size | BIGINT |
| gas_limit | GAS |
| gas_used | GAS |
| base_fee_per_gas | BIGINT |
| difficulty | BIGINT |
| total_difficulty | UINT256 |
| transactions_root | BYTES32 |
| state_root | BYTES32 |
| receipts_root | BYTES32 |
| logs_bloom | BYTES256 |
| sha3_uncles | BYTES32 |
| extra_data | BLOB |
| nonce | BLOB |
| blob_gas_used | BIGINT |
| excess_blob_gas | BIGINT |
| parent_beacon_block_root | BYTES32 |
| withdrawals_root | BYTES32 |
| transactions | BYTES32[] |
| transactions_full | STRUCT(hash BYTES32, block_hash BYTES32, block_number BLOCK_NUMBER, transaction_index INTEGER, "from" ADDRESS, "to" ADDRESS, "value" UINT256, gas GAS, gas_price BIGINT, max_fee_per_gas BIGINT, max_priority_fee_per_gas BIGINT, "input" BLOB, nonce BIGINT, "type" INTEGER, v INTEGER, r BYTES32, s BYTES32)[] |
1
SELECT number, transactions
2
FROM get_block(
3
$transport, -- transport
4
'finalized', -- block_tag_or_hash
5
true -- include_transactions
6
);
Notebook ready in readonly mode.