Fast Ethereum Virtual Machine implementation
evmone is a C++ implementation of the Ethereum Virtual Machine (EVM). Created by members of the Ipsilon (ex-Ewasm) team, the project aims for clean, standalone EVM implementation that can be imported as an execution module by Ethereum Client projects. The codebase of evmone is optimized to provide fast and efficient execution of EVM smart contracts.
- Exposes the EVMC API.
- Requires C++20 standard.
- The intx library is used to provide 256-bit integer precision.
- The ethash library is used to provide Keccak hash function implementation
needed for the special
KECCAK256instruction. - Contains two interpreters:
- Baseline (default)
- Advanced (select with the
advancedoption)
- Provides relatively straight-forward but efficient EVM implementation.
- Performs only minimalistic
JUMPDESTanalysis.
- The indirect call threading is the dispatch method used - a loaded EVM program is a table with pointers to functions implementing virtual instructions.
- The gas cost and stack requirements of block of instructions is precomputed and applied once per block during execution.
- Performs extensive and expensive bytecode analysis before execution.
evmone implements the EVMC API for Ethereum Virtual Machines.
The evmone shared library can be loaded by an EVMC host application.
Prebuilt libraries are available from Releases.
evmone vendors EVMC (in evmc/); to be ABI compatible, the host application must use EVMC headers with the same ABI version (the vendored headers are in evmc/include).
To build the evmone EVMC module (shared library), test, and benchmark:
-
Fetch the source code:
git clone --recursive https://github.com/ethereum/evmone cd evmone -
Configure the project build and dependencies:
cmake -S . -B build -DEVMONE_TESTING=ONcmake -S . -B build -DEVMONE_TESTING=ON -G "Visual Studio 16 2019" -A x64 -
Build:
cmake --build build --parallel -
Run the unit tests or benchmarking tool:
build/bin/evmone-unittests build/bin/evmone-bench test/evm-benchmarks/benchmarks
Ethereum Precompiled Contracts (precompiles for short) are implemented in two places:
the core parts are in the evmone_precompiles library (lib/evmone_precompiles),
and the dispatch is in the evmone state library (test/state),
which is built with the evmone tools (EVMONE_TOOLS).
Two CMake options switch a precompile to an external library instead:
EVMONE_PRECOMPILES_LIBSECP256K1=ONuses libsecp256k1 forecrecover. The built-inecrecoverhas degraded performance, so this can be enabled to speed it up. The library is fetched and built with evmone.EVMONE_PRECOMPILES_GMP=ONuses GMP forexpmod. This requires the GMP library (e.g. libgmp-dev) at build and execution time.
Note
This section is outdated: the Docker image is not updated regularly.
Docker images with evmone are available on Docker Hub: https://hub.docker.com/r/ethereum/evmone.
Having the evmone shared library inside a docker is not very useful on its own, but the image can be used as the base of another one or you can run benchmarks with it.
docker run --entrypoint evmone-bench ethereum/evmone /src/test/benchmarksPaweł Bylica @chfast
Licensed under the Apache License, Version 2.0.