Validium Docs
  • Overview
  • Connect to Validium
  • Start Coding 🚀
    • Quickstart
      • Overview
      • Deploy using Validium CLI
      • Deploy using Quickstart Repository
      • Deploy your first contract
      • Create an ERC20 token
  • Tooling
    • Block Explorers
    • Hardhat-Validium
      • Overview
      • Installation
      • Guides
        • Getting started
        • Migrating Hardhat project to Validium
        • Compiling non-inlinable libraries
      • Plugins
        • hardhat-zksync
        • hardhat-zksync-solc
        • hardhat-zksync-vyper
        • hardhat-zksync-deploy
        • hardhat-zksync-upgradable
        • hardhat-zksync-verify
        • hardhat-zksync-verify-vyper
        • hardhat-zksync-ethers
        • hardhat-zksync-node
        • Hardhat Community Plugins
    • Foundary
      • Overview
      • Installation
      • Getting Started
      • Migration Guide
        • Overview
        • Compilation
        • Deployment
        • Testing
  • Test and Debug
    • Getting Started
    • Docker L1 - L2 Nodes
    • In-Memory Node
    • Continuous Integration
    • Hardhat
    • Foundry
  • API Reference
    • Overview
    • Conventions
    • ZKs JSON-RPC API
    • Debug JSON-RPC API
    • Ethereum JSON-RPC API
    • PubSub JSON-RPC API
  • Concepts
    • Transaction Lifecycle
    • Blocks and Batches
    • Validium Network Fee Mechanism
    • Finality
    • System Upgrades
    • ZK Chains
    • Data Availability
      • Overview
      • Recreating L2 state from L1 pubdata
      • Validiums
    • Account Abstraction
    • L1 <-> L2 Communication
  • Components
    • Overview
    • Smart & System Contracts
      • Smart Contracts
      • System Contracts
    • Shared Bridges
    • Sequencer / Server
    • Validium Network EVM
      • Overview
      • Bootloader
      • Precompiles
      • Virtual Machine Specification
        • ZKsync Virtual Machine primer
        • VM Formal Specification
    • Prover
      • Overview
      • ZK Terminology
      • Running the Prover
      • Circuits
        • Overview
        • Circuit Testing
        • CodeDecommitter
        • DemuxLogQueue
        • ECRecover
        • KeccakRoundFunction
        • L1MessagesHasher
        • LogSorter
        • Main VM
        • RAMPermutation
        • Sha256RoundFunction
        • StorageApplication
        • Sorting and Deduplicating
          • Overview
          • SortDecommitments
          • StorageSorter
          • LogSorter
      • Boojum Gadgets
      • Boojum Function - `check_if_satisfied`
    • Compiler
      • Compiler Toolchain Overview
        • Compiler Toolchain Overview
        • Solidity Compiler
        • Vyper Compiler
        • LLVM Framework
      • Specification
        • Overview
        • Code Separation
        • System Contracts
        • Exception Handling
        • EVM Legacy Assembly Translator
        • Instructions
          • Instruction Reference
          • EVM
            • Native EVM Instructions
            • Arithmetic
            • Bitwise
            • Block
            • Call
            • Create
            • Environment
            • Logging
            • Logical
            • Memory
            • Return
            • Sha3
            • Stack
          • Extensions
            • Overview
            • Validium Network Extension Simulation (call)
            • Validium Network Extension Simulation (verbatim)
          • EVM Legacy Assembly
          • Yul
        • EraVM Binary Layout
    • Fee Withdrawer
    • Portal - Wallet + Bridge
    • Block Explorer
    • Transaction filtering
Powered by GitBook
On this page
  • Set up the testing environment
  • Reset the Validium State
  • Pre-configured rich wallets
  • Custom configurations (advanced)
  1. Test and Debug

Docker L1 - L2 Nodes

Guide to setup dockerized containers of L1 and L2 nodes.

PreviousGetting StartedNextIn-Memory Node

Last updated 8 months ago


Welcome to this step-by-step guide on establishing a local testing environment using Docker for Validium development. With this guide, you can effortlessly emulate the Validium environment on your local system, making it simpler to test and develop features. Let's get started!

Prerequisites:

  1. Docker and docker-compose: Ensure that Docker and docker-compose are installed on your machine. If you haven't already installed them, follow the .

  2. ZKsync Hardhat plugins: A foundational understanding of the ZKsync Hardhat plugins will be beneficial. New to Validium development with Hardhat? Explore the .

The matterlabs/local-node Docker image is currently based on the protocol Version19 (deprecated on February 5, 2024), and it will be upgraded in the coming months. It should only be used for testing L1 <-> L2 communication.


Set up the testing environment

  1. Clone the dockerized Validium project repository to your local machine:

    git clone https://github.com/matter-labs/local-setup
  2. To start the local node, navigate to the cloned directory:

    cd local-setup
  3. Launch the Validium node locally using the start.sh script:

    ./start.sh

    This script spins up three essential docker containers:

    1. Postgres: The database supporting Validium.

    2. Local Geth node: Acts as the Layer 1 (L1) for Validium.

    3. Validium node: The core component.

The first execution of the start.sh script should proceed without interruptions. If it halts unexpectedly, you might need to reset the local Validium state and retry. The initialization might take up to 10 minutes initially.

Network Details

  • HTTP JSON-RPC API: Accessible via port 3050.

  • WebSocket (WS) API: Accessible through port 3051. Default endpoints:


Reset the Validium State

If you need to revert the Validium state to its initial configuration, execute the clear.sh script:

./clear.sh

In the event of a "permission denied" error, run the following script with root access:

sudo ./clear.sh

Pre-configured rich wallets

The Docker ZKsync environment provides test wallets with substantial ETH balances on both L1 and L2, simplifying the testing process by ensuring sufficient funds for transactions.

Rich walletsSame mnemonic rich wallets


Custom configurations (advanced)

To operate with a custom Postgres database or a distinct Layer 1 node, you'll need to adjust environment variables within the docker-compose file:

environment:
  - DATABASE_URL=postgres://postgres@postgres/zksync_local
  - ETH_CLIENT_WEB3_URL=http://geth:8545

DATABASE_URL is the connection URL to the Postgres database, and ETH_CLIENT_WEB3_URL is the endpoint URL for the HTTP JSON-RPC interface of the L1 node.

L1 RPC:

L2 RPC:

WS API: Network Id: 270

installation guide
Getting Started section
http://localhost:8545
http://localhost:3050
http://localhost:3051