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
@@ -14,7 +14,7 @@ To run the Polygon CDK locally, the following prerequisites are required:
14
14
**Hardware Requirements:**
15
15
16
16
- A Linux-based Operating System (or [WSL](https://learn.microsoft.com/en-us/windows/wsl/about))
17
-
- 8GB RAM with a 2-core CPU
17
+
-Minimum 8GB RAM and 2-core CPU
18
18
- An AMD64 architecture system
19
19
20
20
**Software Dependencies:**
@@ -49,14 +49,14 @@ If everything is installed correctly, you should see the following output:
49
49
50
50
```bash
51
51
Checking that you have the necessary tools to deploy the Kurtosis CDK package...
52
-
✅ kurtosis 0.89.12 is installed, meets the requirement (=0.89).
53
-
✅ docker 25.0.3 is installed, meets the requirement (>=24.7).
52
+
✅ kurtosis is installed, meets the requirement (=0.89).
53
+
✅ docker is installed, meets the requirement (>=24.7).
54
54
55
55
You might as well need the following tools to interact with the environment...
56
-
✅ jq 1.7.1 is installed.
57
-
✅ yq 3.2.3 is installed, meets the requirement (>=3.2).
58
-
✅ cast 0.2.0 is installed.
59
-
✅ polycli v0.1.43-5-g73ad3f4 is installed.
56
+
✅ jq is installed.
57
+
✅ yq is installed, meets the requirement (>=3.2).
58
+
✅ cast is installed.
59
+
✅ polycli is installed.
60
60
61
61
🎉 You are ready to go!
62
62
```
@@ -70,19 +70,22 @@ To begin understanding the codebase, there are two key files to inspect:
70
70
71
71
#### main.star
72
72
73
-
The `main.star` file defines the step-by-step process of the deployment process. It is the main "hub" of the chain setup process; orchestrating the setup of all the components in sequential order by pulling in necessary logic from other files.
73
+
The `main.star` file defines the step-by-step instructions of the deployment process. It is the main "hub" of the chain setup process; orchestrating the setup of all the components in sequential order by pulling in necessary logic from other files.
74
74
75
-
By default, this script performs the following steps:
75
+
It defines the following steps for the deployment process:
76
76
77
-
1. Deploy a local layer 1 devnet chain ([ethereum.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/ethereum.star))
78
-
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))
79
-
3. Deploy the zkEVM node and CDK peripheral databases ([databases.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/databases.star))
80
-
4. Deploy the CDK central environment ([cdk_central_environment.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/cdk_central_environment.star))
81
-
5. Deploy the bridge infrastructure ([cdk_bridge_infrastructure.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/cdk_bridge_infra.star))
82
-
6. Deploy the permissionless node ([zkevm_permissionless_node.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/zkevm_permissionless_node.star))
83
-
7. Deploy the observability stack and block explorer ([observability.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/observability.star) and [blockscout.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/blockscout.star))
84
-
8. Apply a load test to the chain ([load_test.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/workload.star))
85
-
9. Deploy [Blutgang](https://github.com/rainshowerLabs/blutgang) for load balancing & caching ([cdk_blutgang.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/cdk_blutgang.star))
77
+
| Step Number | Deployment Step | Relevant Starlark Code | Enabled by Default |
| 1 | Deploy a local layer 1 devnet chain |[ethereum.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/ethereum.star)| True |
80
+
| 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 |
81
+
| 3 | Deploy the zkEVM node and CDK peripheral databases |[databases.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/databases.star)| True |
82
+
| 4 | Deploy the CDK central environment |[cdk_central_environment.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/cdk_central_environment.star)| True |
83
+
| 5 | Deploy the bridge infrastructure |[cdk_bridge_infrastructure.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/cdk_bridge_infra.star)| True |
84
+
| 6 | Deploy the permissionless node |[zkevm_permissionless_node.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/zkevm_permissionless_node.star)| False |
85
+
| 7 | Deploy the observability stack |[observability.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/observability.star)| True |
86
+
| 8 | Deploy the block explorer |[blockscout.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/blockscout.star)| False |
87
+
| 9 | Apply a load test to the chain |[load_test.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/workload.star)| False |
You can customize (or skip) the logic for each of these steps by modifying the logic in the respective files.
88
91
@@ -94,17 +97,137 @@ You can modify each of these parameters to customize the chain to your specific
94
97
95
98
## Running the Chain Locally
96
99
97
-
Use the [kurtosis clean](https://docs.kurtosis.com/clean)and [kurtosis run](https://docs.kurtosis.com/run) commands to begin the deployment process. Run the following commands to begin executing the `main.star` script and start the deployment process:
100
+
First run the [kurtosis clean](https://docs.kurtosis.com/clean) to remove any existing Kurtosis environments:
98
101
99
102
```bash
100
103
kurtosis clean --all
101
-
kurtosis run --enclave cdk-v1 --args-file params.yml --image-download always .
102
104
```
103
105
104
-
This command typically takes around 10 minutes to complete. It will output the logs of each step in the deployment process, allowing you to monitor the progress of the chain setup.
106
+
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:
107
+
108
+
```bash
109
+
kurtosis run --enclave cdk-v1 --args-file params.yml --image-download always .
110
+
```
105
111
106
112
!!! info
107
113
108
-
- `--encalve cdk-v1` specifies the name of the [enclave](https://docs.kurtosis.com/advanced-concepts/enclaves/) (isolated environment) to use for the deployment process.
114
+
- `--enclave cdk-v1` specifies the name of the [enclave](https://docs.kurtosis.com/advanced-concepts/enclaves/) (isolated environment) to use for the deployment process.
109
115
- `--args-file params.yml` specifies the configuration file to use for the deployment process.
110
116
- `--image-download always` specifies to always download the latest Docker images for the deployment process.
117
+
118
+
This command typically takes around 10 minutes 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:
119
+
120
+
```bash
121
+
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`.
178
+
179
+
### Load Testing the Chain
180
+
181
+
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:
A common way to check the status of the system is to ensure that batches are being sent and verified on the L1 chain.
190
+
191
+
Use `cast` to view the progression of batches from trusted, virtual, and verified states:
192
+
193
+
```bash
194
+
cast rpc zkevm_batchNumber # Latest batch number on the L2
195
+
cast rpc zkevm_virtualBatchNumber # Latest batch received on the L1
196
+
cast rpc zkevm_verifiedBatchNumber # Latest batch verified or "proven" on the L1
197
+
```
198
+
199
+
### Opening the Bridge UI
200
+
201
+
To open the bridge interface and bridge tokens across the L1 and L2, run the following command:
202
+
203
+
```bash
204
+
open $(kurtosis port print cdk-v1 zkevm-bridge-proxy-001 bridge-interface)
205
+
```
206
+
207
+
### Viewing Chain Metrics
208
+
209
+
To view information such as how many transactions are being processed, the amount of gas being used, the time since a batch was last verified, how many addresses have bridged, and much more, a Grafana dashboard is included in the deployed observability stack which can be opened by running the following command:
210
+
211
+
```bash
212
+
open $(kurtosis port print cdk-v1 grafana-001 dashboards)
213
+
```
214
+
215
+
From the hamburger menu, navigate to `Dashboards` and select the `Panoptichain` dashboard to view all of the metrics.
216
+
217
+

218
+
219
+
### Stopping the Chain
220
+
221
+
If you want to **stop** the chain and remove all the containers, run the following command:
222
+
223
+
```bash
224
+
kurtosis clean --all
225
+
```
226
+
227
+
## Going to Production
228
+
229
+
While it is possible to run a CDK chain on your own, we strongly recommend getting in touch with one of our [Implementation Providers](https://ecosystem.polygon.technology/spn/cdk/) for production deployments.
230
+
231
+
## Dive Deeper into the CDK
232
+
233
+
For more detailed information on the CDK’s architecture, components, and how to customize your chain, refer to the [CDK architecture documentation](https://docs.polygon.technology/cdk/architecture/cdk-zkevm/).
Copy file name to clipboardExpand all lines: docs/cdk/overview.md
+16-4Lines changed: 16 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,28 @@
1
-
The Polygon Chain Development Kit (CDK) is an open-source stack to build layer 2 blockchains powered by zero-knowledge (ZK) proofs.
1
+
The Polygon Chain Development Kit (CDK) is an open-source stack to build sovereign layer 2 blockchains powered by zero-knowledge (ZK) proofs.
2
2
3
-
It consists of several modular components, many of which are used to power the Polygon zkEVM in production today, that are designed to be fully composable; empowering developers to customize each component and build a chain that meets their specific needs.
3
+
It consists of modular componentsdesigned to be fully composable; empowering developers to customize each aspect of their chain to meet their specific needs.
4
4
5
-
## Why Build With the CDK?
5
+
## What is the CDK?
6
+
7
+
## CDK Features
8
+
9
+
-**Scalability**: todo
10
+
11
+
-**Sovereignity**: todo
12
+
13
+
-**Modularity**: todo
14
+
15
+
-**Interoperability**: todo
16
+
17
+
## Why Use the CDK?
6
18
7
19
The CDK bootstraps the development process of creating a layer 2 blockchain. Developers can easily set up the stack and begin configuring each component’s behavior with a fast feedback loop on a local development environment.
8
20
9
21
As logic is separated into modular components, developers can easily swap out components in a "plug and play" fashion to customize their chain, for example, by replacing entire components such as the data availability layer, or making granular-level configurations to each component; such as modifying the sequencer logic to comply with legal regulations.
10
22
11
23
### Tap Into the AggLayer
12
24
13
-
By default, CDK chains are opted into the Aggregation Layer (AggLayer) which enables cross-chain transactions among other L2 chains that are also opted into the AggLayer including the Polygon zkEVM.
25
+
By default, CDK chains are opted into the Aggregation Layer (AggLayer) which enables cross-chain transactions among other L2 chains that are also opted into the AggLayer, including the [Polygon zkEVM](https://docs.polygon.technology/zkEVM/).
14
26
15
27
This provides a powerful network effect by enabling users to interact with smart contracts on your chain without having to manually bridge assets to it. This is especially useful for developers looking to bootstrap their chain’s ecosystem and have immediate access to a large pool of users and liquidity.
0 commit comments