Coreth Architecture

How the C-Chain EVM (Coreth) runs inside AvalancheGo, including consensus, execution, and cross-chain transfers.

Coreth is the EVM implementation that powers the C-Chain. It is shipped with AvalancheGo under graft/coreth and wrapped by Snowman++ (vms/proposervm) for block production.

At a glance:

  • Snowman++ engine calls into Coreth’s block builder and execution pipeline.
  • Coreth executes EVM bytecode, maintains state (trie over Pebble/LevelDB), and exposes JSON-RPC/WS.
  • Atomic import/export uses shared UTXO memory and writes to the node database.

Consensus & Block Production

  • Runs Snowman++ via the ProposerVM wrapper; a stake-weighted proposer list gates each 5s window before falling back to anyone building.
  • Blocks are built by Coreth's block builder (graft/coreth/plugin/evm/block_builder.go), which applies EIP-1559 base fee rules and proposer-specific metadata.
  • Chain ID: Mainnet 43114, Fuji 43113. JSON-RPC is exposed at /ext/bc/C/rpc with optional WebSocket at /ext/bc/C/ws.

Execution Pipeline

  • Execution: Standard go-ethereum VM with Avalanche-specific patches (fee handling, atomic tx support, bootstrapping/state sync) in graft/coreth.
  • State: Uses PebbleDB/LevelDB via AvalancheGo's database interface; state pruning and state-sync are configurable.
  • APIs: Supports eth, net, web3, debug (optional), txpool (optional) namespaces. Enable/disable via chain config.

Cross-Chain (Atomic) Transfers

  • Coreth supports atomic import/export to the X-Chain and P-Chain using shared UTXO memory (graft/coreth/plugin/evm/atomic).
  • Exports lock AVAX into an atomic UTXO set; imports consume those UTXOs to credit balance on the destination chain.
  • Wallet helpers and SDKs build these atomic txs against the C-Chain RPC; on-chain they show up as ImportTx/ExportTx wrapping atomic inputs/outputs.

Configuration

Chain-specific config lives at:

~/.avalanchego/configs/chains/C/config.json
{
  "eth-apis": ["eth", "net", "web3", "eth-filter"],
  "pruning-enabled": true,
  "state-sync-enabled": true
}

Key knobs:

  • eth-apis: List of RPC namespaces to serve.
  • pruning-enabled: Enable state trie pruning.
  • state-sync-enabled: Allow state sync bootstrap instead of full replay.
  • P-chain fee recipient and other advanced options are also supported; see graft/coreth/plugin/evm/config.go.

Developer Tips

  • Use chain configs to toggle RPC namespaces instead of patching code.
  • When running local devnets, use --chain-config-content to pass base64 configs inline.
  • For cross-chain AVAX moves, call the P-Chain/X-Chain import/export endpoints; Coreth handles the atomic mempool internally.

Is this guide helpful?