Deploy a Polygon cdk Validium with Avail DA
Discover how to utilize Avail as a data availability layer.
Introduction
Prerequisites:
- CPU: 4 CPUs, amd64
- Memory: 32 GB
- Storage: 100 GB
- OS: Linux
| Software | Version |
|---|---|
| Git | OS Default |
| Docker | Latest |
| Docker Compose | Latest |
| Kurtosis | Latest |
| GO | Latest |
| Make | OS Default |
| Polygon-cli | Latest |
| Foundry | Latest |
Deploying CDK with AvailDA on Local
1. Build CDK image
git clone https://github.com/availproject/cdk.git
cd cdk
git checkout avail-develop-v0.5.3-rc1
make build-docker
docker tag cdk availproject/cdk:avail-develop-v0.5.3-rc12. Build cdk-zkevm-contracts image with mock AvailDABridge and proof verification
git clone https://github.com/availproject/kurtosis-cdk.git
cd kurtosis-cdk/docker
git checkout avail-develop-v0.3.4
docker build . \
--tag availproject/cdk-zkevm-contracts:avail-develop-v9.0.0-rc.6-pp-fork.12 \
--build-arg ZKEVM_CONTRACTS_BRANCH=mock-bridge-avail-develop-v9.0.0-rc.6-pp \
--build-arg POLYCLI_VERSION="v0.1.73" \
--build-arg FOUNDRY_VERSION=stable \
--file zkevm-contracts.Dockerfile3. Add AvailDA config values in cdk-node-config.toml
cd kurtosis-cdk/templates/trusted-node
vim cdk-node-config.tomlSeed Phrase and appID. Other information are prefilled for you.
4. Run local CDK chain with AvailDA using Kurtosis-cdk
cd kurtosis-cdk
kurtosis run --enclave cdk .5. Chain is up and running
- First export the RPC URL of your L2 to an environment variable called
ETH_RPC_URL:
export ETH_RPC_URL="$(kurtosis port print cdk cdk-erigon-sequencer-001 rpc)"- Use
castto view information about the chain:
cast block-number- To View the balance of a pre-funded admin account:
cast balance --ether 0xE34aaF64b29273B7D567FCFc40544c014EEe9970cdk-node-001, use kurtosis service logs -f <enclave-name> <service-id>
Deploying CDK with AvailDA on Sepolia
1. Build CDK image
git clone https://github.com/availproject/cdk.git
git checkout avail-develop-v0.5.3-rc1
make build-docker
docker tag cdk availproject/cdk:avail-develop-v0.5.3-rc12. Build cdk-zkevm-contracts image with Sepolia AvailDABridge and proof verification
git clone https://github.com/availproject/kurtosis-cdk.git
git checkout avail-develop-v0.3.4
cd kurtosis-cdk/docker
docker build . \
--tag availproject/cdk-zkevm-contracts:avail-develop-v9.0.0-rc.6-pp-fork.12 \
--build-arg ZKEVM_CONTRACTS_BRANCH=avail-develop-v9.0.0-rc.6-pp \
--build-arg POLYCLI_VERSION="v0.1.73" \
--build-arg FOUNDRY_VERSION=stable \
--file zkevm-contracts.Dockerfile3. Modify Deployment scalability
kurtosis-cdk:
if sed --version 2>/dev/null | grep -q GNU; then
sed -i 's/"salt": "0x.*",/"salt": "0x'$(xxd -p < /dev/random | tr -d "\n" | head -c 64)'",/' templates/contract-deploy/deploy_parameters.json
else
sed -i '' 's/"salt": "0x.*",/"salt": "0x'$(xxd -p < /dev/random | tr -d "\n" | head -c 64)'",/' templates/contract-deploy/deploy_parameters.json
fi4. Change Finality Time for erigon
if sed --version 2>/dev/null | grep -q GNU; then
sed -i 's/zkevm.l1-highest-block-type: finalized/zkevm.l1-highest-block-type: latest/' templates/cdk-erigon/config.yml
else
sed -i '' 's/zkevm.l1-highest-block-type: finalized/zkevm.l1-highest-block-type: latest/' templates/cdk-erigon/config.yml
fi5. Deploy CDK to Sepolia file
deploy-cdk-to-sepolia.yml from /kurtosis-cdk/.github/tests/external-l1/deploy-cdk-to-sepolia.yml or this link. Name this file as params.yml in your cdk directory.
Now you need to set necessary configs for deploying to Sepolia. You can do this by running the following command L1 Configs:
## L1 Config
l1_chain_id: 11155111
# TODO: Create another mnemonic seed phrase for running the contract deployment on L1.
l1_preallocated_mnemonic: CHANGE_ME
# TODO: Adjust the amount of ETH you want to spend on this deployment.
l1_funding_amount: 5ether
# TODO: Configure the L1 RPC URLs to be valid Sepolia endpoints.
l1_rpc_url: CHANGE_ME
l1_ws_url: CHANGE_MEseed="film crazy inform bind stomach weather cruel hold quarter stage country purpose"
polycli wallet inspect --mnemonic "$seed" --addresses 9 | \
jq -r '.Addresses[] | [.ETHAddress, .HexPrivateKey] | @tsv' | \
awk 'BEGIN{split("sequencer,aggregator,claimtxmanager,timelock,admin,loadtest,agglayer,dac,proofsigner",roles,",")} {print "zkevm_l2_" roles[NR] "address: \"" $1 "\""; print "zkevm_l2" roles[NR] "_private_key: \"0x" $2 "\"\n"}'6. Add AvailDA config values in cdk-node-config.toml
cd kurtosis-cdk/templates/trusted-node
vim cdk-node-config.tomlSeed Phrase and appID. Other information are prefilled for you.
7. Run deployment to Sepolia with AvailDA using Kurtosis-cdk
cd kurtosis-cdk
kurtosis run --enclave cdk . --args-file ./params.yml8. Chain is up and running
Enable DA attestation verification over Avail Bridge (optional)
1. Enable the bridge verification on CDK node
bridge_enabled in kurtosis-cdk/templates/trusted-node for sequencer-sender and aggregator component of CDK, Make it true
2. Enable the bridge verification on AvailAttestation contract
cast send <availAttestationAddress> "setAvailBridgeVerificationEnabled(bool)" true \
--private-key <key> \
--rpc-url https://sepolia.drpc.orgNote
This feature is available for both local and Sepolia deployment, and have these same steps to follow
How is this guide?
IntroductionPrerequisites:Deploying CDK with AvailDA on Local1. Build CDK image2. Build cdk-zkevm-contracts image with mock AvailDABridge and proof verification3. Add AvailDA config values in
cdk-node-config.toml4. Run local CDK chain with AvailDA using Kurtosis-cdk5. Chain is up and runningDeploying CDK with AvailDA on Sepolia1. Build CDK image2. Build cdk-zkevm-contracts image with Sepolia AvailDABridge and proof verification3. Modify Deployment scalability4. Change Finality Time for erigon5. Deploy CDK to Sepolia file6. Add AvailDA config values in cdk-node-config.toml7. Run deployment to Sepolia with AvailDA using Kurtosis-cdk8. Chain is up and runningEnable DA attestation verification over Avail Bridge (optional)1. Enable the bridge verification on CDK node2. Enable the bridge verification on AvailAttestation contract