|
| 1 | +Polygon AggLayer is a web service that receives zero-knowledge proofs from different CDK chains and checks their soundness before sending the proof to L1 for verification. |
| 2 | + |
| 3 | +!!! warning |
| 4 | + - The AggLayer is in development and subject to architectural changes. |
| 5 | + - The code is still being audited. |
| 6 | + |
| 7 | +## Prerequisites |
| 8 | + |
| 9 | +Make sure you have the following software installations. |
| 10 | + |
| 11 | +- [Docker](https://docs.docker.com/engine/install/) |
| 12 | +- [Docker Compose](https://docs.docker.com/compose/install/) |
| 13 | +- [Golang](https://go.dev/doc/install) |
| 14 | +- [GCloud cli](https://cloud.google.com/sdk/docs/install) - production only. |
| 15 | + |
| 16 | +### Clone the repo. |
| 17 | + |
| 18 | +```sh |
| 19 | +git clone https://github.com/0xPolygon/agglayer.git |
| 20 | +cd agglayer/ |
| 21 | +``` |
| 22 | + |
| 23 | +## Set up and installation |
| 24 | + |
| 25 | +### Local |
| 26 | + |
| 27 | +Run the following command to bring up a zkEVM node, a prover, and a mock L1 network. |
| 28 | + |
| 29 | +```sh |
| 30 | +make run-docker |
| 31 | +``` |
| 32 | + |
| 33 | +### Production |
| 34 | + |
| 35 | +!!! warning |
| 36 | + - Currently only one instance of the AggLayer can run at one time. |
| 37 | + - The AggLayer should, therefore, automatically start in the case of failure using a containerized setup or an OS level service manager/monitoring system. |
| 38 | + |
| 39 | +Install the Golang dependencies. |
| 40 | + |
| 41 | +```sh |
| 42 | +go install . |
| 43 | +``` |
| 44 | + |
| 45 | +#### Key-signing configurations |
| 46 | + |
| 47 | +Install polygon-cli: |
| 48 | + |
| 49 | +```sh |
| 50 | +go install github.com/maticnetwork/polygon-cli@latest |
| 51 | +``` |
| 52 | + |
| 53 | +Create a new signature: |
| 54 | + |
| 55 | +```sh |
| 56 | +polygon-cli signer create --kms GCP --gcp-project-id gcp-project --key-id mykey-tmp |
| 57 | +``` |
| 58 | + |
| 59 | +Set up ADC in GCloud: |
| 60 | + |
| 61 | +```sh |
| 62 | +gcloud auth application-default login |
| 63 | +``` |
| 64 | + |
| 65 | +In the `../agglayer/docker/data/agglayer.toml` file, add the `KMSKeyName` from GCloud. |
| 66 | + |
| 67 | +## Setting up the AggLayer |
| 68 | + |
| 69 | +Each CDK chain requires a corresponding RPC node configuration that is synced with the target CDK. This node checks the state root after executions of L2 batches. |
| 70 | + |
| 71 | +!!! info "Storage recommendations" |
| 72 | + - Use a durable HA PostgresDB for storage; ideally AWS Aurora PostgreSQL or Cloud SQL for PostgreSQL in GCP. |
| 73 | + |
| 74 | +Add the chain configurations to the `../agglayer/docker/data/agglayer.toml` file by amending the following details to add the required chain(s). |
| 75 | + |
| 76 | +* Configure `[FullNodeRPCs]` to point to the corresponding L2 full node. |
| 77 | +* Configure `[L1]` to point to the corresponding L1 chain. |
| 78 | +* Configure the `[DB]` section with the managed database details. |
0 commit comments