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

docs for snark impl #26

Merged
merged 4 commits into from
Jul 2, 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
1 change: 1 addition & 0 deletions storage-provider-guide/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ The full list of options that you can use to configure an es-node are as follows
|`--miner.threads-per-shard`|Number of threads per shard|`runtime.NumCPU() x 2`||
|`--miner.zk-working-dir`|Path to the snarkjs folder|`build/bin`||
|`--miner.zk-prover-mode`|ZK prover mode, 1: one proof per sample, 2: one proof for multiple samples|`2`||
|`--miner.zk-prover-impl`|ZK prover implementation, 1: snarkjs, 2: go-rapidsnark|`1`||
|`--miner.zkey`|zkey file name which should be put in the snarkjs folder|`blob_poseidon2.zkey`||
|`--network`|Predefined L1 network selection. Available networks: devnet|||
|`--p2p.advertise.ip`|The IP address to advertise in Discv5, put into the ENR of the node. This may also be a hostname / domain name to resolve to an IP.|||
Expand Down
60 changes: 56 additions & 4 deletions storage-provider-guide/tutorials.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ Mining is enabled by default by the `--miner.enabled` flag in `run.sh`, which me

> ℹ️ **_Note:_** Some of the flags/parameters used in `run.sh` are supposed to change over time. Refer to [_configuration_](configuration.md) for a full list.

### About the option of zk prover implementation

The `--miner.zk-prover-impl` flag specifies the type of zkSNARK implementation.

Its default value is `1` which represents snarkjs. You have the option to override the flag and set it to `2` in order to utilize go-rapidsnark, which enhances the performance of zk proof generation on certain platforms, such as Ubuntu.

If you have to run an es-node pre-built with value `2` on Ubuntu 20.04, you will need to [install extra packages](#install-libc6_235).

## Options for running es-node

You can run es-node from a pre-built executable, a pre-built Docker image, or from the source code.
Expand All @@ -75,7 +83,7 @@ You can run es-node from a pre-built executable, a pre-built Docker image, or fr

### From pre-built executables

Before running es-node from the pre-built executables, ensure that you have installed [Node.js](tutorials.md#install-node.js) and [snarkjs](tutorials.md#install-snarkjs).
Before running es-node from the pre-built executables, ensure that you have installed [Node.js](tutorials.md#install-node.js) and [snarkjs](tutorials.md#install-snarkjs), unless `--miner.zk-prover-impl` flag is set to `2`.

> ℹ️ **_Note:_** Ensure that you run the executables on [WSL 2](https://learn.microsoft.com/en-us/windows/wsl/install) if you are using Windows, and both Node.js and snarkjs are installed on WSL instead of Windows.

Expand Down Expand Up @@ -120,9 +128,11 @@ docker run --name es -d \
-p 30305:30305/udp \
--entrypoint /es-node/run.sh \
ghcr.io/ethstorage/es-node:v0.1.15 \
--miner.zk-prover-impl 2 \
--l1.rpc <el_rpc> \
--l1.beacon <cl_rpc>
```
> ℹ️ **_Note:_** The flag ` --miner.zk-prover-impl 2` is used to generate zk proofs using go-rapidsnark instead of snarkjs for better performance.

After launch, you can check docker logs using the following command:

Expand All @@ -144,9 +154,13 @@ docker run --name es -d \

### From source code

You will need to [install Go](tutorials.md#install-go) to build es-node from source code, and install [Node.js](tutorials.md#install-node.js) and [snarkjs](tutorials.md#install-snarkjs) to run es-node.
You will need to [install Go](tutorials.md#install-go) to build es-node from source code.

Download source code and switch to the latest release branch:
If you intend to build es-node on Ubuntu, be sure to [verify some dependencies](#install-rapidsnark-dependencies).

Just like running a pre-built, if you plan to utilize the default zkSNARK implementation, ensure that you have installed [Node.js](tutorials.md#install-node.js) and [snarkjs](tutorials.md#install-snarkjs).

Now download source code and switch to the latest release branch:

```sh
git clone https://github.com/ethstorage/es-node.git
Expand Down Expand Up @@ -214,7 +228,7 @@ tar -C /usr/local -xf go1.21.4.linux-amd64.tar.gz

Update `$PATH`

```
```sh
echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.profile
source ~/.profile
```
Expand Down Expand Up @@ -253,6 +267,44 @@ nvm use 20
npm install -g snarkjs
```

### Install RapidSNARK dependencies

Check if `build-essential` and `libomp-dev packages` are installed on your Ubuntu system:

```sh
dpkg -l | grep build-essential
dpkg -l | grep libomp-dev
```
Install the build-essential and libomp-dev packages if no information printed:

```sh
apt update
apt install build-essential
apt install libomp-dev
```

### Install libc6_2.35

This installation is intended for scenarios where you encounter errors like this while running the pre-built es-node on Ubuntu 20.04:

```sh
/lib/x86_64-linux-gnu/libc.so.6: version 'glibc_2.32' not found
/lib/x86_64-linux-gnu/libc.so.6: version 'glibc_2.34' not found
```

To prevent the error, add the following line to your /etc/apt/sources.list:

```sh
deb http://security.ubuntu.com/ubuntu jammy-security main
```

Next, install libc6_2.35 by running the following commands:

```sh
apt update
apt install -y libc6
```

## Check the status after launching the es-node

It's important to monitor the node closely until it successfully submits its first storage proof. Typically, the process encompasses three main stages.
Expand Down