Table description
The megaeth.blocks table contains information about blocks in the megaeth blockchain. A block is a collection of transactions that are hashed and added to the blockchain. Each block contains a reference to the previous block, known as the parent hash, and a timestamp. The table contains information about each block, such as the block number, the block hash, the block size, the number of transactions, and the gas used.Column Descriptions
| Column | Type | Description |
|---|
time | timestamp | The time when the block was mined |
number | bigint | The block number (height) |
gas_limit | decimal | Maximum gas allowed in the block |
gas_used | decimal | Total gas used by all transactions in the block |
difficulty | bigint | Mining difficulty of the block |
total_difficulty | decimal | Cumulative difficulty of the chain up to this block |
size | bigint | Size of the block in bytes |
base_fee_per_gas | bigint | Base fee per gas unit (EIP-1559) |
hash | varbinary | Hash of the block |
parent_hash | varbinary | Hash of the parent block |
miner | varbinary | Address of the miner/validator |
nonce | varbinary | Nonce used in mining the block |
date | date | Date of the block (UTC) |
blob_gas_used | bigint | Total blob gas used in the block (EIP-4844) |
excess_blob_gas | bigint | Excess blob gas for fee calculation (EIP-4844) |
parent_beacon_block_root | varbinary | Root of the parent beacon block |
Table Sample
Examples
Show the most recent blocks
SELECT
number,
hash,
size,
gas_used
FROM megaeth.blocks
ORDER BY number DESC
LIMIT 10
Show the number of blocks mined each day
SELECT
date_trunc('day', time) AS day,
count(distinct number)
FROM megaeth.blocks
GROUP BY day
ORDER BY day DESC
Show the number of transactions in each block
SELECT
number,
count(*)
FROM megaeth.blocks
GROUP BY 1
LIMIT 10