Skip to content

ellipfra/graph-epoch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Epoch Block Query Tool

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

Installation

Prerequisites

  • Python 3.7 or higher
  • pip (Python package installer)

Setup

  1. Clone this repository
  2. Install dependencies:
pip install -r requirements.txt

Usage

The script provides two main functionalities:

1. Find Block Number for an Epoch

./epoch_block.py --network <network-name> --epoch <epoch-id>

2. Find Epoch for a Block Number

./epoch_block.py --network <network-name> --block <block-number>

Arguments

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

Examples

  1. Find the start block number for epoch 42 on Arbitrum One:
./epoch_block.py --network arbitrum-one --epoch 42
  1. Find which epoch contains block 12345678 on Polygon:
./epoch_block.py --network polygon --block 12345678
  1. Use a custom subgraph endpoint:
./epoch_block.py --network mainnet --epoch 42 --subgraph-url "https://api.thegraph.com/subgraphs/name/custom-endpoint"

About

Determine graph epoch for various networks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages