Mathieu Dutour Sikirić

← Portfolio

EVM Support in Linera

I implemented Ethereum Virtual Machine (EVM) support within the Linera protocol, allowing Ethereum-based applications to run on microchains. The implementation supports complex protocols like Morpho using specialized precompiles.

Most smart contracts in use today are written in Solidity and compiled to EVM bytecode. A new blockchain that only accepts its own contract format asks developers to rewrite and re-audit all that code, which they rarely do. Supporting the EVM inside Linera lets existing Ethereum applications and tools be reused, while Linera keeps its own WebAssembly runtime for native applications.

The implementation lives in the execution layer of the protocol (linera-execution/src/evm) and is built on revm, the Rust implementation of the EVM. The main work is to connect two very different models. Ethereum has a single global state with synchronous calls between contracts. Linera has many microchains, each with its own state, and communication between chains goes through asynchronous messages.

The features that have no Ethereum equivalent, such as cross-chain messaging and multi-chain coordination, are exposed to Solidity code through precompiles: special addresses that, when called, run code from the host instead of EVM bytecode. A Solidity contract can thus use the multi-chain features of Linera with ordinary function calls.

Compatibility was a guiding principle. The only significant difference with Ethereum is the scheme for contract addresses, which has to fit the way Linera identifies applications. Everything else behaves as on Ethereum, so standard compilers and tooling can be used unchanged.

The implementation was validated on real DeFi code: the Morpho lending protocol runs on Linera through this EVM layer. Morpho combines many interacting contracts, oracles and callbacks, which makes it a demanding test of correctness.