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 revm
Build the project:
cargo build --release
Note:
clang
is required for building revm withc-kzg
orsecp256k1
feature flags due to dependencies on C libraries. Install it viaapt install clang
if not already installed.
Navigate to the revme
directory:
cd bins/revme/
Download Ethereum tests:
git clone https://github.com/ethereum/tests
Run the tests:
cargo run --release -- statetest tests/GeneralStateTests/ tests/LegacyTests/Constantinople/GeneralStateTests
Benchmarks for revm can be found in crates/revm/benches
. To run the snailtracer
benchmark:
cargo bench --package revm --profile release -- snailtracer
To generate a flame graph for visualizing the runtime of various sections:
cargo flamegraph --root --freq 4000 --min-width 0.001 --package revm --bench bench -- snailtracer
Note: Install
flamegraph
viacargo install flamegraph
if not already installed.
To run an example, such as fork_ref_transact
:
cargo run -p revm --features ethersdb --example fork_ref_transact
To generate block traces and write them to JSON files:
cargo run -p revm --features std,serde-json,ethersdb --example generate_block_traces
revm is utilized by several prominent projects, including:
The revm documentation is available online at revm docs. To serve the documentation locally:
mdbook serve documentation