Using a Local ZK chain

Funding accounts

The first step to start interacting with your ZK chain is to fund an account (or a few). This means you need some funds on the base layer.

During the zkstack ecosystem create configuration, you have a choice of what base layer to deploy the ZK chain onto: a local reth node, or an Ethereum network (e.g., Sepolia).

Base layer is the local reth node

If you choose to deploy on local reth node, you will have a set of addresses that have 100 ETH each. You can find the list of rich wallets on GitHub in the matter-labs/local-setup project and use these addresses to deposit into your ZK chain via the bridge.

Base layer is an Ethereum network (e.g., Sepolia)

If you choose to deploy on an Ethereum network (e.g., Sepolia), you need to have an account on the base layer with ETH. You can use the deployer, governor, or operator wallets setup during the deployment process, or any other wallet with funds, to deposit into your ZK chain via the bridge.

Once you have the accounts with funds on the L1 base layer, you can do a deposit via the bridge to your ZK chain, and start interacting with your ZK chain using the L2 funded account.

Using your ZK chain RPC

Your server contains both HTTPS as well as WebSocket (WS) services that are fully web3 compatible (and contain some extra ZK Stack functionalities). Learn more on the API reference page.

Using zksync-cli

ZKsync CLI allows you to easily interact and develop applications on your ZK chain. When executing any command with ZKsync CLI, you can specify RPC urls for both L1 and L2. Your local server contains RPCs for both. An example deposit command via the bridge would look like:

zksync-cli bridge deposit --rpc=http://localhost:3050 --l1-rpc=http://localhost:8545

You can save the chain configurations for your ZK chain with ZKsync CLI by adding a new configuration.

Using the dApp Portal

The dApp Portal module allows you to:

  • Bridge & transfer tokens to your ZK chain.
  • View balances.
  • Add contacts for quick and easy access.

You can run the Portal module locally, and point it to your ZK chain configuration. It comes with scripts that help pull the ZK chain configuration from your zksync-era repo and adapt it to portal needs. Learn more on GitHub in the dApp Portal project. An example command would look like:

npm run hyperchain:configure ../zksync-era
npm run dev:node:hyperchain

You can now navigate to the displayed Portal URL (typically http://localhost:3000).

Using Block Explorer

A free open source block explorer is available for your ZK chain. The block explorer contains three components

You can run all components together locally and connect to your ZK chain.

Make sure you have your zksync-era repo set up locally and the zkstack server is running.

Running block explorer locally

Install block explorer

Clone & install the block explorer repository in any folder:

git clone https://github.com/matter-labs/block-explorer.git
cd block-explorer
npm install

Setting up env variables

Next you need to set up all the necessary environment and configuration files with your ZK chain settings. You can use the available npm script to set them up:

npm run hyperchain:configure

Run block explorer

Afterwards you can run the block explorer:

# if you are running block explorer for the first time
npm run db:create
npm run dev

Verify block explorer is up and running

By default, you can access the front-end App at http://localhost:3010 in your browser. The API is available by default at http://localhost:3020, Worker at http://localhost:3001 and Data Fetcher at http://localhost:3040.


Made with ❤️ by the ZKsync Community