ChainId is a branded number type representing an EIP-155 chain identifier. Used for replay protection and identifying which network a transaction targets.
Chain ID is embedded in transaction signatures to prevent replay attacks across chains:
import { ChainId } from '@tevm/voltaire'const tx = { chainId: ChainId.from(1), // Mainnet only to: "0x...", value: 1000000000000000000n, // ... other fields}// This transaction can only be valid on Ethereum mainnet// Submitting to Arbitrum would fail signature verification
Namespace Usage
import { ChainId } from '@tevm/voltaire'// Using namespace objectconst id = ChainId.from(1)const isMain = ChainId.isMainnet(1)const equal = ChainId.equals(1, 1)