Try it Live Run Chain examples in the interactive playground
Chain
Ethereum chain configuration objects with network metadata, RPC endpoints, and explorer information.
Learn about chain IDs, replay attack prevention, and network identification in the Fundamentals guide .
Overview
Branded type representing Ethereum chain configurations. Provides chain constants, metadata, and lookup utilities for Ethereum networks. Zero-overhead design supports both tree-shakeable namespace methods and class instances.
Quick Start
Types
class Chain {
// Constructors (→ /primitives/chain/constructors)
static from ( chain : Chain ) : Chain
static fromId ( id : number ) : Chain | undefined
// Lookup (→ /primitives/chain/chain-lookup)
static byId : Record < number , Chain >
}
Source: Chain.js:14-36 export interface Chain {
name : string
chain : string
chainId : number
networkId ?: number
shortName : string
rpc : string []
nativeCurrency : NativeCurrency
infoURL ?: string
explorers ?: Explorer []
[ key : string ] : any
}
export interface NativeCurrency {
name : string
symbol : string
decimals : number
[ key : string ] : any
}
export interface Explorer {
name : string
url : string
standard ?: string
[ key : string ] : any
}
Chain configuration object extending from @tevm/chains . Provides complete chain metadata including network name, chain ID, RPC endpoints, native currency details, and block explorer URLs. Source: ChainType.ts:1
Chain Constants
Chain objects imported from @tevm/chains :
import {
// Mainnets
flr14 ,
quai9 ,
injective1776 ,
ronin2020 ,
moca2288 ,
// Popular networks (via chain ID)
// Use Chain.fromId(id) or Chain.byId[id]
} from '@tevm/chains'
// Access chain metadata
console . log ( quai9 . name ) // "Quai Mainnet"
console . log ( quai9 . chainId ) // 9
console . log ( quai9 . nativeCurrency . symbol ) // "QUAI"
// Use with Chain constructor
const chain = Chain ( quai9 )
Available constants:
800+ chain configurations from @tevm/chains
Includes testnets, mainnets, L2s, and sidechains
Each constant includes full metadata (RPC, explorer, currency)
See @tevm/chains documentation for complete list.
API Methods
Core Operations
fundamentals - Learn chain IDs, replay attack prevention, and network identification
constructors - Create Chain instances from chain objects and chain IDs
chain-lookup - Look up chains by ID using fromId() and byId record
metadata - Access chain properties: name, chainId, RPC, explorers, currency
Advanced Features
Chain is a lightweight wrapper around plain JavaScript objects from @tevm/chains. The Chain class adds prototype methods while keeping the underlying data structure simple and serializable.
Address
Ethereum address type for contract and account addresses.
View Address →
Branded Types
Zero-overhead type branding pattern used throughout primitives.
View Branded Types →
Denomination
Wei, Gwei, and Ether types with currency conversions.
View Denomination →
FeeMarket
EIP-1559 gas pricing with base and priority fees.
View FeeMarket →
Hardfork
Ethereum network upgrades and protocol versions.
View Hardfork →
Transaction
Transaction creation and signing across networks.
View Transaction →