Skip to content

In-memory node that can be used for integration testing and debugging.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

matter-labs/anvil-zksync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 anvil‑zksync 🚀

Elastic power for the Elastic Network – spin up blazing‑fast local ZK chain nodes in a snap

CI Status Release License: MIT X: @zksync User Book

Install · User Book · Rust Book · Contributing


✨ Features

  • Instant local node – in‑memory execution for lightning‑fast startup
  • Seamless forking – mirror any Elastic Network ZK chain or any custom RPC
  • Rich dev accounts – pre-funded wallets for immediate testing
  • Transaction replay – debug any live tx with full VM call‑trace introspection
  • Custom base token – simulate fee tokens & gas ratios for custom base token ZK chains
  • Protocol development – target non-builtin system contracts for quick protocol testing

📦 Installation

Install anvil-zksync with your preferred method from the below options:

Homebrew
brew tap matter-labs/anvil-zksync https://github.com/matter-labs/anvil-zksync.git
brew install anvil-zksync
Script (installs forge-zksync, cast-zksync & anvil‑zksync)
curl -L https://raw.githubusercontent.com/matter-labs/foundry-zksync/main/install-foundry-zksync | bash
Pre‑built binaries
# download and unpack the latest release
tar -xzf anvil-zksync_x.y.z_<platform>.tar.gz -C /usr/local/bin
chmod +x /usr/local/bin/anvil-zksync
Build from source
# clone and build from source
git clone git@github.com:matter-labs/anvil-zksync.git
cd anvil-zksync
cargo build --release

⚡️ Quick‑start

Start a local ZK chain node

anvil-zksync run

Launches a fast, in-memory ZK chain for local development.

Fork any Elastic Network chain

anvil-zksync fork --fork-url era

Mirror mainnet, testnet, or any Elastic ZK chain using a custom RPC.

Replay transactions

anvil-zksync -vv replay_tx --fork-url era 0x0820a939dfe83221f44a6f0f81f8059ec8a7a4e17006965a8b0c146a2c4a00c2

Debug live transactions with full VM call‑trace and verbose output.

Integrate an L1 node

For L1–L2 interactions, choose one of the following:

  • Spawn a local L1 (defaults to port 8012):

    anvil-zksync --spawn-l1 [port]
  • Connect to an external L1 (must be started with --no-request-size-limit):

    anvil --no-request-size-limit
    anvil-zksync --external-l1 http://localhost:8545

Note: --spawn-l1 and --external-l1 are mutually exclusive.

For the full CLI reference and advanced usage, see the user docs: https://matter-labs.github.io/anvil-zksync/latest

🤝 Contributing

Bug reports, fixes and new features are welcome! Please read the contributing guide to get started.

📜 License

This project is licensed under the terms of the MIT License / Apache License – see the LICENSE-MIT, LICENSE-APACHE and file for details.