Skip to content

Commit

Permalink
feat: add explorer + portal + prover to zk chain quickstart (#287)
Browse files Browse the repository at this point in the history
<!--

Thank you for contributing to the ZKsync Docs!

Before submitting the PR, please make sure you do the following:

- Update your PR title to follow [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/)
- Read the [Contributing
Guide](https://github.com/matter-labs/zksync-docs/blob/main/CONTRIBUTING.md).
- Understand our [Code of
Conduct](https://github.com/matter-labs/zksync-docs/blob/main/CODE_OF_CONDUCT.md)
- Please delete any unused parts of the template when submitting your PR

-->

# Description

@itsacoyote @MexicanAce 
- Updated the explorer and portal usage to use the new zkstack cli
commands.
- Updated zkstack prover guide to use the new zkstack cli commands.
- Moved "validium in zk stack" higher in dropdown instead of being last.
- Updated some inconsistent titles to match format of others.

Possibly a bit OCD of me to do this, but was playing with zkstack today
and they stayed in my mind bothering me hahahah 😉
<!-- Please describe what are the changes and what they are solving for
in this PR. -->

## Linked Issues

<!-- If you have any issues this PR is related to, link them here. -->
<!--
Check out
https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue
on how to automate linking a GitHub Issue to a PR.
-->

## Additional context

---------

Co-authored-by: Igor Aleksanov <popzxc@yandex.ru>
  • Loading branch information
zk-Lumi and popzxc authored Dec 12, 2024
1 parent e3cc9aa commit 0e4ec82
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 51 deletions.
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

0 comments on commit 0e4ec82

Please sign in to comment.