evm

module
v0.8.33 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2026 License: GPL-3.0, LGPL-3.0

README

Lux EVM

Releases CI CodeQL License

Lux is a network composed of multiple blockchains. Each blockchain is an instance of a Virtual Machine (VM), much like an object in an object-oriented language is an instance of a class. That is, the VM defines the behavior of the blockchain.

Lux EVM is the unified Virtual Machine (VM) that powers both the C-Chain and L1/L2 Subnet EVM chains. This package consolidates the former Coreth (C-Chain) and Subnet EVM codebases into a single implementation.

Note: The github.com/luxfi/coreth repository has been deprecated and merged here. See the migration guide below.

This chain implements the Ethereum Virtual Machine and supports Solidity smart contracts as well as most other Ethereum client functionality.

Building

The Subnet EVM runs in a separate process from the main Luxd process and communicates with it over a local gRPC connection.

Luxd Compatibility
[v0.7.0] Luxd@v1.12.0-v1.12.1 (Protocol Version: 38)
[v0.7.1] Luxd@v1.12.2 (Protocol Version: 39)
[v0.7.2] Luxd@v1.12.2/1.13.0-testnet (Protocol Version: 39)
[v0.7.3] Luxd@v1.12.2/1.13.0 (Protocol Version: 39)
[v0.7.4] Luxd@v1.13.1 (Protocol Version: 40)
[v0.7.5] Luxd@v1.13.2 (Protocol Version: 41)
[v0.7.6] Luxd@v1.13.3-rc.2 (Protocol Version: 42)
[v0.7.7] Luxd@v1.13.3 (Protocol Version: 42)

API

The Subnet EVM supports the following API namespaces:

  • eth
  • personal
  • txpool
  • debug

Only the eth namespace is enabled by default. Full documentation for the C-Chain's API can be found here.

Compatibility

The Subnet EVM is compatible with almost all Ethereum tooling, including Remix, Metamask, and Foundry.

C-Chain vs Subnet EVM Mode

This unified EVM package supports both modes:

C-Chain Mode (Primary Network):

  • Atomic transactions for cross-chain transfers (X-Chain ↔ C-Chain)
  • Shared memory integration
  • Primary network consensus

Subnet EVM Mode (L1/L2 Subnets):

  • Configurable fees and gas limits in genesis
  • Simplified hardfork configuration
  • No atomic transactions (cross-chain via Warp messaging)

Migrating from Coreth

If you were using github.com/luxfi/coreth, update your imports:

// Before
import "github.com/luxfi/coreth/core"

// After
import "github.com/luxfi/evm/core"

All coreth functionality is preserved in this package.

Block Format

To support these changes, there have been a number of changes to the EVM block format compared to what exists on the C-Chain and Ethereum. Here we list the changes to the block format as compared to Ethereum.

Block Header
  • BaseFee: Added by EIP-1559 to represent the base fee of the block (present in Ethereum as of EIP-1559)
  • BlockGasCost: surcharge for producing a block faster than the target rate

Create an EVM Subnet on a Local Network

Clone EVM

First install Go 1.23.9 or later. Follow the instructions here. You can verify by running go version.

Set $GOPATH environment variable properly for Go to look for Go Workspaces. Please read this for details. You can verify by running echo $GOPATH.

As a few software will be installed into $GOPATH/bin, please make sure that $GOPATH/bin is in your $PATH, otherwise, you may get error running the commands below.

Download the evm repository into your $GOPATH:

cd $GOPATH
mkdir -p src/github.com/luxfi
cd src/github.com/luxfi
git clone git@github.com:luxfi/evm.git
cd evm

This will clone and checkout to master branch.

Run Local Network

To run a local network, it is recommended to use the lux-cli to set up an instance of EVM on a local Lux Network.

There are two options when using the Lux-CLI:

  1. Use an official EVM release: https://docs.lux.network/subnets/build-first-subnet
  2. Build and deploy a locally built (and optionally modified) version of EVM: https://docs.lux.network/subnets/create-custom-subnet

Releasing

