Skip to content

Commit e50ba3e

Browse files
committed
pushing all changes
2 parents 5f02d52 + 8251ef9 commit e50ba3e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2839
-132
lines changed

docs/cdk/concepts/dac.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
A data availability committee (DAC) is an offchain network of nodes that provides data to a blockchain network. The advantages are:
1+
!!! note
2+
fix this: https://medium.com/coinmonks/what-is-data-availability-and-why-do-we-need-it-7993c039fc44
3+
4+
5+
A data availability committee (DAC) is an optional offchain network of nodes that provides data to a blockchain network. The advantages are:
26

37
- **Lower transaction fees**: Reduced computational requirements lead to lower fees.
48
- **State privacy**: A secure copy of state transitions ensures data integrity and privacy.

docs/cdk/edge-suggestion.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@ https://github.com/0xPolygon/polygon-edge
66

77
Into a `docs` directory which spins up how it looks currently in the wiki as a docusaurus site, or we can create a simpler static site if required. We can also review and edit like we're doing here but it might not be priority.
88

9-
To discuss with Gabriel.
9+
We could do something simple that spins up a site in github pages and then leave it to them. I can do this next.
10+
11+
https://polygon.atlassian.net/browse/TKDW-19
1012

docs/cdk/get-started/deploy-validium.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
!!! important "Recommendation"
2-
Follow the [Quickstart](quickstart.md) for a hands-on introduction to CDK in validium mode.
2+
Follow the [Quickstart](quickstart-validium.md) for a hands-on introduction to CDK in validium mode.
33

44
Follow the steps below to deploy a CDK validium instance.
55

docs/cdk/get-started/overview.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
1-
Polygon's Chain Development Kit (CDK) is a software tool for blockchain developers which allows easy install and configuration of a variety of chain architectures.
1+
Polygon's Chain Development Kit (CDK) is a modular, open source software tool for blockchain developers which supports installation and configuration of a variety of chain architectures.
22

3-
!!! warning
4-
- At the time of writing, the CDK only supports validium nodes. The CDK in validium mode is in active development, with ongoing feature enhancements and issue resolutions.
5-
6-
For the latest updates, follow our official GitHub repositories:
3+
!!! important
4+
At the time of writing, CDK offers rollup and validium configurations.
75

