Local Setup
To setup a local environment for testing L2 -> L2 interoperability, follow the steps below.
To setup a local environment for testing, clone the zksync-os-server repo:
git clone https://github.com/matter-labs/zksync-os-server.git
Then move into the repo and run the command below to start a local environment with two L2 chains that have v31 interop enabled:
cd zksync-os-server
./run_local.sh ./local-chains/v31.0/multi_chain
The first time running this can take a few minutes for the dependencies to compile.
You should now have three local chains running:
- a local L1 chain running at port
8545 - a local L2 chain running at port
3050(chain ID6565) - a second local L2 chain running at port
3051(chain ID6566)
Note that once you end this process, the history of each chain will be completely erased. These are in-memory nodes, so they do not persist any storage of the chains.
Funding a test account
The L1 chain has access to all of the default rich wallets configured with anvil,
however these addresses do not yet have funds bridged to them on the L2 chains.
Before going through the other guides in this section,
run the commands below from inside the zksync-os-server repo to fund the test wallet used later.
Fund wallet on chain 6565
cargo run -p zksync_os_generate_deposit -- \
--bridgehub 0x4c548076C53BA29A7DDdAc6Fe463C57CDE78a3d8 \
--chain-id 6565 \
--l1-rpc-url http://localhost:8545 \
--private-key 0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 \
--amount 1
Fund wallet on chain 6566
cargo run -p zksync_os_generate_deposit -- \
--bridgehub 0x4c548076C53BA29A7DDdAc6Fe463C57CDE78a3d8 \
--chain-id 6566 \
--l1-rpc-url http://localhost:8545 \
--private-key 0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 \
--amount 1