You can refer to the docs/releasing/README.md file for the release process.

Directories

Path Synopsis
accounts
abi
Package abi implements the Ethereum ABI (Application Binary Interface).
Package abi implements the Ethereum ABI (Application Binary Interface).
abi/bind
Package bind generates Ethereum contract Go bindings.
Package bind generates Ethereum contract Go bindings.
abi/bind/precompilebind
#skiplint: import_testing_only_in_tests
#skiplint: import_testing_only_in_tests
cmd
abigen command
evm command
evm executes EVM code snippets.
evm executes EVM code snippets.
export command
export reads blocks from an EVM pebbledb and exports to RLP
export reads blocks from an EVM pebbledb and exports to RLP
precompilegen command
simulator/main command
utils
Package utils contains internal helper functions for go-ethereum commands.
Package utils contains internal helper functions for go-ethereum commands.
utils/verify_db command
verify_db reads a pebbledb and verifies the data integrity
verify_db reads a pebbledb and verifies the data integrity
Package consensus implements different Ethereum consensus engines.
Package consensus implements different Ethereum consensus engines.
Package core implements the Ethereum consensus protocol.
Package core implements the Ethereum consensus protocol.
bloombits
Package bloombits implements bloom filtering on batches of data.
Package bloombits implements bloom filtering on batches of data.
state
Package state provides a caching layer atop the Ethereum state trie.
Package state provides a caching layer atop the Ethereum state trie.
state/snapshot
Package snapshot implements a journalled, dynamic state dump.
Package snapshot implements a journalled, dynamic state dump.
txpool/blobpool
Package blobpool implements the EIP-4844 blob transaction pool.
Package blobpool implements the EIP-4844 blob transaction pool.
txpool/legacypool
Package legacypool implements the normal EVM execution transaction pool.
Package legacypool implements the normal EVM execution transaction pool.
vm/runtime
Package runtime provides a basic execution model for executing EVM code.
Package runtime provides a basic execution model for executing EVM code.
eth
Package eth implements the Ethereum protocol.
Package eth implements the Ethereum protocol.
filters
Package filters implements an ethereum filtering system for block, transactions and log events.
Package filters implements an ethereum filtering system for block, transactions and log events.
tracers
Package tracers is a manager for transaction tracing engines.
Package tracers is a manager for transaction tracing engines.
Package ethclient provides a client for the Ethereum RPC API.
Package ethclient provides a client for the Ethereum RPC API.
evmclient
Package evmclient provides an RPC client for evm-specific APIs.
Package evmclient provides an RPC client for evm-specific APIs.
internal
debug
Package debug interfaces Go runtime debugging facilities.
Package debug interfaces Go runtime debugging facilities.
ethapi
Package ethapi implements the general Ethereum API functions.
Package ethapi implements the general Ethereum API functions.
version
Package version implements reading of build version information.
Package version implements reading of build version information.
metrics
Package miner implements Ethereum block creation and mining.
Package miner implements Ethereum block creation and mining.
evm
evm/blockgascost
blockgascost implements the block gas cost logic
blockgascost implements the block gas cost logic
evm/upgrade/feewindow
feewindow defines the dynamic fee window used by EVM.
feewindow defines the dynamic fee window used by EVM.
evm/validators/state/interfaces
Package interfaces is a generated GoMock package.
Package interfaces is a generated GoMock package.
precompile
contract
Defines the interface for the configuration and execution of a precompile contract
Defines the interface for the configuration and execution of a precompile contract
precompileconfig
Defines the stateless interface for unmarshalling an arbitrary config of a precompile
Defines the stateless interface for unmarshalling an arbitrary config of a precompile
registry
Module to facilitate the registration of precompiles and their configuration.
Module to facilitate the registration of precompiles and their configuration.
Package rpc implements bi-directional JSON-RPC 2.0 on multiple transports.
Package rpc implements bi-directional JSON-RPC 2.0 on multiple transports.
signer
sync
triedb
rpc
warptest
warptest exposes common functionality for testing the warp package.
warptest exposes common functionality for testing the warp package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL