Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

@tevm/common

Chain-specific configuration. Combines viem chain definitions with a ZEVM-backed Common instance the VM uses for hardfork, EIP, consensus, and gas-parameter lookups. Includes custom crypto hooks such as KZG for blob transaction testing.

Full API: packages/common/docs.

Installation

npm install @tevm/common

API Reference

Enumerations

Interfaces

Type Aliases

Functions

Supported Networks

Layer 1: mainnet, sepolia, goerli, holesky.

Layer 2: arbitrum, optimism, base, zksync, polygon, polygonZkEvm.

Alternative: bsc, avalanche, fantom, gnosis.

Dev: hardhat, foundry, anvil, localhost.

Usage Examples

import { createCommon, createMockKzg, mainnet, optimism, arbitrum } from '@tevm/common'
 
const common = createCommon({ ...mainnet, hardfork: 'shanghai' })
 
const custom = createCommon({
  name: 'Custom Chain',
  id: 1337,
  defaultHardfork: 'shanghai',
  consensus: {
    type: 'poa',
    algorithm: 'clique',
    clique: { period: 15, epoch: 30000 },
  },
})
 
const withKzg = createCommon({
  ...mainnet,
  customCrypto: { kzg: createMockKzg() },
})
 
const optimismCommon = createCommon({ ...optimism, hardfork: 'bedrock' })
const arbitrumCommon = createCommon({ ...arbitrum, hardfork: 'nitro' })

The returned Common is a viem chain object plus:

  • ethjsCommon - ZEVM-backed Common instance used internally by the VM.
  • copy() - isolated copy for a new VM or client.

See Also