> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dune.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ethereum.blocks

> Block headers, timestamps, gas limits, base fees, and validator/miner data for Ethereum.

export const TableSample = ({tableName, tableSchema}) => <>
    <div className="hidden dark:block">
      <iframe src={`https://dune.com/embeds/3419983/5785629?table_schema_t6f0df=${tableSchema}&table_name_t6f0df=${tableName}&darkMode=true`} style={{
  width: '100%',
  height: '500px',
  border: 'none',
  marginTop: '10px'
}} />
    </div>
    <div className="dark:hidden">
      <iframe src={`https://dune.com/embeds/3419983/5785629?table_schema_t6f0df=${tableSchema}&table_name_t6f0df=${tableName}`} style={{
  width: '100%',
  height: '500px',
  border: 'none',
  marginTop: '10px'
}} />
    </div>
  </>;

## Table Description

The `ethereum.blocks` table contains information about blocks in the Ethereum 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

<TableSample tableSchema="ethereum" tableName="blocks" />

## Examples

### Show the most recent blocks

```sql theme={null}
SELECT
  number,
  hash,
  size,
  gas_used
FROM
  ethereum.blocks
ORDER BY
  number DESC
LIMIT 10
```

### Show the number of blocks mined each day

```sql theme={null}
SELECT
  date_trunc('day', time) AS day,
  count(distinct number)
FROM
  ethereum.blocks
GROUP BY
  day
ORDER BY
  day DESC
```

### Show the number of transactions in each block

```sql theme={null}
SELECT
  number,
  count(*)
FROM
  ethereum.blocks
group by 1 

LIMIT 10
```
