This is a Kurtosis package that will spin up a CDK-Erigon node, optimized for syncing with any Polygon Hermez zkEVM network. The package is designed to be used for testing, validation and development of the cdk-erigon client. It is not intended for production use.
# Deploy a local CDK-Erigon mainnet node.
$ kurtosis run --enclave cdk-erigon github.com/leovct/kurtosis-cdk-erigon-node
# Equivalent to: kurtosis run --enclave cdk-erigon github.com/leovct/kurtosis-cdk-erigon-node '{chain: mainnet}'
# Alternatively, deploy nodes for other networks.
$ kurtosis run --enclave cdk-erigon github.com/leovct/kurtosis-cdk-erigon-node '{chain: cardona}'
$ kurtosis run --enclave cdk-erigon github.com/leovct/kurtosis-cdk-erigon-node '{chain: bali}'
The list of networks currently supported is available here.
Once the command is executed, observe the output, especially the exposed port (here, 50169), which corresponds to the HTTP-RPC server of the CDK-Erigon node.
...
Starlark code successfully run. No output was returned.
Made with Kurtosis - https://kurtosis.com
INFO[2024-03-05T11:42:06+01:00] ===================================================
INFO[2024-03-05T11:42:06+01:00] || Created enclave: cdk-erigon ||
INFO[2024-03-05T11:42:06+01:00] ===================================================
Name: cdk-erigon
UUID: 86dd2080720e
Status: RUNNING
Creation Time: Tue, 05 Mar 2024 11:42:00 CET
Flags:
========================================= Files Artifacts =========================================
UUID Name
========================================== User Services ==========================================
UUID Name Ports Status
6252397ca95a cdk-erigon-node http_rpc: 8545/tcp -> http://127.0.0.1:50169 RUNNING
Explore logs with:
$ kurtosis service logs cdk-erigon cdk-erigon-node --all --follow
Connect to the node:
$ kurtosis service shell cdk-erigon cdk-erigon-node
Finally, to monitor the node, you can use polycli.
$ polycli monitor --rpc-url http://127.0.0.1:50169
Here are quick steps to ensure your node is synced and working correctly. For this example, we will sync against the Bali Testnet.
First, verify your node sync status.
$ curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' http://127.0.0.1:50169
{"jsonrpc":"2.0","id":1,"result":false}
Second, retrieve the latest block number (e.g. from the local node).
$ cast bn --rpc-url http://127.0.0.1:50169
1285203
Third and finally, compare state roots of local node RPC and sequencer RPC URLs for the latest block. They should match!
$ cast block 1285203 --rpc-url http://127.0.0.1:50169 --json | jq -r .stateRoot
0x54ee9fed29133351f1f49259ab47021fd06816210e1b16d0402de042ffb16e50
$ cast block 1285203 --rpc-url https://rpc.internal.zkevm-rpc.com --json | jq -r .stateRoot
0x54ee9fed29133351f1f49259ab47021fd06816210e1b16d0402de042ffb16e50
To tailor your CDK-Erigon node according to your specific needs, explore and adjust the default configuration file (config.yaml
). This file encompasses crucial parameters such as the target blockchain, zkEVM configurations, and L1 query parameters like block range, query delay, and the initial block for L1 synchronization. Feel free to customize these values and initiate your personalized node.
Here's a step-by-step guide:
- Clone the repository.
$ git clone https://github.com/leovct/kurtosis-cdk-erigon-node.git
$ cd kurtosis-cdk-erigon-node
- Edit the configuration.
$ vi config.yaml
- Start the node with your custom parameters.
$ kurtosis run --enclave cdk-erigon --args-file config.yaml .
Note: The current version of the CDK-Erigon node is based on the zkevm
branch. As soon as Kurtosis supports build-time variables in the Dockerfile (refer to this issue), we will be able to pass the CDK-Erigon node version as a configuration parameter in config.yaml
. This enhancement will provide greater flexibility and ease of configuration for testing CDK-Erigon node versions.
Enhance the versatility of this Kurtosis package by seamlessly integrating a new network.
- Navigate to the
config/network
directory.
$ cd config/networks
- Add your own network configuration. For instance, refer to the existing mainnet configuration file (
config/networks/mainnet.yaml
) as a template.
$ vi my-network.yaml
Note that certain parameters are shared among all CDK-Erigon nodes and are stored in a separate file (config/common.yaml
). This modular approach ensures the simplicity and readability of configurations.
-
Adjust the
chain
parameter, in the configuration file (config.yaml
), to match your network file name (here, it would bemy-network
). -
Start the node for your new network.
$ kurtosis run --enclave cdk-erigon --args-file config.yaml .
Here is the list of networks currently supported. If you wish to add a new one, visit this section.
Network | Rootchain | Configuration File |
---|---|---|
zkEVM Mainnet | Ethereum Mainnet | config/networks/mainnet.yaml |
zkEVM Etrog Testnet | Ethereum Sepolia Testnet | config/networks/etrog.yaml |
zkEVM Cardona Testnet | Ethereum Sepolia Testnet | config/networks/cardona.yaml |
zkEVM Bali Testnet | Ethereum Sepolia Testnet | config/networks/bali.yaml |
X1 Testnet | Ethereum Sepolia Testnet | config/networks/x1-testnet.yaml |