From c0c2cf689c6646a02eb50aa4289e79711745c3fb Mon Sep 17 00:00:00 2001 From: Daniel Lumi <149794418+zk-Lumi@users.noreply.github.com> Date: Wed, 11 Dec 2024 01:34:53 +0100 Subject: [PATCH 1/3] feat: add explorer and portal to zk chain quickstart --- .../20.running/20.using-a-local-zk-chain.md | 74 ++++++++----------- 1 file changed, 29 insertions(+), 45 deletions(-) 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. From e7183985b51b29716034e17ff55f4143dedacf4d Mon Sep 17 00:00:00 2001 From: Daniel Lumi <149794418+zk-Lumi@users.noreply.github.com> Date: Wed, 11 Dec 2024 02:20:49 +0100 Subject: [PATCH 2/3] fix: zkstack prover update plus a few misc things --- .../20.running/20.using-a-local-zk-chain.md | 12 +++---- .../{80.validium.md => 35.validium.md} | 0 content/10.zk-stack/20.running/40.proving.md | 32 ++++++++++++++++--- content/10.zk-stack/20.running/_dir.yml | 2 +- cspell-config/cspell-dev.txt | 2 ++ 5 files changed, 36 insertions(+), 12 deletions(-) rename content/10.zk-stack/20.running/{80.validium.md => 35.validium.md} (100%) 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 e84df53e..2bdf0e3d 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 @@ -1,5 +1,5 @@ --- -title: Using a local ZK chain +title: Using a local ZK Chain description: --- @@ -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 +## Using your chain RPC 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). -### ZKsync CLI +## Using 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,7 +44,7 @@ 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). -## Setting up the Portal +## Using the Portal The [Portal](https://github.com/matter-labs/dapp-portal) module is a web-app that allows you to: @@ -64,7 +64,7 @@ ecosystem directory. You can edit this file to configure the portal app if neede 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. -## Setting up a Block Explorer +## Using a Block Explorer 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. diff --git a/content/10.zk-stack/20.running/80.validium.md b/content/10.zk-stack/20.running/35.validium.md similarity index 100% rename from content/10.zk-stack/20.running/80.validium.md rename to content/10.zk-stack/20.running/35.validium.md diff --git a/content/10.zk-stack/20.running/40.proving.md b/content/10.zk-stack/20.running/40.proving.md index 61adbb89..fd05d463 100644 --- a/content/10.zk-stack/20.running/40.proving.md +++ b/content/10.zk-stack/20.running/40.proving.md @@ -8,15 +8,37 @@ description: With the default configuration, your ZK chain is not running a prover, and has a DummyExecutor contract, which mainly “accepts” that a batch is executed without proof. This enables you to test it with much lower hardware requirements. -To enable the prover, run the `zkstack prover init` command. It will guide you through the necessary configuration. - -There are two options for running the Boojum prover: in GPU, or in CPU. +When enabling the Boojum prover, there are two options for running it: in GPU, or in CPU. ::callout{icon="i-heroicons-exclamation-triangle" color="amber"} **Running a prover is not required** for deploying a testnet. The requirements below are only necessary if you want to enable the prover. :: -### Requirements for GPU Prover +### Prover dependencies + +Ensure you have installed: + +- [gcloud](https://cloud.google.com/sdk/docs/install) +- [wget](https://www.gnu.org/software/wget/) +- [cmake](https://apt.kitware.com/) +- [nvcc (CUDA toolkit)](https://developer.nvidia.com/cuda-downloads) + +Refer to the [prover docs](https://github.com/matter-labs/zksync-era/blob/main/prover/docs/02_setup.md) for more +information. + +### Running the prover + +To initialize the prover, first use the init command: + +`zkstack prover init` + +It will guide you through the necessary configuration. + +Then to run the prover the prover: + +`zkstack prover run` + +### Requirements for GPU prover The docker compose file assumes you will be running all components in the same machine. The current minimum requirements for a low TPS scenario are: @@ -25,7 +47,7 @@ The docker compose file assumes you will be running all components in the same m - 64 GB of RAM - 300 GB of Disk Space (SSD preferred) -### Requirements for CPU Prover +### Requirements for CPU prover The docker compose file assumes you will be running all components in the same machine. The current minimum requirements for a low TPS scenario are: diff --git a/content/10.zk-stack/20.running/_dir.yml b/content/10.zk-stack/20.running/_dir.yml index cdcdc26f..406aea01 100644 --- a/content/10.zk-stack/20.running/_dir.yml +++ b/content/10.zk-stack/20.running/_dir.yml @@ -1 +1 @@ -title: Running a ZK chain +title: Running a ZK Chain diff --git a/cspell-config/cspell-dev.txt b/cspell-config/cspell-dev.txt index 61d23de2..0ee63ee8 100644 --- a/cspell-config/cspell-dev.txt +++ b/cspell-config/cspell-dev.txt @@ -115,3 +115,5 @@ applyl zbin scaleb chainid +nvcc +CUDA From bdc46337998286f1ec98169965792822313c1a9d Mon Sep 17 00:00:00 2001 From: Daniel Lumi <149794418+zk-Lumi@users.noreply.github.com> Date: Wed, 11 Dec 2024 02:24:51 +0100 Subject: [PATCH 3/3] fix: spelling mistake --- content/10.zk-stack/20.running/40.proving.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/10.zk-stack/20.running/40.proving.md b/content/10.zk-stack/20.running/40.proving.md index fd05d463..6588eedb 100644 --- a/content/10.zk-stack/20.running/40.proving.md +++ b/content/10.zk-stack/20.running/40.proving.md @@ -34,7 +34,7 @@ To initialize the prover, first use the init command: It will guide you through the necessary configuration. -Then to run the prover the prover: +Then to run the prover: `zkstack prover run`