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

# Epochs

> Records of epoch transitions on the Monad network

This table tracks all epoch transition events on the Monad network. Each epoch is approximately 50,000 blocks (\~5.5 hours).

## Table Schema

| Column Name                | Data Type | Description                                         |
| -------------------------- | --------- | --------------------------------------------------- |
| old\_epoch                 | INTEGER   | The epoch number before the transition              |
| new\_epoch                 | INTEGER   | The epoch number after the transition               |
| contract\_address          | VARCHAR   | Address of the staking precompile contract          |
| transaction\_hash          | VARCHAR   | Hash of the transaction containing the epoch change |
| transaction\_index         | INTEGER   | Index of the transaction in the block               |
| transaction\_from\_address | VARCHAR   | Address that initiated the transaction              |
| transaction\_to\_address   | VARCHAR   | Target address of the transaction                   |
| log\_index                 | INTEGER   | Index of the event log in the transaction           |
| block\_timestamp           | TIMESTAMP | Timestamp of the block at epoch boundary            |
| block\_number              | INTEGER   | Block number at epoch boundary                      |
| block\_hash                | VARCHAR   | Hash of the block at epoch boundary                 |
| unique\_id                 | VARCHAR   | Unique identifier for the epoch change event        |

## Understanding Epochs

Epochs are fundamental time periods in Monad's staking system:

* **Duration**: Approximately 50,000 blocks (\~5.5 hours)
* **Stake Activation**: Delegation and undelegation actions take effect at epoch boundaries
* **Reward Distribution**: Rewards are calculated and distributed per epoch
* **Validator Changes**: Commission changes and other validator updates apply at epoch transitions

## Sample Query

Calculate average epoch duration over time:

```sql theme={null}
SELECT 
  new_epoch,
  block_timestamp as epoch_start,
  block_number as epoch_start_block,
  LAG(block_timestamp) OVER (ORDER BY new_epoch) as prev_epoch_start,
  DATEDIFF('hour', LAG(block_timestamp) OVER (ORDER BY new_epoch), block_timestamp) as epoch_duration_hours
FROM monad.staking.epochs
ORDER BY new_epoch DESC
LIMIT 100;
```
