> ## 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.

# sei.blocks

> Block data — block height, timestamp, and metadata on Sei.

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>
  </>;

export const BlockSnippet = ({blockchain}) => <div>
    <h2>Table description</h2>
    <p>
      The <code>{blockchain}.blocks</code> table contains information about blocks in the {blockchain} 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.
    </p>
    <h2>Column Descriptions</h2>
    <table>
      <thead><tr><th>Column</th><th>Type</th><th>Description</th></tr></thead>
      <tbody>
        <tr><td><code>time</code></td><td><code>timestamp</code></td><td>The time when the block was mined</td></tr>
        <tr><td><code>number</code></td><td><code>bigint</code></td><td>The block number (height)</td></tr>
        <tr><td><code>gas_limit</code></td><td><code>decimal</code></td><td>Maximum gas allowed in the block</td></tr>
        <tr><td><code>gas_used</code></td><td><code>decimal</code></td><td>Total gas used by all transactions in the block</td></tr>
        <tr><td><code>difficulty</code></td><td><code>bigint</code></td><td>Mining difficulty of the block</td></tr>
        <tr><td><code>total_difficulty</code></td><td><code>decimal</code></td><td>Cumulative difficulty of the chain up to this block</td></tr>
        <tr><td><code>size</code></td><td><code>bigint</code></td><td>Size of the block in bytes</td></tr>
        <tr><td><code>base_fee_per_gas</code></td><td><code>bigint</code></td><td>Base fee per gas unit (EIP-1559)</td></tr>
        <tr><td><code>hash</code></td><td><code>varbinary</code></td><td>Hash of the block</td></tr>
        <tr><td><code>parent_hash</code></td><td><code>varbinary</code></td><td>Hash of the parent block</td></tr>
        <tr><td><code>miner</code></td><td><code>varbinary</code></td><td>Address of the miner/validator</td></tr>
        <tr><td><code>nonce</code></td><td><code>varbinary</code></td><td>Nonce used in mining the block</td></tr>
        <tr><td><code>date</code></td><td><code>date</code></td><td>Date of the block (UTC)</td></tr>
        <tr><td><code>blob_gas_used</code></td><td><code>bigint</code></td><td>Total blob gas used in the block (EIP-4844)</td></tr>
        <tr><td><code>excess_blob_gas</code></td><td><code>bigint</code></td><td>Excess blob gas for fee calculation (EIP-4844)</td></tr>
        <tr><td><code>parent_beacon_block_root</code></td><td><code>varbinary</code></td><td>Root of the parent beacon block</td></tr>
      </tbody>
    </table>
    <h2>
        Table Sample
    </h2>
    <TableSample tableSchema={blockchain} tableName="blocks" />
    <h2>
        Examples
    </h2>
    <h3>Show the most recent blocks</h3>
  <pre><code>{`SELECT
    number,
    hash, 
    size,
    gas_used
  FROM ${blockchain}.blocks
  ORDER BY number DESC
  LIMIT 10`}</code></pre>

  <h3>Show the number of blocks mined each day</h3>
  <pre><code>{`SELECT
    date_trunc('day', time) AS day,
    count(distinct number)
  FROM ${blockchain}.blocks
  GROUP BY day
  ORDER BY day DESC`}</code></pre>

  <h3>Show the number of transactions in each block</h3>
  <pre><code>{`SELECT
    number,
    count(*)
  FROM ${blockchain}.blocks
  GROUP BY 1 
  LIMIT 10`}</code></pre>
  </div>;

<BlockSnippet blockchain="sei" />