8-
- [Node](https://github.com/0xPolygon/cdk-validium-node)
9-
- [Data availability](https://github.com/0xPolygon/cdk-data-availability)
10-
- [Contracts](https://github.com/0xPolygon/cdk-validium-contracts)
11-
- CDK zkEVM-rollup mode is in development.
6+
CDK users choose a chain architecture specific to their needs and use cases.
127

13-
![CDK flavors](../../img/cdk/cdk-modes.jpg)
8+
<center>
9+
![CDK flavors](../../img/cdk/cdk-modes.png)
10+
</center>
11+
12+
!!! info
13+
For the latest updates, follow our official GitHub repositories.
14+
15+
- [Rollup node](https://github.com/0xPolygonHermez/zkevm-node)
16+
- [Validium node](https://github.com/0xPolygon/cdk-validium-node)
17+
- [Data availability committee](https://github.com/0xPolygon/cdk-data-availability)
18+
- [zkEVM smart contracts](https://github.com/0xPolygonHermez/zkevm-contracts)
19+
- [Validium smart contracts](https://github.com/0xPolygon/cdk-validium-contracts)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Spin up an zkEVM ...
2+
3+
Then ...
Lines changed: 70 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,59 @@
1+
This quickstart guides you through the process of setting up a CDK validium on your local machine.
12

3+
!!! danger "Is it true?"
4+
Please note that the current Data Availability (DA) configuration in Polygon CDK is using a Data Availability Committee (DAC) node with a local Geth client as the L1. However, the integration with Layer 1 testnets, including Sepoilla, is actively being pursued.
25

3-
!!! info
4-
Please view the third-party content disclaimer [<ins>here</ins>](https://github.com/0xPolygon/wiki/blob/master/CONTENT_DISCLAIMER.md).
5-
6-
This tutorial will guide you through the process of setting up a CDK Validium on your local machine using the deployment guidance of [<ins>Snapchain</ins>](https://www.snapchain.dev/).
7-
8-
Please note that the current Data Availability (DA) configuration in Polygon CDK is using a Data Availability Committee (DAC) node with a local Geth client as the L1. However, the integration with Layer 1 testnets, including Sepoilla, is actively being pursued.
9-
10-
The CDK Validium is actively being developed, with ongoing feature enhancements and issue resolutions. For the latest updates, follow our official GitHub repositories.
11-
12-
- [<ins>Node</ins>](https://github.com/0xPolygon/cdk-validium-node)
13-
- [<ins>Data availability</ins>](https://github.com/0xPolygon/cdk-data-availability)
14-
- [<ins>Contracts</ins>](https://github.com/0xPolygon/cdk-validium-contracts)
15-
16-
New features and refinements are designed to enhance user experience without disrupting ongoing activities.
17-
18-
:::
19-
20-
## What you'll learn
21-
22-
In this tutorial, you'll quickly dive into the world of Polygon CDK. You'll learn to set up and run a local CDK-based chain, enabling you to:
23-
24-
- Gain a rapid understanding of Polygon CDK.
25-
- Test smart contracts.
26-
- Execute web3 transactions.
27-
- Investigate network capabilities.
28-
29-
## What you'll need
30-
31-
This tutorial requires Docker and Docker Compose. They allow you to run multiple services in separate environments. If you haven't installed these tools yet, you can do so by following the guides at the following links:
6+
## Prerequisites
327

33-
- [<ins>Docker</ins>](https://www.docker.com/get-started)
34-
- [<ins>Docker Compose</ins>](https://docs.docker.com/compose/install/)
8+
### System requirements
359

36-
### Recommended System Requirements
10+
- A Linux-based OS (e.g., Ubuntu Server 22.04 LTS).
11+
- At least 16GB RAM with a 4-core CPU.
12+
- An AMD64 architecture system.
3713

38-
Ensure that your system meets the following recommended specifications before starting this tutorial:
14+
!!! warning
15+
CDK does not support ARM-based Macs
3916

40-
- A Linux-based OS (e.g., Ubuntu Server 22.04 LTS)
41-
- At least 16GB RAM with a 4-core CPU
42-
- An AMD64 architecture system
17+
### Software requirements
4318

44-
:::caution Does not yet support ARM-based Macs
19+
- [Docker](https://www.docker.com/get-started)
20+
- [Docker Compose](https://docs.docker.com/compose/install/)
4521

46-
:::
22+
## 1. Clone the repo
4723

48-
## What You'll Do
49-
50-
In this tutorial, you'll go through the following steps. Make sure to follow each section in order if this is your first time setting up a zkValidium.
51-
52-
1. [<ins>Download Configuration Files</ins>](#step-1-download-configuration-files): You'll start by downloading necessary configuration files from our repository.
53-
2. [<ins>Launch the Validium Locally</ins>](#step-2-launch-the-validium-locally): After setting up your workspace, you'll launch the zkValidium on your local machine and ensure all services are running properly.
54-
3. [<ins>Test the Validium</ins>](#step-3-test-the-validium): With your local CDK Validium running, you'll verify its functionalities, including testing block explorers and making transactions.
55-
4. [<ins>Test the Bridge</ins>](#step-4-test-the-bridge): In this section, you will test using the native bridges to transfer assets between the L1 and L2.
56-
57-
## Step 1: Download Configuration Files
58-
59-
The first step involves downloading the necessary configuration files from our repository. Run the following commands in your terminal to clone the repository and navigate into it:
24+
Run the following commands:
6025

6126
```bash
6227
git clone https://github.com/Snapchain/zkValidium-quickstart.git
6328
cd zkValidium-quickstart
6429
```
6530

66-
Create the `.env` file by copying from the example:
31+
Create the `.env` file by copying the example:
6732
```bash
6833
cp .env.example .env
6934
```
7035

71-
The repository includes these key files:
72-
73-
- `Docker-compose.yml`: This Docker Compose file defines all the necessary containers to set up the CDK Validium.
74-
- `Makefile`: This file includes a series of commands that will help you manage your CDK Validium node.
75-
- `config`: This folder contains configuration files required for the CDK Validium.
76-
77-
## Step 2: Launch the Validium Locally
36+
## 2. Launch validium locally
7837

79-
With the repository cloned and your working directory set, let's start up the CDK Validium. First, you'll need to pull the necessary Docker images from Docker Hub:
38+
2.1 Pull the required Docker images from Docker Hub:
8039

8140
```bash
82-
docker-compose pull
41+
sudo docker-compose pull
8342
```
8443

85-
After pulling the images, you can start your local CDK Validium:
44+
2.2 After pulling the images, start your local CDK Validium:
8645

8746
```bash
88-
make run
47+
sudo make run
8948
```
9049

91-
To ensure all services are running properly, check the status of each container:
50+
2.3 To ensure all services are running properly, check the status of each container:
9251

9352
```bash
9453
docker-compose ps
9554
```
9655

97-
You will see results similar to the following:
56+
You should see the following output:
9857

9958
<details>
10059
<summary>Container status details ↓</summary>
@@ -139,156 +98,154 @@ zkevm-bridge-ui /bin/sh /app/scripts/deploy.sh Up
13998
```
14099
</details>
141100

142-
If any service isn't running (i.e., in Exit 1 state), you can investigate further using the logs:
101+
2.3.1 If a service isn't running (i.e. it is in Exit 1 state), investigate further using the logs:
143102

144103
```bash
145-
docker-compose logs <container_name>
104+
sudo docker-compose logs <container_name>
146105
```
147106

148-
Note: `<container_name>` can be found in results above.
107+
!!! info
108+
Find the `<container_name>` in the log output.
149109

110+
2.4 Useful commands
150111

151-
To stop the zkValidium, use:
112+
To stop CDK validium, use:
152113

153114
```bash
154-
make stop
115+
sudo make stop
155116
```
156117

157-
And to restart all the services:
118+
To restart all services:
158119

159120
```bash
160-
make restart
121+
sudo make restart
161122
```
162123

163-
## Step 3: Test the Validium
124+
## 3. Test validium
164125

165-
Congratulations! Your local zkValidium is now up and running. Let's test its functionalities.
126+
3.1 Verify the block explorer is running by navigating to [localhost:4001](http://localhost:4001/).
166127

167-
First, verify the block explorer by navigating to [localhost:4001](http://localhost:4001/). You should see a page similar to this:
128+
You should see a page similar to this:
168129

169130
<div align="center">
170131
<img src="/img/cdk/cdk-block-explorer-empty.png" alt="bridge" width="90%" height="30%" />
171132
</div>
172133

173-
<br/>
134+
### 4. Add the network to a Web3 wallet
174135

175-
Now, let's add the network to your Web3 wallet by populating the necessary fields.
176-
> **We'll use MetaMask for our example.**
136+
4.1 Follow MetaMask's instructions on [how to set up a network manually](https://support.metamask.io/hc/en-us/articles/360043227612-How-to-add-a-custom-network-RPC).
177137

178-
- Set the chain ID to be **1001**.
138+
- Set the chain ID to **1001**.
179139
- The currency symbol can be anything but we will use **POL** by default.
180140
- The RPC node and block explorer containers can be found at ports **8123** and **4001**, respectively.
181141

182142
<div align="center">
183143
<img src="/img/cdk/cdk-metamask-add-network.png" alt="bridge" width="90%" height="30%" />
184144
</div>
185145

186-
Next, switch to the new network:
146+
4.2 Switch to the new network:
187147

188148
<div align="center">
189149
<img src="/img/cdk/cdk-metamask-switch-network.png" alt="bridge" width="90%" height="30%" />
190150
</div>
191151

192-
By default, an account with private key `0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80` has been preloaded with tokens.
193-
194-
:::caution NEVER transfer real assets to the address associated with the above private key
195-
:::
152+
!!! danger "Important"
153+
- An account with test funds is available with private key `0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80`.
154+
- NEVER transfer real assets to the address associated with this private key.
196155

197-
Import this account and you will see the balance shown up as 100000 POL:
156+
4.3 [Import the account to MetaMask](https://support.metamask.io/hc/en-us/articles/360015489331-How-to-import-an-account). The balance shows up as 100000 POL:
198157

199158
<div align="center">
200159
<img src="/img/cdk/cdk-metamask-import-account.png" alt="bridge" width="90%" height="30%" />
201160
</div>
202161

203-
You can now try a transaction by transferring some tokens to another account:
162+
4.4 Transfer some tokens to another account:
204163

205164
<div align="center">
206165
<img src="/img/cdk/cdk-metamask-transfer.gif" alt="bridge" width="90%" height="30%" />
207166
</div>
208167

209-
After confirming the transaction, check the updated balances:
168+
4.5 After confirming the transaction, check the updated balances:
210169

211170
<div align="center">
212171
<img src="/img/cdk/cdk-metamask-transfer-result.gif" alt="bridge" width="90%" height="30%" />
213172
</div>
214173

215-
You can also view the transaction details in the block explorer by clicking on the transaction details in MetaMask:
174+
4.6 You can also view the transaction details in the block explorer by clicking on the transaction details in MetaMask:
216175

217176
<div align="center">
218177
<img src="/img/cdk/cdk-tx-view-on-block-explorer.png" alt="bridge" width="90%" height="30%" />
219178
</div>
220179

221-
## Step 4: Test the bridge
180+
## 5. Test the bridge
222181

223-
The CDK stack comes with a native bridge with UI to allow you to transfer fund between the L1 and the L2 validium.
182+
CDK has a native bridge with UI that allows you to transfer funds between the L1 and the L2 validium.
224183

225-
In this section, you will learn how to bridge fund from the L1 to the validium L2 and then bridge it back from the validium to the L1.
184+
### L1 to L2
226185

227-
Before you can bridge any fund from the L1 to the validium L2, you also need to add the L1 RPC to MetaMask similar to what you have done in previous steps:
186+
5.1 Add the L1 RPC to MetaMask:
228187

229188
<div align="center">
230189
<img src="/img/cdk/cdk-metamask-add-l1.png" alt="bridge" width="90%" height="30%" />
231190
</div>
232191

233-
<br/>
192+
5.2 Switch to the L1 network and you will see the previously imported account with ~999 POL on the L1 chain.
234193

235-
Switch to the L1 network and you will see the previously imported account already with ~999 POL on the L1 chain.
194+
5.3 Verify the bridge UI by navigating to [localhost:8088](http://localhost:8088/).
236195

237-
First, verify the bridge UI by navigating to [localhost:8088](http://localhost:8088/). You should see a page similar to this and click on "Connect a wallet > MetaMask":
196+
5.4 Click on **Connect a wallet > MetaMask**.
238197

239198
<div align="center">
240199
<img src="/img/cdk/cdk-bridge.png" alt="bridge" width="90%" height="30%" />
241200
</div>
242201

243-
<br/>
244-
245-
Select the previously imported account (0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266) to connect and once you are connected, you should see a page like this:
202+
5.5 Select the previously imported account (0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266). Once you are connected, you should see a page like this:
246203

247204
<div align="center">
248205
<img src="/img/cdk/cdk-bridge-connected.png" alt="bridge" width="90%" height="30%" />
249206
</div>
250207

251-
<br/>
208+
5.6 Enter the amount (e.g. 5) to bridge and click **Continue**, you will see the **Confirm Bridge** page.
252209

253-
Enter the amount (e.g. 5) to bridge and click "Continue", you will see the "Confirm Bridge" page. Click "Bridge" and approve the transaction on the MetaMask pop-up:
210+
5.7 Click **Bridge** and approve the transaction on the MetaMask pop-up:
254211

255212
<div align="center">
256213
<img src="/img/cdk/cdk-bridge-confirm.png" alt="bridge" width="90%" height="30%" />
257214
</div>
258215

259-
<br/>
260-
261-
Once the bridging is completed, you should see the "Activity" page like this:
216+
5.8 Once bridging is complete, you should see the **Activity** page:
262217

263218
<div align="center">
264219
<img src="/img/cdk/cdk-bridge-completed-l1-to-l2.png" alt="bridge" width="90%" height="30%" />
265220
</div>
266221

267-
<br/>
222+
### L2 to L1
223+
224+
5.9 Switch network on MetaMask to your validium chain and navigate back to [localhost:8088](http://localhost:8088/).
268225

269-
Now let's bridge back the fund from the validium L2 to the L1 chain. Switch network on MetaMask to your validium chain and navigate back to [localhost:8088](http://localhost:8088/). You should see both the updated L1 and L2 balances:
226+
5.10 You should see both the updated L1 and L2 balances:
270227

271228
<div align="center">
272229
<img src="/img/cdk/cdk-bridge-l2-to-l1.png" alt="bridge" width="90%" height="30%" />
273230
</div>
274-
<br/>
275231

276-
Enter an amount (e.g. 1) and follow the same process to bridge the fund back to the L1.
232+
5.11 Enter an amount and follow the same process to bridge the fund back to the L1.
277233

278-
:::caution Note
279-
You cannot bridge back fund more than what you have previously bridged from L1 to the L2.
280-
:::
234+
!!! note
235+
You cannot bridge back fund more than what you have previously bridged from L1 to the L2.
281236

282-
The L2->L1 bridging is slightly different than L1->L2 and you will see the "Activity" page like this after the transaction is executed:
237+
The L2->L1 bridging is slightly different than L1->L2 and you will see the **Activity** page like this after the transaction is executed:
283238

284239
<div align="center">
285240
<img src="/img/cdk/cdk-bridge-l2-to-l1-on-hold.png" alt="bridge" width="90%" height="30%" />
286241
</div>
287-
<br/>
288242

289-
Click "Finalise" and approve the transaction (Note: MetaMask will pop up a window to ask you to switch to the L1 network first). Then you will see this once the bridging is completed:
243+
5.12 Click **Finalise** and approve the transaction (Note: MetaMask will pop up a window to ask you to switch to the L1 network first). Then you will see this once the bridging is completed:
290244

291245
<div align="center">
292246
<img src="/img/cdk/cdk-bridge-l2-to-l1-completed.png" alt="bridge" width="90%" height="30%" />
293247
</div>
294-
<br/>
248+
249+
!!! urgent
250+
- First time, I had an error on step 5.12 -> cannot estimate gas.
251+
- Second time, I had an error much earlier on, but that's probably because I didn't clear the images up, even though I restarted.

0 commit comments

Comments
 (0)