Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Fast Ethereum Virtual Machine implementation

License

NotificationsYou must be signed in to change notification settings

ethereum/evmone

Repository files navigation

ethereum badgereadme style standard badgecodecov badgecircleci badgeappveyor badgelicense badge

Fast Ethereum Virtual Machine implementation

evmone is a C++ implementation of the Ethereum Virtual Machine (EVM).Created by members of theIpsilon (ex-Ewasm) team, the project aims for clean, standalone EVM implementationthat can be imported as an execution module by Ethereum Client projects.The codebase ofevmone is optimized to provide fast and efficient execution of EVM smart contracts.

Characteristic of evmone

  1. Exposes theEVMC API.
  2. Requires C++20 standard.
  3. Theintx library is used to provide 256-bit integer precision.
  4. Theethash library is used to provide Keccak hash function implementationneeded for the specialKECCAK256 instruction.
  5. Contains two interpreters:
    • Baseline (default)
    • Advanced (select with theadvanced option)

Baseline Interpreter

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

Advanced Interpreter

  1. Theindirect 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 precomputedand applied once per block during execution.
  3. Performs extensive and expensive bytecode analysis before execution.

Usage

As geth plugin

evmone implements theEVMC API for Ethereum Virtual Machines.It can be used as a plugin replacing geth's internal EVM. But for that a modifiedversion of geth is needed. TheEwasm's forkof go-ethereum providesbinary releases of geth with EVMC support.

Next, download evmone fromReleases.

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/evmonecd 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-unittestsbuild/bin/evmone-bench test/evm-benchmarks/benchmarks

Precompiles

Ethereum Precompiled Contracts (precompiles for short) are only partly supported by evmone.

However, there are options to enable limited precompiles support for testing.

  1. For precompiles with missing implementation stubs are enabled by default.They will correctly respond to known inputs.
  2. The CMake optionEVMONE_PRECOMPILES_SILKPRE=1 enables building ofthesilkpre third party library with the implementation of the precompiles.This library also requiresGMP (e.g. libgmp-dev) library for building and execution.

Tools

evm-test

Theevm-test executes a collection of unit tests onany 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 benchmarkswith it.

docker run --entrypoint evmone-bench ethereum/evmone /src/test/benchmarks

EVM Object Format (EOF) support

evmone supports EOFv1. Since EOF validation is done once during deploy-time, evmone does not revalidate during execution of bytecode. To force EOF revalidation, you can use thevalidate_eof option, example:

evmc run --vm libevmone.so,validate_eof --rev 14 "EF00"

References

  1. Efficient gas calculation algorithm for EVM

Maintainer

Paweł Bylica@chfast

License

license badge

Licensed under theApache License, Version 2.0.


[8]ページ先頭

©2009-2025 Movatter.jp