forked from 0xPolygonHermez/zkevm-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Doc node execution modes (0xPolygonHermez#1428)
- Loading branch information
Showing
9 changed files
with
395 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Generating an Account Keystore file: | ||
|
||
This file contains your Ethereum L1 private key, but it will be encrypted at rest using a password of your choice. The ZKEVM Node - depending on which operating mode it's set up - will use this file in conjunction with the password to authorize L1 transactions. | ||
|
||
```bash | ||
docker run --rm hermeznetwork/zkevm-node:latest sh -c "/app/zkevm-node encryptKey --pk=[your private key] --pw=[password to encrypt file] --output=./keystore; cat ./keystore/*" > account.keystore | ||
``` | ||
|
||
**NOTE**: | ||
|
||
- Replace `[your private key]` with your Ethereum L1 account private key | ||
- Replace `[password to encrypt file]` with a password used for file encryption. This password must be passed to the Node later on via env variable (`ZKEVM_NODE_ETHERMAN_PRIVATEKEYPASSWORD`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Component: Aggregator | ||
|
||
## ZKEVM Aggregator: | ||
|
||
The ZKEVM Aggregator is an optional module responsible for orchestrating the available provers in order to generate the proofs for the batches not proven yet. | ||
|
||
## Hard dependencies: | ||
|
||
- [Synchronizer](./synchronizer.md) | ||
- [StateDB Database](./databases.md) | ||
- [Prover, Merkle Tree and Executor](./prover.md) | ||
|
||
## Running: | ||
|
||
The preferred way to run the ZKEVM Aggregator component is via Docker and Docker Compose. | ||
|
||
```bash | ||
docker pull hermeznetwork/zkevm-node | ||
``` | ||
|
||
To orchestrate multiple deployments of the different ZKEVM Node components, a `docker-compose.yaml` file for Docker Compose can be used: | ||
|
||
```yaml | ||
zkevm-aggregator: | ||
container_name: zkevm-aggregator | ||
image: zkevm-node | ||
command: | ||
- "/bin/sh" | ||
- "-c" | ||
- "/app/zkevm-node run --genesis /app/genesis.json --cfg /app/config.toml --components aggregator" | ||
``` | ||
The container alone needs some parameters configured, access to certain configuration files and the appropiate ports exposed. | ||
- volumes: | ||
- [your Account Keystore file]:/pk/keystore (note, this `/pk/keystore` value is the default path that's written in the Public Configuration files on this repo, meant to expedite deployments, it can be superseded via an env flag `ZKEVM_NODE_ETHERMAN_PRIVATEKEYPATH`.) | ||
- [your config.toml file]:/app/config.toml | ||
- [your genesis.json file]:/app/genesis.json | ||
|
||
- environment: Env variables that supersede the config file | ||
- `ZKEVM_NODE_STATEDB_HOST`: Name of StateDB Database Host | ||
|
||
### The Account Keystore file: | ||
|
||
Since the Aggregator will send transactions to L1 you'll need to generate an account keystore: | ||
|
||
[Generate an Account Keystore file](./account_keystore.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Component: Databases | ||
|
||
Different services rely on several standard PostgresQL databases, the most important one being the State Database. | ||
|
||
Configuring each DB is trivial if done with an orchestration tool such as Docker Compose. | ||
|
||
The following are examples on how one would provision each DB to serve along the components (rpc, aggregator, sequencer...) | ||
|
||
Note the `enviroment` values will change per DB. | ||
|
||
- **StateDB**: | ||
|
||
The StateDB needs to generate some extra databases and tables (`merkletree`) for use with the MerkleTree/Executor service. | ||
|
||
This is done via an sql file: [init_prover_db.sql](https://github.com/0xPolygonHermez/zkevm-node/blob/develop/db/scripts/init_prover_db.sql) | ||
|
||
```yaml | ||
zkevm-state-db: | ||
container_name: zkevm-state-db | ||
image: postgres | ||
deploy: | ||
resources: | ||
limits: | ||
memory: 2G | ||
reservations: | ||
memory: 1G | ||
ports: | ||
- 5432:5432 | ||
volumes: | ||
- ./init_prover_db.sql:/docker-entrypoint-initdb.d/init.sql | ||
environment: | ||
- POSTGRES_USER=state_user | ||
- POSTGRES_PASSWORD=state_password | ||
- POSTGRES_DB=state_db | ||
command: ["postgres", "-N", "500"] | ||
``` | ||
- **Other DBs: Pool/RPC**: | ||
```yaml | ||
zkevm-pool-db: | ||
container_name: zkevm-pool-db | ||
image: postgres | ||
deploy: | ||
resources: | ||
limits: | ||
memory: 2G | ||
reservations: | ||
memory: 1G | ||
ports: | ||
- 5433:5432 | ||
environment: | ||
- POSTGRES_USER=pool_user | ||
- POSTGRES_PASSWORD=pool_password | ||
- POSTGRES_DB=pool_db | ||
command: ["postgres", "-N", "500"] | ||
|
||
zkevm-rpc-db: | ||
container_name: zkevm-rpc-db | ||
image: postgres | ||
deploy: | ||
resources: | ||
limits: | ||
memory: 2G | ||
reservations: | ||
memory: 1G | ||
ports: | ||
- 5434:5432 | ||
environment: | ||
- POSTGRES_USER=rpc_user | ||
- POSTGRES_PASSWORD=rpc_password | ||
- POSTGRES_DB=rpc_db | ||
command: ["postgres", "-N", "500"] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Component: Prover | ||
|
||
NOTE: The Prover is not considered part of the ZKEVM Node and all issues and suggestions should be sent to the [Prover repo](https://github.com/0xPolygonHermez/zkevm-prover/). | ||
|
||
## ZKEVM Prover: | ||
|
||
The ZKEVM Prover image hosts different components, *Merkle Tree*, *Executor* and finally the actual *Prover*. | ||
|
||
## Running: | ||
|
||
The preferred way to run the ZKEVM Prover component is via Docker and Docker Compose. | ||
|
||
```bash | ||
docker pull hermeznetwork/zkevm-prover | ||
``` | ||
|
||
To orchestrate multiple deployments of the different ZKEVM Node components, a `docker-compose.yaml` file for Docker Compose can be used: | ||
|
||
```yaml | ||
zkevm-prover: | ||
container_name: zkevm-prover | ||
image: zkevm-prover | ||
volumes: | ||
- ./prover-config.json:/usr/src/app/config.json | ||
command: > | ||
zkProver -c /usr/src/app/config.json | ||
``` | ||
The `prover-config.json` file contents will vary depending on your use case, the main document explains different values to be changed to achieve different behaviors. | ||
|
||
### Ports: | ||
|
||
- `50051`: Prover | ||
- `50061`: Merkle Tree | ||
- `50071`: Executor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Component: RPC | ||
|
||
## ZKEVM RPC: | ||
|
||
The ZKEVM RPC relays transactions to the Trusted sequencer. | ||
|
||
## Hard dependencies: | ||
|
||
- [Synchronizer](./synchronizer.md) | ||
- [StateDB Database](./databases.md) | ||
- [RPCDB Database](./databases.md) | ||
- [Merkle Tree and Executor](./prover.md) | ||
|
||
## Running: | ||
|
||
The preferred way to run the ZKEVM RPC component is via Docker and Docker Compose. | ||
|
||
```bash | ||
docker pull hermeznetwork/zkevm-node | ||
``` | ||
|
||
To orchestrate multiple deployments of the different ZKEVM Node components, a `docker-compose.yaml` file for Docker Compose can be used: | ||
|
||
```yaml | ||
zkevm-rpc: | ||
container_name: zkevm-rpc | ||
image: zkevm-node | ||
command: | ||
- "/bin/sh" | ||
- "-c" | ||
- "/app/zkevm-node run --genesis /app/genesis.json --cfg /app/config.toml --components rpc" | ||
``` | ||
The container alone needs some parameters configured, access to certain configuration files and the appropiate ports exposed. | ||
- ports: | ||
- `8545:8545`: RPC Port | ||
- `9091:9091`: Neded if Prometheus metrics are enabled | ||
- environment: Env variables that supersede the config file | ||
- `ZKEVM_NODE_STATEDB_HOST`: Name of StateDB Database Host | ||
- `ZKEVM_NODE_POOL_HOST`: Name of PoolDB Database Host | ||
- `ZKEVM_NODE_RPC_DB_HOST`: Name of RPCDB Database Host | ||
- `ZKEVM_NODE_RPC_BROADCASTURI`: String to return when a client requests the following resource: `zkevm_getBroadcastURI` | ||
- volumes: | ||
- [your config.toml file]:/app/config.toml | ||
- [your genesis file]:/app/genesis.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Component: Sequencer | ||
|
||
## ZKEVM Sequencer: | ||
|
||
The ZKEVM Sequencer is an optional but ancillary module that proposes new batches using transactions stored in the Pool Database. | ||
|
||
## Running: | ||
|
||
The preferred way to run the ZKEVM Sequencer component is via Docker and Docker Compose. | ||
|
||
```bash | ||
docker pull hermeznetwork/zkevm-node | ||
``` | ||
|
||
To orchestrate multiple deployments of the different ZKEVM Node components, a `docker-compose.yaml` file for Docker Compose can be used: | ||
|
||
```yaml | ||
zkevm-sequencer: | ||
container_name: zkevm-sequencer | ||
image: zkevm-node | ||
command: | ||
- "/bin/sh" | ||
- "-c" | ||
- "/app/zkevm-node run --genesis /app/genesis.json --cfg /app/config.toml --components sequencer" | ||
``` | ||
The container alone needs some parameters configured, access to certain configuration files and the appropiate ports exposed. | ||
- environment: Env variables that supersede the config file | ||
- `ZKEVM_NODE_POOLDB_HOST`: Name of PoolDB Database Host | ||
- `ZKEVM_NODE_STATEDB_HOST`: Name of StateDB Database Host | ||
- volumes: | ||
- [your Account Keystore file]:/pk/keystore (note, this `/pk/keystore` value is the default path that's written in the Public Configuration files on this repo, meant to expedite deployments, it can be superseded via an env flag `ZKEVM_NODE_ETHERMAN_PRIVATEKEYPATH`.) | ||
- [your config.toml file]:/app/config.toml | ||
- [your genesis.json file]:/app/genesis.json | ||
|
||
[How to generate an account keystore](./account_keystore.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Component: Synchronizer | ||
|
||
## ZKEVM Synchronizer: | ||
|
||
The ZKEVM Synchronizer is the **base** component for which all others will depend on. You can *mix and match* different components to achieve a different outcome, be it sending transactions or computing proofs, but the Sync module will need to be up and running. | ||
|
||
This module syncs data between the Layer 1 Ethereum network and ZKEVM L2 network. | ||
|
||
## Running: | ||
|
||
The preferred way to run the ZKEVM Synchronizer component is via Docker and Docker Compose. | ||
|
||
```bash | ||
docker pull hermeznetwork/zkevm-node | ||
``` | ||
|
||
To orchestrate multiple deployments of the different ZKEVM Node components, a `docker-compose.yaml` file for Docker Compose can be used: | ||
|
||
**THIS STEP IS MANDATORY ON ALL DEPLOYMENT MODES** | ||
|
||
```yaml | ||
zkevm-sync: | ||
container_name: zkevm-sync | ||
image: zkevm-node | ||
command: | ||
- "/bin/sh" | ||
- "-c" | ||
- "/app/zkevm-node run --genesis /app/genesis.json --cfg /app/config.toml --components synchronizer" | ||
``` | ||
The container alone needs some parameters configured, access to certain configuration files and the appropiate ports exposed. | ||
- environment: Env variables that supersede the config file | ||
- `ZKEVM_NODE_STATEDB_HOST`: Name of StateDB Database Host | ||
- volumes: | ||
- [your config.toml file]:/app/config.toml | ||
- [your genesis.json file]:/app/genesis.json |
Oops, something went wrong.