Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add explorer + portal + prover to zk chain quickstart #287

Merged
merged 4 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 29 additions & 45 deletions content/10.zk-stack/20.running/20.using-a-local-zk-chain.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Using a local ZK chain
title: Using a local ZK Chain
description:
---

Expand All @@ -26,12 +26,12 @@ 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 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).
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
## Using zksync-cli

[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.
Expand All @@ -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
## Using 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 <http://localhost:3000>).
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
## Using 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 <chain_name>
```

#### 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 <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>.
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.
32 changes: 27 additions & 5 deletions content/10.zk-stack/20.running/40.proving.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

`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:

Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion content/10.zk-stack/20.running/_dir.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
title: Running a ZK chain
title: Running a ZK Chain
2 changes: 2 additions & 0 deletions cspell-config/cspell-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,5 @@ applyl
zbin
scaleb
chainid
nvcc
CUDA
Loading