Fast Ethereum Virtual Machine implementation
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
Paweł Bylica b2adc3dbd1
Merge pull request #580 from ethereum/modernize_test_utils
2 days ago
cmake cmake: Upgrade intx to 0.9.1 2 months ago
docs article: Apply suggestions from review 3 years ago
evmc@418461edaa Support Prague revision in state tests 4 weeks ago
include/evmone license: Update notice headers in source files 3 years ago
lib eof: Change handling of errors from pair<val, err> to variant<val, err> 4 weeks ago
test state: Reformat "for [[unlikely]]" 5 days ago
.bumpversion.cfg evmone 0.9.1 6 months ago
.clang-format Update clang-format config 3 years ago
.clang-tidy Update clang-tidy config for clang-tidy-15 5 days ago
.dockerignore Add Dockerfile 4 years ago
.gitignore Start code analysis 4 years ago
.gitmodules Replace benchmarks with evm-benchmarks git submodule 5 months ago
AUTHORS Update copyright notice 4 years ago
CHANGELOG.md cmake: Require C++20 5 months ago
CMakeLists.txt cmake: Upgrade dependencies (#540) 3 months ago
Dockerfile Update Dockerfile 3 years ago
LICENSE Start evmone project with README and LICENSE 4 years ago
README.md readme: Fix benchmark folder name (#523) 4 months ago
appveyor.yml appveyor: Add Debug build 2 years ago
circle.yml ci: Upgrade compilers (incl. clang-15) 5 days ago
codealike.json bench: Avoid implicit conversions in internal benchmarks 4 years ago
codecov.yml ci: Update codecov config (#526) 4 months ago

README.md

evmone

ethereum badge readme style standard badge codecov badge circleci badge appveyor badge license badge

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.

Characteristic of evmone

  1. Exposes the EVMC API.
  2. Requires C++20 standard.
  3. The intx library is used to provide 256-bit integer precision.
  4. The ethash library is used to provide Keccak hash function implementation needed for the special KECCAK256 instruction.
  5. Contains two interpreters:
    • Baseline (default)
    • Advanced (select with the advanced option)

Baseline Interpreter

  1. Provides relatively straight-forward but efficient EVM implementation.
  2. Performs only minimalistic JUMPDEST analysis.

Advanced Interpreter

  1. The indirect call threading is the dispatch method used - a loaded EVM program is a table with pointers to functions implementing virtual instructions.
  2. The gas cost and stack requirements of block of instructions is precomputed and applied once per block during execution.
  3. Performs extensive and expensive bytecode analysis before execution.

Usage

As geth plugin

evmone implements the EVMC API for Ethereum Virtual Machines. It can be used as a plugin replacing geth's internal EVM. But for that a modified version of geth is needed. The Ewasm's fork of go-ethereum provides binary releases of geth with EVMC support.

Next, download evmone from Releases.

Start the downloaded geth with --vm.evm option pointing to the evmone shared library.

geth --vm.evm=./libevmone.so

Building from source

To build the evmone EVMC module (shared library), test, and benchmark:

  1. Fetch the source code:

    git clone --recursive https://github.com/ethereum/evmone
    cd evmone
    
  2. Configure the project build and dependencies:

    Linux / OSX
    cmake -S . -B build -DEVMONE_TESTING=ON
    
    Windows
    cmake -S . -B build -DEVMONE_TESTING=ON -G "Visual Studio 16 2019" -A x64
    
  3. Build:

    cmake --build build --parallel
    
  4. Run the unit tests or benchmarking tool:

    build/bin/evmone-unittests
    build/bin/evmone-bench test/evm-benchmarks/benchmarks
    

Tools

evm-test

The evm-test executes a collection of unit tests on any EVMC-compatible Ethereum Virtual Machine implementation. The collection of tests comes from the evmone project.

evm-test ./evmone.so

Docker

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/benchmarks

References

  1. Efficient gas calculation algorithm for EVM

Maintainer

Paweł Bylica @chfast

License

license badge

Licensed under the Apache License, Version 2.0.