A command-line tool to query epoch and block number relationships from The Graph's epoch block oracle subgraph. This tool can:
- Find the start block number for a given epoch
- Determine which epoch a specific block number belongs to
- Python 3.7 or higher
- pip (Python package installer)
- Clone this repository
- Install dependencies:
pip install -r requirements.txtThe script provides two main functionalities:
./epoch_block.py --network <network-name> --epoch <epoch-id>./epoch_block.py --network <network-name> --block <block-number>--network(required): The network name (e.g., mainnet, arbitrum-one, polygon)--epoch: The epoch ID to query--block: The block number to query--subgraph-url: Custom subgraph endpoint URL (optional)
Note: You must provide either --epoch or --block, but not both.
- Find the start block number for epoch 42 on Arbitrum One:
./epoch_block.py --network arbitrum-one --epoch 42- Find which epoch contains block 12345678 on Polygon:
./epoch_block.py --network polygon --block 12345678- Use a custom subgraph endpoint:
./epoch_block.py --network mainnet --epoch 42 --subgraph-url "https://api.thegraph.com/subgraphs/name/custom-endpoint"