Blockchains

Data structures and information about EVM based blockchains.

We embed the chain list data from https://github.com/ethereum-lists/chains as the submodule for the Python package.

exception tradingstrategy.chain.ChainDataDoesNotExist

Cannot find data for a specific chain

class tradingstrategy.chain.ChainId

Ethereum EVM chain ids and chain metadata.

Chain id is an integer that defines the identity of a blockchain, all running on same or different EVM implementations.

See https://chainid.network/ and https://github.com/ethereum-lists/chains for the full list.

This class also provides various other metadata attributes besides ChainId.value, like ChainId.get_slug(). These are pulled from chaindata git submodule.

ethereum = 1

Ethereum mainnet chain id

bsc = 56

Binance Smarrt Chain mainnet chain id

polygon = 137

Polygon chain id

property data: dict

Get chain data entry for this chain.

get_name() str

Get full human readab name for this blockchain

get_slug() str

Get URL slug for this chain

get_homepage() str

Get homepage link for this blockchain

Get an absolute SVG image link to a chain icon, transparent background

get_explorer() str

Get explorer landing page for this blockchain

Get one address link.

Use EIP3091 format.

https://eips.ethereum.org/EIPS/eip-3091

Get one tx link

static get_by_slug(slug: str) Optional[tradingstrategy.chain.ChainId]

Map a slug back to the chain.

Most useful for resolving URLs.