chain-index is a Python package for retrieving blockchain network metadata and common token information from local JSON snapshots.
It supports lookups by chain ID, chain name, alias, and short name, and exposes helpers for native, wrapped-native, and common token access.
pip install chain-indexImport the package as chain_index:
from chain_index import get_chain_info, get_token_info, get_all_chain_tokensfrom chain_index import get_chain_info, get_token_info, get_all_chain_tokens
ethereum = get_chain_info(1)
print(ethereum.name)
print(ethereum.nativeCurrency.symbol)
usdt = get_token_info(1, "USDT")
print(usdt.contract)
tokens = get_all_chain_tokens(1)
print(tokens.get_token("ETH").contract)
print(tokens.get_token("WETH").contract)Returns a ChainInfo model for a chain ID, decimal string, hex string, chain name, alias, or short name.
Returns a TokenInfo model for a common token on the requested chain.
Returns a dictionary of common token symbols to TokenInfo models for the requested chain.
Returns a ChainTokens helper that includes:
- the native token
- the wrapped native token when available
- all configured common tokens
pip install -e ".[dev]"
pytestThis project uses chain metadata derived from chainid.network.
Open an issue or submit a pull request in this repository.
See CHANGELOG.md for notable changes.
This project is licensed under the MIT License. See LICENSE for details.