Skip to content
프로젝트

소개

빠른 Ethereum Virtual Machine 구현

비즈니스 및 금융

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
+1
in 15 days
+2
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

evmone

ethereum badge readme style standard badge codecov badge codspeed 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++23 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 a block of instructions are precomputed and applied once per block during execution.
  3. Performs extensive and expensive bytecode analysis before execution.

Usage

As an EVMC module

evmone implements the EVMC API for Ethereum Virtual Machines. The evmone shared library can be loaded by an EVMC host application. To execute, the host application also needs a VM context, which only the C++ API creates: evmone::create_vm_context() in evmone/evmone.hpp. 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).

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
    

Precompiles

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:

  1. EVMONE_PRECOMPILES_LIBSECP256K1=ON uses libsecp256k1 for ecrecover. The built-in ecrecover has degraded performance, so this can be enabled to speed it up. The library is fetched and built with evmone.
  2. EVMONE_PRECOMPILES_GMP=ON uses GMP for expmod. This requires the GMP library (e.g. libgmp-dev) at build and execution time.

Docker

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

References

  1. Efficient gas calculation algorithm for EVM

Maintainer

Paweł Bylica @chfast

License

license badge

Licensed under the Apache License, Version 2.0.

관련 프로젝트 살펴보기

불러오는 중…