You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/cdk/getting-started/local-deployment.md
+77-82Lines changed: 77 additions & 82 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
comments: true
3
3
---
4
4
5
-
This guide walks you through the process of setting up and deploying a layer 2 CDK blockchain on your local machine.
5
+
This guide walks you through the process of setting up and deploying a layer 2 CDK blockchain stack on your local machine.
6
6
7
7
The [Polygon CDK Kurtosis package](https://github.com/0xPolygon/kurtosis-cdk/) allows you to easily customize and instantiate all the components of a CDK chain. It uses the [Kurtosis](https://docs.kurtosis.com/) tool to orchestrate the setup of the chain components in Docker containers, with logic defined in [Starlark](https://github.com/bazelbuild/starlark) scripts (a Python dialect) which define the step-by-step process of setting up the chain.
8
8
@@ -19,10 +19,10 @@ The [Polygon CDK Kurtosis package](https://github.com/0xPolygon/kurtosis-cdk/) a
19
19
20
20
### Software
21
21
22
-
-[Docker Engine](https://docs.docker.com/engine/) version 4.27 or higher.
22
+
-[Docker Engine](https://docs.docker.com/engine/)- version 4.27 or higher for MacOS.
| 1 | Deploy a local layer 1 devnet chain |[ethereum.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/ethereum.star)| True |
54
-
| 2 | Deploy the zkEVM smart contracts on the L1 |[deploy_zkevm_contracts.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/deploy_zkevm_contracts.star)| True |
55
-
| 3 | Deploy the zkEVM node and CDK peripheral databases |[databases.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/databases.star)| True |
56
-
| 4 | Deploy the CDK central environment |[cdk_central_environment.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/cdk_central_environment.star)| True |
57
-
| 5 | Deploy the bridge infrastructure |[cdk_bridge_infrastructure.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/cdk_bridge_infra.star)| True |
58
-
| 6 | Deploy the permissionless node|[zkevm_permissionless_node.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/zkevm_permissionless_node.star)| False|
59
-
| 7 | Deploy the observability stack|[observability.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/observability.star)| True|
60
-
|8|Deploy the block explorer |[blockscout.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/blockscout.star)| False|
61
-
|9|Apply a load test to the chain|[load_test.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/workload.star)| False |
| 1 | Deploy a local layer 1 Ethereum chain |[ethereum.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/ethereum.star)| True |
54
+
| 2 | Deploy the CDK smart contracts on the L1 |[deploy_zkevm_contracts.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/deploy_zkevm_contracts.star)| True |
55
+
| 3 | Deploy the central environment, prover, and CDK erigon or zkEVM node databases |[databases.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/databases.star)| True |
56
+
| 4 | Deploy the CDK central environment |[cdk_central_environment.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/cdk_central_environment.star)| True |
57
+
| 5 | Deploy the CDK erigon package|[cdk_erigon.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/cdk_erigon.star)- included in step 4 deployment | True|
58
+
| 6 | Deploy the bridge infrastructure|[cdk_bridge_infrastructure.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/cdk_bridge_infra.star)| True |
59
+
| 7 | Deploy the AggLayer |[agglayer.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/agglayer.star)| True |
60
+
|-|Input parser tool to help deployment stages|[input_parser.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/input_parser.star)- deployed immediately| n/a|
61
+
|-|zkEVM pool manager tool |[zkevm_pool_manager.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/zkevm_pool_manager.star)- deployed with CDK erigon node| n/a|
62
+
63
+
64
+
You can customize (or skip) any of the numbered steps by modifying the logic in the respective files.
@@ -73,97 +73,95 @@ You can modify each of these parameters to customize the chain to your specific
73
73
74
74
## Run the chain locally
75
75
76
-
First run the [kurtosis clean](https://docs.kurtosis.com/clean) to remove any existing Kurtosis environments:
77
-
78
-
```bash
79
-
kurtosis clean --all
80
-
```
76
+
1. Run the [kurtosis clean](https://docs.kurtosis.com/clean) to remove any existing Kurtosis environments:
81
77
82
-
Then, in the `kurtosis-cdk` directory, use the [kurtosis run](https://docs.kurtosis.com/run) command to deploy the chain on your local machine by executing the `main.star` script provided with the `params.yml` configuration file:
78
+
```bash
79
+
kurtosis clean --all
80
+
```
83
81
84
-
```bash
85
-
kurtosis run --enclave cdk-v1 --args-file params.yml --image-download always .
86
-
```
82
+
2. In the `kurtosis-cdk` directory, use the [kurtosis run](https://docs.kurtosis.com/run) command to deploy the chain on your local machine by executing the `main.star` script provided with the `params.yml` configuration file:
87
83
88
-
!!! info
84
+
```bash
85
+
kurtosis run --enclave cdk-v1 --args-file params.yml --image-download always .
86
+
```
89
87
90
-
- `--enclave cdk-v1` specifies the name of the [enclave](https://docs.kurtosis.com/advanced-concepts/enclaves/) (isolated environment) to use for the deployment process.
91
-
- `--args-file params.yml` specifies the configuration file to use for the deployment process.
92
-
- `--image-download always` specifies to always download the latest Docker images for the deployment process.
88
+
- `enclave cdk-v1` specifies the name of the enclave, or isolated environment, to use for the deployment process.
89
+
- `args-file params.yml` specifies the configuration file to use for the deployment process.
90
+
- `image-download` specifies to always download the latest Docker images for the deployment process.
93
91
94
-
This command typically takes a while to complete and outputs the logs of each step in the deployment process for you to monitor the progress of the chain setup. Once the command is complete, you should see the following output:
92
+
3. This command typically takes a while to complete and outputs the logs of each step in the deployment process for you to monitor the progress of the chain setup. Once the command is complete, you should see the following output:
95
93
96
-
```bash
97
-
Starlark code successfully run. No output was returned.
94
+
```bash
95
+
Starlark code successfully run. No output was returned.
The `0xE34...9970` and `0x12d...c625` public-private key pair used in the above commands is the default admin account configured in`params.yml`.
149
+
!!! info
150
+
The `0xE34...9970` and `0x12d...c625` public-private key pair used in the above commands is the default admin account configured in `params.yml`.
159
151
160
152
### Load testing the chain
161
153
162
-
Use the [`polycli loadtest`](https://github.com/maticnetwork/polygon-cli/blob/main/doc/polycli_loadtest.md) commandto send multiple transactions at once to the chain to test its performance:
154
+
1. Export the RPC URL of your L2 to an environment variable called `ETH_RPC_URL` with the following command:
export ETH_RPC_URL="$(kurtosis port print cdk-v1 cdk-erigon-node-001 http-rpc)"
158
+
```
159
+
160
+
2. Use the [`polycli loadtest`](https://github.com/maticnetwork/polygon-cli/blob/main/doc/polycli_loadtest.md) command to send multiple transactions at once to the chain to test its performance:
@@ -185,34 +183,27 @@ To open the bridge interface and bridge tokens across the L1 and L2, run the fol
185
183
open $(kurtosis port print cdk-v1 zkevm-bridge-proxy-001 web-ui)
186
184
```
187
185
188
-
!!! tip
189
-
If the `open`command doesn't work, you can find the URL's in the Kurtosis output.
186
+
## Additional services
190
187
191
-
### Viewing chain metrics
188
+
There are a number of additional services you can add to the stack, including observability applications and other useful tools.
192
189
193
-
!!! warning
194
-
- Observability defaults to false.
195
-
- Turn on observability in the deployment by setting the `deploy_observability` parameter to `true`in`params.yml`.
196
-
- Redeploy Kurtosis.
190
+
See the current list of additional services in the [CDK kurtosis additional services documentation](https://github.com/0xPolygon/kurtosis-cdk/blob/main/docs/additional-services.md).
197
191
198
-
Once the observability functionis activated, you can see information such as:
192
+
To add an additional service, simply add the name of the service to the `params.yml` array. For example:
199
193
200
-
- How many transactions are being processed.
201
-
- The amount of gas being used.
202
-
- The time since a batch was last verified.
203
-
- How many addresses have bridged.
194
+
```yml
195
+
args:
196
+
additional_services:
197
+
- blockscout
198
+
- prometheus_grafana
199
+
```
204
200
205
-
Open the Grafana dashboard by running the following command:
201
+
To use the additional service, simply add the service to a kurtosis call. For example, to open the Grafana dashboard once set up in `params.yml`, run the following command:
206
202
207
203
```bash
208
204
open $(kurtosis port print cdk-v1 grafana-001 dashboards)
209
205
```
210
206
211
-
!!! tip
212
-
If the `open`command doesn't work, you can find the URL's in the Kurtosis output.
213
-
214
-
From the hamburger menu, navigate to `Dashboards` and selectthe`Panoptichain` dashboard to view all of the metrics.
While it is possible to run a CDK chain on your own, we strongly recommend getting in touch with the [Polygon team directly](https://share-eu1.hsforms.com/1aI6l7_bFTn-vWl0NIFVzDQc8xid), or one of our [implementation providers](https://ecosystem.polygon.technology/spn/cdk/) for production deployments.
229
220
221
+
## Advanced use cases
222
+
223
+
For a list of advanced use cases and documentation explaining how to set them up, please see the list in the [Kurtosis CDK stack repo](https://github.com/0xPolygon/kurtosis-cdk?tab=readme-ov-file#advanced-use-cases).
224
+
230
225
## Further reading
231
226
232
227
- For more information on CDK architecture, components, and how to customize your chain, refer to the [CDK architecture documentation](https://docs.polygon.technology/cdk/architecture/cdk-zkevm/).
0 commit comments