Coder Social home page Coder Social logo

empieicho / kurtosis-cdk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 0xpolygon/kurtosis-cdk

0.0 0.0 0.0 9.17 MB

A Kurtosis package that deploys a private, portable, and modular Polygon CDK devnet

Home Page: https://docs.polygon.technology/cdk

License: Apache License 2.0

Shell 29.30% JavaScript 14.64% Go 2.03% CSS 0.46% Hack 4.17% Dockerfile 2.97% Starlark 46.42%

kurtosis-cdk's Introduction

Polygon CDK Kurtosis Package

A Kurtosis package that deploys a private, portable, and modular Polygon CDK devnet.

Getting Started

Architecture Diagram

To begin, you will need to install Docker and Kurtosis.

You will also need a few other tools. Run this script to check if you have the required versions:

./scripts/tool_check.sh

Once that is good and installed on your system, you can run the following command to deploy the complete CDK stack locally.

This process typically takes around ten minutes.

kurtosis clean --all
kurtosis run --enclave cdk-v1 --args-file params.yml --image-download always .

The command above deploys a CDK stack using zkevm-node as the sequencer. Alternatively, to launch a CDK stack using cdk-erigon as a sequencer, you can run the following command.

kurtosis run --enclave cdk-v1 --args-file cdk-erigon-sequencer-params.yml --image-download always .

Let's do a simple L2 RPC test call.

First, you will need to figure out which port Kurtoiss is using for the RPC. You can get a general feel for the entire network layout by running the following command:

kurtosis enclave inspect cdk-v1

That output, while quite useful, might also be a little overwhelming. If you want to simply see the port mapping within the cdk-v1 enclave for the zkevm-node-rpc service and the trusted-rpc port, you can use the following command. For this test, let's store the RPC URL in an environment variable:

export ETH_RPC_URL="$(kurtosis port print cdk-v1 zkevm-node-rpc-001 http-rpc)"

That is the same environment variable that cast uses, so you should now be able to run this command. Note that the steps below will assume you have the Foundry toolchain installed.

cast block-number

By default, the CDK is configured in test mode, which means there is some pre-funded value in the admin account with address 0xE34aaF64b29273B7D567FCFc40544c014EEe9970.

cast balance --ether 0xE34aaF64b29273B7D567FCFc40544c014EEe9970

Okay let’s send some transactions...

export PK="0x12d7de8621a77640c9241b2595ba78ce443d05e94090365ab3bb5e19df82c625"
cast send --legacy --private-key "$PK" --value 0.01ether 0x0000000000000000000000000000000000000000

Okay let’s send even more transactions... Note that this step will assume you have polygon-cli installed.

polycli loadtest --rpc-url "$ETH_RPC_URL" --legacy --private-key "$PK" --verbosity 700 --requests 500 --rate-limit 5 --mode t
polycli loadtest --rpc-url "$ETH_RPC_URL" --legacy --private-key "$PK" --verbosity 700 --requests 500 --rate-limit 10 --mode t
polycli loadtest --rpc-url "$ETH_RPC_URL" --legacy --private-key "$PK" --verbosity 700 --requests 500 --rate-limit 10 --mode 2
polycli loadtest --rpc-url "$ETH_RPC_URL" --legacy --private-key "$PK" --verbosity 700 --requests 500 --rate-limit 3  --mode uniswapv3

Pretty often, you will want to check the output from the service. Here is how you can grab some logs:

kurtosis service logs cdk-v1 zkevm-agglayer-001

In other cases, if you see an error, you might want to get a shell in the container to be able to poke around.

kurtosis service shell cdk-v1 zkevm-node-sequencer-001

One of the most common ways to check the status of the system is to make sure that batches are going through the normal progression of trusted, virtual, and verified:

cast rpc zkevm_batchNumber
cast rpc zkevm_virtualBatchNumber
cast rpc zkevm_verifiedBatchNumber

If the number of verified batches is increasing, then it means the system works properly.

To access the zkevm-bridge user interface, open this URL in your web browser.

open $(kurtosis port print cdk-v1 zkevm-bridge-proxy-001 web-ui)

When everything is done, you might want to clean up with this command which stops everything and deletes it.

kurtosis clean --all

For more information about the CDK stack and setting up Kurtosis, visit our documentation on the Polygon Knowledge Layer.

Contact

  • For technical issues, join our Discord.
  • For documentation issues, raise an issue on the published live doc at our main repo.

License

Copyright (c) 2024 PT Services DMCC

Licensed under either:

as your option.

The SPDX license identifier for this project is MIT OR Apache-2.0.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

kurtosis-cdk's People

Contributors

praetoriansentry avatar leovct avatar rebelartists avatar kmurphypolygon avatar jhkimqd avatar xavier-romero avatar minhd-vu avatar cffls avatar jarrodwatts avatar djpolygon avatar janbajecdev avatar 0xkryptstein avatar revitteth avatar dependabot[bot] avatar mt-polygon-technology avatar omahs avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.