Getting Started

Learn about the recommended paths of testing and debugging your projects on ZKsync.

ZKsync Era provides two distinct testing environments for your local development needs:

  • Dockerized local setup
  • In-Memory Node.

Each solution boasts unique characteristics tailored to diverse use cases. This section aims to unpack the intricacies of these tools, aiding you in selecting the setup best suited for your development workflow.

In-Memory node vs Dockerized local setup

The local testing process revolves around two principal options:

  1. Dockerized local setup: An extensive ZKsync Era network simulation that comprises a Postgres database, a local Geth node functioning as Layer 1, and the ZKsync node. Opt for this setup for comprehensive simulations and testing that require interaction with both L1 and L2.
  2. In-Memory node: A lightweight, speedy alternative, the in-memory node, supports forking the state from various networks, including the mainnet and testnet. This choice is ideal for swift testing, prototyping, and bootloader and system contract testing.

When to use each

  • Use the Dockerized local setup for in-depth simulations and tests that necessitate L1 and L2 interaction. This detailed setup mirrors how your contracts will function within the mainnet ZKsync Era network.
  • Opt for the In-Memory node for swift testing, prototyping, or testing new changes via the local bootloader and system contracts. This setup facilitates forking the state from the mainnet or testnet, suitable for replaying transactions or observing the impact of modifications on existing contracts.

Feature comparison

The following table highlights the key characteristics of each testing environment for a quick comparison:

FeatureIn-memory nodeDockerized local setup
Quick startupYesNo
Supports forking stateYesNo
Console.log debuggingYesNo
Detailed call tracesYesNo
Pre-configured 'rich' accountsYesYes
Replay existing transactionsYesNo
Fast for integration testingYesNo
Communication between Layer 1 & Layer 2NoYes
Multiple transactions per batchNoYes
Complete set of APIsNo (Basic set only)Yes
Websocket supportNoYes

Whether you're testing new contracts, debugging transactions, or prototyping, ZKsync Era provides robust options for local testing. Both the Dockerized local setup and the In-Memory Node offer feature-rich and quick setup options, each with their distinct strengths and limitations. Choose the most appropriate setup based on your specific needs, and happy testing!

Use ZKsync CLI for easy setup

The ZKsync CLI makes it simple for developers to work with both the Dockerized local setup and In-Memory Node. Use zksync-cli dev start to get your local development environment running along with additional modules like Block Explorer, Wallet and Bridge.

Made with ❤️ by the ZKsync Community