revm is a high-performance Ethereum Virtual Machine (EVM) written in Rust. Designed with an emphasis on speed and simplicity, revm provides a fast and flexible EVM implementation, featuring a simple interface and an embedded Host. It successfully passes all the ethereum/tests test suites, ensuring compatibility and reliability.
revm adheres to several core principles:
[no_std] compliance, enabling use as a WebAssembly (wasm) library and integration with JavaScript and C++ bindings if needed.The revm project is organized into several crates and binaries:
To build revm from source, follow these steps:
Clone the repository:
git clone https://github.com/bluealloy/revm.git
cd revmBuild the project:
cargo build --releaseNote:
clangis required for building revm withc-kzgorsecp256k1feature flags due to dependencies on C libraries. Install it viaapt install clangif not already installed.
Navigate to the revme directory:
cd bins/revme/Download Ethereum tests:
git clone https://github.com/ethereum/testsRun the tests:
cargo run --release -- statetest tests/GeneralStateTests/ tests/LegacyTests/Constantinople/GeneralStateTestsBenchmarks for revm can be found in crates/revm/benches. To run the snailtracer benchmark:
cargo bench --package revm --profile release -- snailtracerTo generate a flame graph for visualizing the runtime of various sections:
cargo flamegraph --root --freq 4000 --min-width 0.001 --package revm --bench bench -- snailtracerNote: Install
flamegraphviacargo install flamegraphif not already installed.
To run an example, such as fork_ref_transact:
cargo run -p revm --features ethersdb --example fork_ref_transactTo generate block traces and write them to JSON files:
cargo run -p revm --features std,serde-json,ethersdb --example generate_block_tracesrevm is utilized by several prominent projects, including:
The revm documentation is available online at revm docs. To serve the documentation locally:
mdbook serve documentation