diff --git a/content/10.zk-stack/20.running/20.using-a-local-zk-chain.md b/content/10.zk-stack/20.running/20.using-a-local-zk-chain.md index 9d4aa078..e84df53e 100644 --- a/content/10.zk-stack/20.running/20.using-a-local-zk-chain.md +++ b/content/10.zk-stack/20.running/20.using-a-local-zk-chain.md @@ -26,14 +26,14 @@ 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 +## Using your ZK chain -Your server contains both HTTPS as well as WebSocket (WS) services that are fully web3 compatible (and contain some extra ZK Stack functionalities). +Your server contains both HTTPS as well as WebSocket (WS) RPC services that are fully web3 compatible (and contain some extra ZK Stack functionalities). Learn more on the [API reference page](/zksync-protocol/api). -### Using zksync-cli +### ZKsync CLI -[ZKsync CLI](/zksync-era/tooling/zksync-cli) allows you to easily interact and develop applications on your ZK chain. +[zksync-cli](/zksync-era/tooling/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: @@ -44,73 +44,57 @@ zksync-cli bridge deposit --rpc=http://localhost:3050 --l1-rpc=http://localhost: You can save the chain configurations for your ZK chain with ZKsync CLI by [adding a new configuration](/zksync-era/tooling/zksync-cli/configuring-chains). -## Using the dApp Portal +## Setting up the Portal -The [dApp Portal](https://github.com/matter-labs/dapp-portal) module allows you to: +The [Portal](https://github.com/matter-labs/dapp-portal) module is a web-app that 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](https://github.com/matter-labs/dapp-portal). An example command would look like: +Once you have at least one chain initialized, you can run the portal app locally: ```bash -npm run hyperchain:configure ../zksync-era -npm run dev:node:hyperchain +zkstack portal ``` -You can now navigate to the displayed Portal URL (typically ). +This command will start the dockerized portal app using configuration from `apps/portal.config.json` file inside your +ecosystem directory. You can edit this file to configure the portal app if needed. -### Using Block Explorer +You can now navigate to the portal web-app. By default, portal frontend starts on +`http://localhost:3030`, you can configure the port in `apps.yaml` file. -A [free open source block explorer](https://github.com/matter-labs/block-explorer) is available for your ZK chain. The block explorer contains three components +## Setting up a Block Explorer -- [Worker](https://github.com/matter-labs/block-explorer/tree/main/packages/worker) -- [API](https://github.com/matter-labs/block-explorer/tree/main/packages/api) -- [App](https://github.com/matter-labs/block-explorer/tree/main/packages/app) +A block explorer is a web-app that lets you view and inspect transactions, blocks, +contracts and more. A [free open source block explorer](https://github.com/matter-labs/block-explorer) is available for your ZK chain. -You can run all components together locally and connect to your ZK chain. - -Make sure you have your [zksync-era](https://github.com/matter-labs/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: +First, each chain should be initialized: ```bash -git clone https://github.com/matter-labs/block-explorer.git -cd block-explorer -npm install +zkstack explorer init ``` -#### Setting up env variables +This command creates a database to store explorer data and generates a docker compose file with explorer services +(`explorer-docker-compose.yml`). -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: +Next, for each chain you want to have an explorer, you need to start its backend services: ```bash -npm run hyperchain:configure +zkstack explorer backend --chain ``` -#### Run block explorer +This command uses previously created docker compose file to start the services (api, data fetcher, worker) required for +the explorer. -Afterwards you can run the block explorer: - -```bash -# if you are running block explorer for the first time -npm run db:create -``` +Finally, you can run the explorer app: ```bash -npm run dev +zkstack explorer run ``` -#### Verify block explorer is up and running +This command will start the dockerized explorer app using configuration from `apps/explorer.config.json` file inside +your ecosystem directory. You can edit this file to configure the app if needed. -By default, you can access the front-end `App` at in your browser. The `API` is - available by default at , `Worker` at and `Data Fetcher` at . +You can now navigate to the explorer web-app. By default, explorer frontend starts on +`http://localhost:3010`, you can configure the port in `apps.yaml` file.