|
| 1 | +Polygon AggLayer is a ZK-powered interoperability solution that enables a shared state across multiple chains. It receives zero-knowledge proofs from CDK chains and checks their soundness before sending them on to the L1 for verification. |
| 2 | + |
| 3 | +This document shows you how to integrate and configure the AggLayer into your stack. |
| 4 | + |
| 5 | +!!! important |
| 6 | + - Polygon manages the AggLayer in production at the current time. |
| 7 | + - In the future, the AggLayer will be decentralized. |
| 8 | + |
| 9 | +!!! warning |
| 10 | + - The AggLayer is in development and subject to architectural changes. |
| 11 | + - The code is still being audited. |
| 12 | + |
| 13 | +## Step 1: Attach a chain to the uLXLY bridge |
| 14 | + |
| 15 | +1. If you do not have a CDK chain set up with Polygon, [make a request to register your chain](https://discord.gg/XvpHAxZ). |
| 16 | + |
| 17 | + We will ask you for the following data: |
| 18 | + |
| 19 | + ```json |
| 20 | + "rollupTypeID": 0, |
| 21 | + "chainID": 0000, |
| 22 | + "admin": "0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", |
| 23 | + "sequencer": "0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", |
| 24 | + "gasTokenAddress": "0x0000000000000000000000000000000000000000", |
| 25 | + "sequencerURL": "https://rpc.chain.name", |
| 26 | + "networkName": "chain name" |
| 27 | + ``` |
| 28 | + |
| 29 | + !!! note |
| 30 | + - If you are using a wrapped-token on the bridge, we use the original token address. |
| 31 | + - You can use any token on any network that is attached to the LxLy bridge, including those from the Ethereum mainnet. |
| 32 | + |
| 33 | +2. Once registered, we provide you with the following network parameters: |
| 34 | + |
| 35 | + - `rollupID` |
| 36 | + - `rollupAddress` |
| 37 | + |
| 38 | +3. We also give you a pre-configured `genesis.json` file to use. |
| 39 | + |
| 40 | +4. You will need the Polygon bridge configuration details. |
| 41 | + |
| 42 | + ```sh |
| 43 | + [NetworkConfig] |
| 44 | + GenBlockNumber = "16896721" |
| 45 | + PolygonBridgeAddress = "0x2a3DD3EB832aF982ec71669E178424b10Dca2EDe" |
| 46 | + PolygonZkEVMGlobalExitRootAddress = "0x580bda1e7A0CFAe92Fa7F6c20A3794F169CE3CFb" |
| 47 | + PolygonRollupManagerAddress = "0x5132a183e9f3cb7c848b0aac5ae0c4f0491b7ab2" |
| 48 | + ... |
| 49 | + ``` |
| 50 | + |
| 51 | +5. Configure your nodes with the data. |
| 52 | + |
| 53 | + !!! info "Configure your nodes" |
| 54 | + - Add the `rollupID` and `rollupAddress` parameters to the `L1config` section of the `genesis.json` file of the CDK node. For example: |
| 55 | + |
| 56 | + ```sh |
| 57 | + { |
| 58 | + "rollupTypeID": 1, |
| 59 | + "chainID": 3776, |
| 60 | + "admin": "0xxxxx", |
| 61 | + "sequencer": "0xxxxx", |
| 62 | + "gasTokenAddress": "0x0000000000000000000000000000000000000000", |
| 63 | + "sequencerURL": "https://rpc.xxx", |
| 64 | + "networkName": "xxx zkEVM", |
| 65 | + } |
| 66 | + ``` |
| 67 | + |
| 68 | +6. Polygon registers the CDK chain on the uLxLy bridge. |
| 69 | + |
| 70 | +7. Chain owners then need to add POL and ETH tokens to the sequencer on the CDK chain. |
| 71 | + |
| 72 | +## Configuring the Polygon managed AggLayer |
| 73 | + |
| 74 | +Once registered, Polygon creates a permissionless node that points to the corresponding L2 full node. |
| 75 | + |
| 76 | +We then add your details to our AggLayer configuration file [`../agglayer/docker/data/agglayer.toml`](https://github.com/0xPolygon/agglayer/blob/main/docker/data/agglayer/agglayer.toml); specifically these configurations: |
| 77 | + |
| 78 | +* `[FullNodeRPCs]` points to the corresponding L2 full node. |
| 79 | +* `[L1]` points to the corresponding L1 chain. |
| 80 | +* The `[DB]` section has the managed database details. |
| 81 | + |
| 82 | +For example: |
| 83 | + |
| 84 | +```sh |
| 85 | +[FullNodeRPCs] |
| 86 | +# 0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82 = "http://zkevm-node:8123" |
| 87 | +# {{ zkevm_l1_rollup_manager_addr }} = "http://int-rpc.{{ base_dn }}:{{ zkevm_rpc_server_port }}" |
| 88 | +1 = "http://int-rpc.{{ base_dn }}:{{ zkevm_rpc_server_port }}" |
| 89 | + |
| 90 | +[RPC] |
| 91 | +Host = "0.0.0.0" |
| 92 | +Port = {{ zkevm_agglayer_server_port }} |
| 93 | +ReadTimeout = "60s" |
| 94 | +WriteTimeout = "60s" |
| 95 | +MaxRequestsPerIPAndSecond = 5000 |
| 96 | + |
| 97 | +[Log] |
| 98 | +Environment = "development" # "production" or "development" |
| 99 | +Level = "debug" |
| 100 | +Outputs = ["stderr"] |
| 101 | + |
| 102 | +[DB] |
| 103 | +User = "{{ zkevm_agglayer_db_user }}" |
| 104 | +Password = "{{ zkevm_agglayer_db_password }}" |
| 105 | +Name = "{{ zkevm_agglayer_db_name }}" |
| 106 | +Host = "{{ zkevm_postgres_host }}" |
| 107 | +Port = "5432" |
| 108 | +EnableLog = false |
| 109 | +MaxConns = 200 |
| 110 | + |
| 111 | +[EthTxManager] |
| 112 | +FrequencyToMonitorTxs = "1s" |
| 113 | +WaitTxToBeMined = "2m" |
| 114 | +ForcedGas = 0 |
| 115 | +GasPriceMarginFactor = 1 |
| 116 | +MaxGasPriceLimit = 0 |
| 117 | +PrivateKeys = [ |
| 118 | + {Path = "/etc/agglayer/agglayer.keystore", Password = "{{ zkevm_agglayer_keystore_password }}"}, |
| 119 | +] |
| 120 | + |
| 121 | +[L1] |
| 122 | +ChainID = {{ zkevm_l1_chain_id }} |
| 123 | +NodeURL = "{{ zkevm_l1_rpc }}" |
| 124 | +RollupManagerContract = "{{ zkevm_l1_rollup_manager_addr }}" |
| 125 | + |
| 126 | +[Telemetry] |
| 127 | +PrometheusAddr = "0.0.0.0:2223" |
| 128 | +``` |
| 129 | + |
| 130 | +## Configuring the client-managed AggLayer |
| 131 | + |
| 132 | +The last step is to update your node configuration to map to the Polygon Agglayer. |
| 133 | + |
| 134 | +Open the `config.toml` file and include the following: |
| 135 | + |
| 136 | +```sh |
| 137 | +[Aggregator] |
| 138 | +SettlementBackend = "agglayer" |
| 139 | +AggLayerURL = "https://agglayer-test.polygon.technology" |
| 140 | +AggLayerTxTimeout = "300s" |
| 141 | +SenderAddress = "0x0325686a18aA829B9FaaAD70f22ea0830aA6076F" |
| 142 | +``` |
| 143 | + |
| 144 | +You now have a fully integrated AggLayer in your Polygon CDK stack. |
| 145 | + |
| 146 | +</br> |
0 commit comments