From 53320772529be26914e98faa96cef1f978acbca1 Mon Sep 17 00:00:00 2001 From: Ganesha Upadhyaya Date: Wed, 3 Jan 2024 17:58:28 +0530 Subject: [PATCH 1/6] adjust gm tutorial based on latest rollkit/cosmos-sdk releases and local-celestia-devnet changes --- scripts/gm/init-local.sh | 28 ++++++---------- tutorials/gm-world.md | 69 ++++++++++++++++++---------------------- 2 files changed, 40 insertions(+), 57 deletions(-) diff --git a/scripts/gm/init-local.sh b/scripts/gm/init-local.sh index 873715eeb..46ca3567a 100644 --- a/scripts/gm/init-local.sh +++ b/scripts/gm/init-local.sh @@ -9,9 +9,6 @@ CHAINFLAG="--chain-id ${CHAIN_ID}" TOKEN_AMOUNT="10000000000000000000000000stake" STAKING_AMOUNT="1000000000stake" -# create a random Namespace ID for your rollup to post blocks to -NAMESPACE=$(openssl rand -hex 8) - # query the DA Layer start height, in this case we are querying # our local devnet at port 26657, the RPC. The RPC endpoint is # to allow users to interact with Celestia's nodes by querying @@ -52,7 +49,7 @@ cat <<'EOF' EOF # echo variables for the chain -echo -e "\n\n\n\n\n Your NAMESPACE is $NAMESPACE \n\n Your DA_BLOCK_HEIGHT is $DA_BLOCK_HEIGHT \n\n\n\n\n" +echo -e "\n\n\n\n\n Your DA_BLOCK_HEIGHT is $DA_BLOCK_HEIGHT \n\n\n\n\n" # build the gm chain with Rollkit ignite chain build @@ -68,36 +65,29 @@ gmd keys add $KEY_NAME --keyring-backend test gmd keys add $KEY_2_NAME --keyring-backend test # add these as genesis accounts -gmd add-genesis-account $KEY_NAME $TOKEN_AMOUNT --keyring-backend test -gmd add-genesis-account $KEY_2_NAME $TOKEN_AMOUNT --keyring-backend test +gmd genesis add-genesis-account $KEY_NAME $TOKEN_AMOUNT --keyring-backend test +gmd genesis add-genesis-account $KEY_2_NAME $TOKEN_AMOUNT --keyring-backend test # set the staking amounts in the genesis transaction -gmd gentx $KEY_NAME $STAKING_AMOUNT --chain-id $CHAIN_ID --keyring-backend test +gmd genesis gentx $KEY_NAME $STAKING_AMOUNT --chain-id $CHAIN_ID --keyring-backend test # collect genesis transactions -gmd collect-gentxs +gmd genesis collect-gentxs # copy centralized sequencer address into genesis.json # Note: validator and sequencer are used interchangeably here ADDRESS=$(jq -r '.address' ~/.gm/config/priv_validator_key.json) PUB_KEY=$(jq -r '.pub_key' ~/.gm/config/priv_validator_key.json) -jq --argjson pubKey "$PUB_KEY" '. + {"validators": [{"address": "'$ADDRESS'", "pub_key": $pubKey, "power": "1000", "name": "Rollkit Sequencer"}]}' ~/.gm/config/genesis.json > temp.json && mv temp.json ~/.gm/config/genesis.json - -# export the Celestia light node's auth token to allow you to submit -# PayForBlobs to Celestia's data availability network -# this is for Arabica, if using another network, change the network name -AUTH_TOKEN=$(docker exec $(docker ps -q) celestia bridge --node.store /home/celestia/bridge/ auth admin) +jq --argjson pubKey "$PUB_KEY" '.consensus["validators"]=[{"address": "'$ADDRESS'", "pub_key": $pubKey, "power": "1000", "name": "Rollkit Sequencer"}]' ~/.gm/config/genesis.json > temp.json && mv temp.json ~/.gm/config/genesis.json # create a restart-local.sh file to restart the chain later [ -f restart-local.sh ] && rm restart-local.sh echo "DA_BLOCK_HEIGHT=$DA_BLOCK_HEIGHT" >> restart-local.sh -echo "NAMESPACE=$NAMESPACE" >> restart-local.sh -echo "AUTH_TOKEN=$AUTH_TOKEN" >> restart-local.sh -echo "gmd start --rollkit.aggregator true --rollkit.da_layer celestia --rollkit.da_config='{\"base_url\":\"http://localhost:26658\",\"timeout\":60000000000,\"fee\":600000,\"gas_limit\":6000000,\"auth_token\":\"'\$AUTH_TOKEN'\"}' --rollkit.namespace_id \$NAMESPACE --rollkit.da_start_height \$DA_BLOCK_HEIGHT --rpc.laddr tcp://127.0.0.1:36657 --p2p.laddr \"0.0.0.0:36656\"" >> restart-local.sh +echo "gmd start --rollkit.aggregator true --rollkit.da_address=":26650" --rollkit.da_start_height \$DA_BLOCK_HEIGHT --rpc.laddr tcp://127.0.0.1:36657 --p2p.laddr \"0.0.0.0:36656\"" >> restart-local.sh # start the chain -gmd start --rollkit.aggregator true --rollkit.da_layer celestia --rollkit.da_config='{"base_url":"http://localhost:26658","timeout":60000000000,"fee":600000,"gas_limit":6000000,"auth_token":"'$AUTH_TOKEN'"}' --rollkit.namespace_id $NAMESPACE --rollkit.da_start_height $DA_BLOCK_HEIGHT --rpc.laddr tcp://127.0.0.1:36657 --p2p.laddr "0.0.0.0:36656" +gmd start --rollkit.aggregator true --rollkit.da_address=":26650" --rollkit.da_start_height $DA_BLOCK_HEIGHT --rpc.laddr tcp://127.0.0.1:36657 --p2p.laddr "0.0.0.0:36656" # uncomment the next command if you are using lazy aggregation -# gmd start --rollkit.aggregator true --rollkit.da_layer celestia --rollkit.da_config='{"base_url":"http://localhost:26658","timeout":60000000000,"fee":600000,"gas_limit":6000000,"auth_token":"'$AUTH_TOKEN'"}' --rollkit.namespace_id $NAMESPACE --rollkit.da_start_height $DA_BLOCK_HEIGHT --rollkit.lazy_aggregator +# gmd start --rollkit.aggregator true --rollkit.da_address=":26650" --rollkit.da_start_height $DA_BLOCK_HEIGHT --rollkit.lazy_aggregator diff --git a/tutorials/gm-world.md b/tutorials/gm-world.md index 3c7829307..c2318bef7 100644 --- a/tutorials/gm-world.md +++ b/tutorials/gm-world.md @@ -49,8 +49,8 @@ to say GM, Gm, or gm. You can think of "GM" as the new version of ## Dependencies {#dependencies} * Operating systems: GNU/Linux or macOS -* [Golang 1.20+](https://go.dev) -* [Ignite CLI v0.27.1](https://github.com/ignite/cli) +* [Golang 1.21+](https://go.dev) +* [Ignite CLI v28.1.0](https://github.com/ignite/cli) * [Homebrew](https://brew.sh) * [wget](https://www.gnu.org/software/wget) * [A Celestia Light Node](https://docs.celestia.org/nodes/light-node) @@ -86,7 +86,7 @@ sudo mkdir -p -m 775 /usr/local/bin Run this command in your terminal to install Ignite CLI: ```bash -curl https://get.ignite.com/cli@v0.27.1! | bash +curl https://get.ignite.com/cli@v28.1.0! | bash ``` ::: tip @@ -97,13 +97,13 @@ You can resolve this error by following the guidance ```bash # Error -jcs @ ~ % curl https://get.ignite.com/cli@v0.27.1! | bash +jcs @ ~ % curl https://get.ignite.com/cli@v28.1.0! | bash % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 3967 0 3967 0 0 16847 0 --:--:-- --:--:-- --:--:-- 17475 -Installing ignite v0.27.1..... // [!code focus] +Installing ignite v28.1.0..... // [!code focus] ######################################################################## 100.0% // [!code focus] mv: rename ./ignite to /usr/local/bin/ignite: Permission denied // [!code focus] ============ // [!code focus] @@ -113,7 +113,7 @@ Error: mv failed // [!code focus] The following command will resolve the permissions error: ```bash -sudo curl https://get.ignite.com/cli@v0.27.1! | sudo bash +sudo curl https://get.ignite.com/cli@v28.1.0! | bash ``` A successful installation will return something similar to the response below: @@ -122,7 +122,7 @@ A successful installation will return something similar to the response below: % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 4073 0 4073 0 0 4363 0 --:--:-- --:--:-- --:--:-- 4379 -Installing ignite v0.27.1..... // [!code focus] +Installing ignite v28.1.0..... // [!code focus] ######################################################################## 100.0% // [!code focus] Password: Installed at /usr/local/bin/ignite // [!code focus] @@ -138,15 +138,15 @@ The response that you receive should look something like this: ```bash jcs @ ~ % ignite version // [!code focus] -Ignite CLI version: v0.27.1 // [!code focus] -Ignite CLI build date: 2023-06-13T13:42:09Z -Ignite CLI source hash: 4acd1f185afb6d8d1a837e54f04c091121cfae01 +Ignite CLI version: v28.1.0 // [!code focus] +Ignite CLI build date: 2023-12-23T08:29:07Z +Ignite CLI source hash: 4bb56d0cf73d16303221d8d1ffdd3ec395682813 Ignite CLI config version: v1 -Cosmos SDK version: v0.47.3 +Cosmos SDK version: v0.50.1 Your OS: darwin Your arch: arm64 Your Node.js version: v20.4.0 -Your go version: go version go1.20.2 darwin/arm64 +Your go version: go version go1.21.5 darwin/arm64 Your uname -a: Darwin Joshs-MacBook-Air.local 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun 8 22:21:34 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T8112 arm64 Your cwd: /Users/joshstein Is on Gitpod: false @@ -183,7 +183,7 @@ sudo mkdir -p -m 775 /usr/local/bin Run this command in your terminal to install Ignite CLI: ```bash -curl https://get.ignite.com/cli@v0.27.1! | bash +curl https://get.ignite.com/cli@v28.1.0! | bash ``` ::: tip @@ -194,13 +194,13 @@ You can resolve this error by following the guidance ```bash # Error -jcs @ ~ % curl https://get.ignite.com/cli@v0.27.1! | bash +jcs @ ~ % curl https://get.ignite.com/cli@v28.1.0! | bash % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 3967 0 3967 0 0 16847 0 --:--:-- --:--:-- --:--:-- 17475 -Installing ignite v0.27.1..... // [!code focus] +Installing ignite v28.1.0..... // [!code focus] ######################################################################## 100.0% // [!code focus] mv: rename ./ignite to /usr/local/bin/ignite: Permission denied // [!code focus] ============ // [!code focus] @@ -210,7 +210,7 @@ Error: mv failed // [!code focus] The following command will resolve the permissions error: ```bash -sudo curl https://get.ignite.com/cli@v0.27.1! | sudo bash +sudo curl https://get.ignite.com/cli@v28.1.0! | sudo bash ``` A successful installation will return something similar the response below: @@ -219,7 +219,7 @@ A successful installation will return something similar the response below: % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 3967 0 3967 0 0 15586 0 --:--:-- --:--:-- --:--:-- 15931 -Installing ignite v0.27.1..... // [!code focus] +Installing ignite v28.1.0..... // [!code focus] ######################################################################## 100.0% // [!code focus] Installed at /usr/local/bin/ignite // [!code focus] ``` @@ -234,15 +234,15 @@ The response that you receive should look something like this: ```bash jcs @ ~ % ignite version // [!code focus] -Ignite CLI version: v0.27.1 -Ignite CLI build date: 2023-06-13T13:42:09Z -Ignite CLI source hash: 4acd1f185afb6d8d1a837e54f04c091121cfae01 +Ignite CLI version: v28.1.0 +Ignite CLI build date: 2023-12-23T08:29:07Z +Ignite CLI source hash: 4bb56d0cf73d16303221d8d1ffdd3ec395682813 Ignite CLI config version: v1 -Cosmos SDK version: v0.47.3 +Cosmos SDK version: v0.50.1 Your OS: darwin Your arch: arm64 Your Node.js version: v20.4.0 -Your go version: go version go1.20.2 darwin/arm64 +Your go version: go version go1.21.5 darwin/arm64 Your uname -a: Darwin Joshs-MacBook-Air.local 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun 8 22:21:34 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T8112 arm64 Your cwd: /Users/joshstein Is on Gitpod: false @@ -301,23 +301,18 @@ this process can be done on any machine of your choosing. We tested out the Devn First, run the [`local-celestia-devnet`](https://github.com/rollkit/local-celestia-devnet) by running the following command: ```bash -docker run -i -t --platform linux/amd64 -p 26657:26657 -p 26658:26658 -p 26659:26659 ghcr.io/rollkit/local-celestia-devnet:v0.11.0 +docker run -t -i \ + -p 26650:26650 -p 26657:26657 -p 26658:26658 -p 26659:26659 -p 9090:9090 \ + ghcr.io/rollkit/local-celestia-devnet:v0.12.5 ``` -When passing the `--rollkit.da_config` flag later in the tutorial, -it will require `auth_token` to be passed in. The auth token with -write permission is required to submit blobs and can be obtained -with the following command once your local-celestia-devnet is running: +The docker image automatically creates a NAMESPACE_ID (as shown below) while starting the celestia-da server. If you want to set your own NAMESPACE_ID, set the env variable `CELESTIA_NAMESPACE`. -```bash -docker exec $(docker ps -q) celestia bridge --node.store /home/celestia/bridge/ auth admin +``` +CELESTIA_NAMESPACE=0000$(openssl rand -hex 8) ``` -This will give you the local-celestia-devnet bridge node auth token. This -assumes that there is only one container, otherwise you can pass the container -name. - -We'll use the variable later on to start our rollup. +The port `26650` is where the celestia-da server is run (which also runs celestia bridge node). ### 🔎 Query your balance {#query-your-balance} @@ -422,15 +417,13 @@ from inside the `gm` directory: ::: code-group ```bash [local-celestia-devnet] -go mod edit -replace github.com/cosmos/cosmos-sdk=github.com/rollkit/cosmos-sdk@v0.47.6-rollkit-v0.10.7-no-fraud-proofs-fixed -go mod edit -replace github.com/gogo/protobuf=github.com/regen-network/protobuf@v1.3.3-alpha.regen.1 +go mod edit -replace github.com/cosmos/cosmos-sdk=github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.9-no-fraud-proofs go mod tidy go mod download ``` ```bash [Arabica Devnet] -go mod edit -replace github.com/cosmos/cosmos-sdk=github.com/rollkit/cosmos-sdk@v0.47.6-rollkit-v0.10.7-no-fraud-proofs-fixed -go mod edit -replace github.com/gogo/protobuf=github.com/regen-network/protobuf@v1.3.3-alpha.regen.1 +go mod edit -replace github.com/cosmos/cosmos-sdk=github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.9-no-fraud-proofs go mod tidy go mod download ``` From 50a64c2d8c6751070956dec1f93b7c67e1be34e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?joshcs=2Eeth=20=E1=B5=8D=E1=B5=90?= Date: Fri, 5 Jan 2024 19:29:35 -0500 Subject: [PATCH 2/6] feat: add more granular devnet access --- tutorials/gm-world.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tutorials/gm-world.md b/tutorials/gm-world.md index c2318bef7..01fc01a2c 100644 --- a/tutorials/gm-world.md +++ b/tutorials/gm-world.md @@ -308,11 +308,12 @@ docker run -t -i \ The docker image automatically creates a NAMESPACE_ID (as shown below) while starting the celestia-da server. If you want to set your own NAMESPACE_ID, set the env variable `CELESTIA_NAMESPACE`. -``` +```bash CELESTIA_NAMESPACE=0000$(openssl rand -hex 8) ``` -The port `26650` is where the celestia-da server is run (which also runs celestia bridge node). +The port `26650` is where the celestia-da server is run +(which also runs a Celestia DA bridge node). ### 🔎 Query your balance {#query-your-balance} @@ -322,13 +323,13 @@ local network, this will make sure you can post rollup blocks to your Celestia D First, set your auth token: ```bash -export CELESTIA_NODE_AUTH_TOKEN=$(docker exec $(docker ps -q) celestia bridge --node.store /home/celestia/bridge/ auth admin) +export CELESTIA_NODE_AUTH_TOKEN=$(docker exec $(docker ps -f ancestor=ghcr.io/rollkit/local-celestia-devnet:v0.12.5 -q) celestia bridge --node.store /home/celestia/bridge/ auth admin) ``` Next, check your balance: ```bash -docker exec $(docker ps -q) celestia state balance --token $CELESTIA_NODE_AUTH_TOKEN +docker exec $(docker ps -f ancestor=ghcr.io/rollkit/local-celestia-devnet:v0.12.5 -q) celestia state balance --token $CELESTIA_NODE_AUTH_TOKEN ``` You will see something like this, denoting your balance in TIA x 10-6: @@ -449,7 +450,7 @@ Remember that the following command assumes that there is only one container, otherwise you can pass the container name. ```bash -export AUTH_TOKEN=$(docker exec $(docker ps -q) celestia bridge --node.store /home/celestia/bridge/ auth admin) +export AUTH_TOKEN=$(docker exec $(docker ps -f ancestor=ghcr.io/rollkit/local-celestia-devnet:v0.12.1 -q) celestia bridge --node.store /home/celestia/bridge/ auth admin) ``` Run the `init-local.sh` script: From ab7b1f097e9cf9b9be6625336dbcf08ed1744980 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?joshcs=2Eeth=20=E1=B5=8D=E1=B5=90?= Date: Sat, 6 Jan 2024 14:34:14 -0500 Subject: [PATCH 3/6] feat: implement 3 pages to break tutorial up add construction flags for WIP pages resolves #268 --- .vitepress/config.ts | 6 +- learn/building-and-deploying-a-rollup.md | 4 +- learn/intro.md | 4 +- tutorials/block-times.md | 2 +- tutorials/full-and-sequencer-node.md | 4 +- tutorials/gm-world-frontend.md | 6 +- tutorials/gm-world-mainnet.md | 52 +++++ tutorials/gm-world-testnet.md | 235 ++++++++++++++++++++ tutorials/gm-world.md | 267 +---------------------- tutorials/overview.md | 4 +- tutorials/recipe-book.md | 4 +- tutorials/restart-rollup.md | 6 +- tutorials/starter-rollup.md | 2 +- tutorials/wordle.md | 2 +- 14 files changed, 317 insertions(+), 281 deletions(-) create mode 100644 tutorials/gm-world-mainnet.md create mode 100644 tutorials/gm-world-testnet.md diff --git a/.vitepress/config.ts b/.vitepress/config.ts index 5425cc4a0..d1dd2326e 100644 --- a/.vitepress/config.ts +++ b/.vitepress/config.ts @@ -194,8 +194,10 @@ function sidebarHome() { items: [ // { text: 'Starter Rollup with Docker', link: '/tutorials/rollup-docker'}, // { text: 'Starter Rollup', link: '/tutorials/starter-rollup'}, - { text: 'GM World rollup', link: '/tutorials/gm-world'}, - { text: 'GM World frontend', link: '/tutorials/gm-world-frontend'}, + { text: 'GM world rollup: Part one, local devnet', link: '/tutorials/gm-world'}, + { text: 'GM world rollup: Part two, testnet', link: '/tutorials/gm-world-testnet'}, + { text: 'GM world rollup: Part three, mainnet', link: '/tutorials/gm-world-mainnet'}, + { text: 'GM world frontend', link: '/tutorials/gm-world-frontend'}, { text: 'Recipe Book rollup', link: '/tutorials/recipe-book'}, { text: 'How to restart your rollup', link: '/tutorials/restart-rollup'}, ] diff --git a/learn/building-and-deploying-a-rollup.md b/learn/building-and-deploying-a-rollup.md index 2b79ccffb..c3ac1f0d5 100644 --- a/learn/building-and-deploying-a-rollup.md +++ b/learn/building-and-deploying-a-rollup.md @@ -10,8 +10,8 @@ You can get started with the following tutorials: ## 1. Beginner {#beginner} -- [GM World](/tutorials/gm-world) -- [GM World frontend](/tutorials/gm-world-frontend) +- [GM world](/tutorials/gm-world) +- [GM world frontend](/tutorials/gm-world-frontend) - [Recipe Book](/tutorials/recipe-book) - [Restart your rollup](/tutorials/restart-rollup) diff --git a/learn/intro.md b/learn/intro.md index 1d00a8185..64b439383 100644 --- a/learn/intro.md +++ b/learn/intro.md @@ -40,8 +40,8 @@ If you're familiar with Rollkit, you may want to skip to the [tutorials section] #### Beginner -- [GM World rollup](/tutorials/gm-world) -- [GM World frontend](/tutorials/gm-world-frontend) +- [GM world rollup](/tutorials/gm-world) +- [GM world frontend](/tutorials/gm-world-frontend) - [Recipe Book rollup](/tutorials/recipe-book) - [How to restart your rollup](/tutorials/restart-rollup) diff --git a/tutorials/block-times.md b/tutorials/block-times.md index 862f15fc9..a7f974dc2 100644 --- a/tutorials/block-times.md +++ b/tutorials/block-times.md @@ -1,6 +1,6 @@ # How to change speed of block production -If you have gone through both the [GM World](./gm-world) and the +If you have gone through both the [GM world](./gm-world) and the [Full and sequencer node rollup setup](./full-and-sequencer-node) already, you're now ready to experiment with faster block times. diff --git a/tutorials/full-and-sequencer-node.md b/tutorials/full-and-sequencer-node.md index 31b0aa580..aa6065448 100644 --- a/tutorials/full-and-sequencer-node.md +++ b/tutorials/full-and-sequencer-node.md @@ -1,6 +1,6 @@ # Full and sequencer node rollup setup -This guide will cover how to set up the GM World rollup example as +This guide will cover how to set up the GM world rollup example as a multi-node network using a full and sequencer node. ## About @@ -14,7 +14,7 @@ This is the same way that celestia-node syncs blocks over p2p. ## Prerequisites -First, you'll need to complete the [GM World](./gm-world) tutorial. +First, you'll need to complete the [GM world](./gm-world) tutorial. In this demo, we'll be using the local-celestia-devnet setup used in [Part One](./gm-world#part-one). diff --git a/tutorials/gm-world-frontend.md b/tutorials/gm-world-frontend.md index 72aafc048..85a6ddadf 100644 --- a/tutorials/gm-world-frontend.md +++ b/tutorials/gm-world-frontend.md @@ -1,7 +1,7 @@ -# GM World frontend tutorial +# GM world frontend tutorial In this tutorial, we'll learn how to use [Cosmology](https://cosmology.tech/) to -create a frontend for our [GM World](/tutorials/gm-world) rollup. +create a frontend for our [GM world](/tutorials/gm-world) rollup. Cosmology enables developers to build web3 apps in the Interchain Ecosystem. With Cosmology, it's simple to begin building apps that communicate with @@ -17,7 +17,7 @@ In the end, you'll have something that looks like this ## Getting started In order to complete this tutorial you will need to have completed -the [GM World tutorial](/tutorials/gm-world). This requires a running rollup +the [GM world tutorial](/tutorials/gm-world). This requires a running rollup on your local machine. ## Setting up the frontend diff --git a/tutorials/gm-world-mainnet.md b/tutorials/gm-world-mainnet.md new file mode 100644 index 000000000..efff62503 --- /dev/null +++ b/tutorials/gm-world-mainnet.md @@ -0,0 +1,52 @@ +# GM world rollup: Part three + +:::warning +This tutorial is under construction. 🏗️ +::: + +This tutorial is part three of the GM world rollup tutorials. In this tutorial, +it is expected that you've completed [part one](./gm-world.md) and +[part two](./gm-world-testnet.md) of the tutorial and are +familiar with running a local rollup devnet and posting to a +Celestia testnet. + +## Deploying to Celestia Mainnet Beta + +In this section, we will cover how to deploy to Celestia's Mainnet Beta. + +For this portion, you will need to stop the rollup that you have +running from above using `Control + C` in the terminal. + +1. Start your Celestia light node with state access +(using the `--core.ip string` flag), this time on `celestia`, +which is the chain ID for Mainnet Beta. + + ```bash + celestia light start --core.ip rpc.celestia.pops.one + ``` + +2. Download the script for deploying to Celestia's Mainnet Beta: + + + ```bash + # From inside the `gm` directory + wget https://raw.githubusercontent.com/rollkit/docs/main/scripts/gm/init-mainnet.sh + ``` + + +3. Ensure that the account for your light node is funded. + +4. Run the `init-mainnet.sh` script: + + ```bash + bash init-mainnet.sh + ``` + +5. Watch as your rollup posts blocks to Celestia! + +To deploy to a different DA layer, modify the script to fit your architecture. + +## Next steps + +If you're interested in setting up a full node alongside your sequencer, +see the [Full and sequencer node rollup setup](./full-and-sequencer-node) tutorial. diff --git a/tutorials/gm-world-testnet.md b/tutorials/gm-world-testnet.md new file mode 100644 index 000000000..79f5491b3 --- /dev/null +++ b/tutorials/gm-world-testnet.md @@ -0,0 +1,235 @@ +# GM world rollup: Part two + +:::warning +This tutorial is under construction. 🏗️ +::: + +## Deploying to a Celestia testnet + +This tutorial is part two of the GM world rollup tutorials. In this tutorial, +it is expected that you've completed [part one](./gm-world.md) of +the tutorial and are familiar with running a local rollup devnet. + +### 🪶 Run a Celestia light node {#run-celestia-node} + +Follow instructions to install and start your Celestia data availability +layer light node selecting the Arabica network. You can +find instructions to install and run the node [here](https://docs.celestia.org/nodes/light-node). + +After you have Go and Ignite CLI installed, and your Celestia Light +Node running on your machine, you're ready to build, test, and launch your own +sovereign rollup. + +An example start command on `arabica-9` would look like this: + +```bash +celestia light start --core.ip consensus-full-arabica-9.celestia-arabica.com --p2p.network arabica +``` + +### 💬 Say gm world {#say-gm-world} + +Now, we're going to get our blockchain to say `gm world!` - in order to do so +you need to make the following changes: + +* Modify a protocol buffer file +* Create a keeper query function that returns data + +Protocol buffer files contain proto RPC calls that define Cosmos SDK queries +and message handlers, and proto messages that define Cosmos SDK types. The RPC +calls are also responsible for exposing an HTTP API. + +The `Keeper` is required for each Cosmos SDK module and is an abstraction for +modifying the state of the blockchain. Keeper functions allow us to query or +write to the state. + +#### ✋ Create your first query {#create-first-query} + +**Open a new terminal instance that is not the +same that you started the chain in.** + +In your new terminal, `cd` into the `gm` directory and run this command +to create the `gm` query: + +```bash +ignite scaffold query gm --response text +``` + +Response: + +```bash +modify proto/gm/gm/query.proto +modify x/gm/client/cli/query.go +create x/gm/client/cli/query_gm.go +create x/gm/keeper/query_gm.go + +🎉 Created a query `gm`. +``` + +What just happened? `query` accepts the name of the query (`gm`), an optional +list of request parameters (empty in this tutorial), and an optional +comma-separated list of response field with a `--response` flag (`text` in this +tutorial). + +Navigate to the `gm/proto/gm/gm/query.proto` file, you’ll see that `Gm` RPC has +been added to the `Query` service: + +```proto title="gm/proto/gm/gm/query.proto" +service Query { + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/gm/gm/params"; + } + rpc Gm(QueryGmRequest) returns (QueryGmResponse) { + option (google.api.http).get = "/gm/gm/gm"; + } +} +``` + +The `Gm` RPC for the `Query` service: + +* is responsible for returning a `text` string +* Accepts request parameters (`QueryGmRequest`) +* Returns response of type `QueryGmResponse` +* The `option` defines the endpoint that is used by gRPC to generate an HTTP API + +#### 📨 Query request and response types {#query-request-and-response-types} + +In the same file, we will find: + +* `QueryGmRequest` is empty because it does not require parameters +* `QueryGmResponse` contains `text` that is returned from the chain + +```proto title="gm/proto/gm/gm/query.proto" +message QueryGmRequest { +} + +message QueryGmResponse { + string text = 1; +} +``` + +#### 👋 Gm keeper function {#gm-keeper-function} + +The `gm/x/gm/keeper/query_gm.go` file contains the `Gm` keeper function that +handles the query and returns data. + + + +```go title="gm/x/gm/keeper/query_gm.go" +func (k Keeper) Gm(goCtx context.Context, req *types.QueryGmRequest) (*types.QueryGmResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + _ = ctx + return &types.QueryGmResponse{}, nil +} +``` + + + +The `Gm` function performs the following actions: + +* Makes a basic check on the request and throws an error if it’s `nil` +* Stores context in a `ctx` variable that contains information about the +environment of the request +* Returns a response of type `QueryGmResponse` + +Currently, the response is empty and you'll need to update the keeper function. + +Our `query.proto` file defines that the response accepts `text`. Use your text +editor to modify the keeper function in `gm/x/gm/keeper/query_gm.go` . + + + +```go title="gm/x/gm/keeper/query_gm.go" +func (k Keeper) Gm(goCtx context.Context, req *types.QueryGmRequest) (*types.QueryGmResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + _ = ctx + return &types.QueryGmResponse{Text: "gm world!"}, nil // [!code focus] +} +``` + + + +#### 🟢 Start your sovereign rollup {#start-your-sovereign-rollup} + +We have a handy `init-testnet.sh` found in this repo +[here](https://github.com/rollkit/docs/tree/main/scripts/gm). + +We can copy it over to our directory with the following commands: + + +```bash +# From inside the `gm` directory +wget https://raw.githubusercontent.com/rollkit/docs/main/scripts/gm/init-testnet.sh +``` + + +This copies over our `init-testnet.sh` script to initialize our +`gm` rollup. + +You can view the contents of the script to see how we +initialize the gm rollup. + +##### Clear previous chain history + +Before starting the rollup, we need to remove the old project folders: + +```bash +rm -r $HOME/go/bin/gmd && rm -rf $HOME/.gm +``` + +##### Set the auth token for your light node + +You will also need to set the auth token for your Celestia light node +before running the rollup. In the terminal that you will run the +`init-testnet.sh` script in, run the following: + +```bash +export AUTH_TOKEN=$(celestia light auth admin --p2p.network arabica) +``` + +##### Start the new chain {#start-the-new-chain} + +Now, you can initialize the script with the following command: + +```bash +bash init-testnet.sh +``` + +With that, we have kickstarted our second `gmd` network! + +The `query` command has also scaffolded +`x/gm/client/cli/query_gm.go` that +implements a CLI equivalent of the gm query and mounted this command in +`x/gm/client/cli/query.go`. + +In a separate window, run the following command: + +```bash +gmd q gm gm +``` + +We will get the following JSON response: + +```bash +text: gm world! +``` + +![gm.png](/gm/gm.png) + +Congratulations 🎉 you've successfully built your first rollup and queried it! + +If you're interested in looking at the demo repository +for this tutorial, you can at [https://github.com/rollkit/gm](https://github.com/rollkit/gm). + +## Next steps + +In the next tutorial, you'll learn how to post data to Celestia's +Mainnet Beta. + +If you're interested in setting up a full node alongside your sequencer, +see the [Full and sequencer node rollup setup](./full-and-sequencer-node) tutorial. diff --git a/tutorials/gm-world.md b/tutorials/gm-world.md index 01fc01a2c..e3373fe78 100644 --- a/tutorials/gm-world.md +++ b/tutorials/gm-world.md @@ -2,7 +2,7 @@ description: Build a sovereign rollup with Ignite CLI, Celestia and Rollkit locally and on a testnet --- -# GM World rollup +# GM world rollup ## ☀️ Introduction {#introduction} @@ -22,9 +22,9 @@ to allow blockchains to communicate with one another. The development journey for your rollup will look something like this: -1. [Part one](#part-one): Run your rollup and post DA to a local devnet, and make sure everything works as expected -2. [Part two](#part-two): Deploy the rollup, posting to a DA testnet. Confirm again that everything is functioning properly -3. [Part three](#part-three): Deploy your rollup to the DA layer's mainnet +1. Part one(This page): Run your rollup and post DA to a local devnet, and make sure everything works as expected +2. [Part two](./gm-world-testnet.md): Deploy the rollup, posting to a DA testnet. Confirm again that everything is functioning properly +3. [Part three](./gm-world-mainnet.md): Deploy your rollup to the DA layer's mainnet ::: tip This tutorial will explore developing with Rollkit, @@ -611,261 +611,8 @@ pagination: total: "0" ``` -## Part two - -### 🪶 Run a Celestia light node {#run-celestia-node} - -Follow instructions to install and start your Celestia data availability -layer light node selecting the Arabica network. You can -find instructions to install and run the node [here](https://docs.celestia.org/nodes/light-node). - -After you have Go and Ignite CLI installed, and your Celestia Light -Node running on your machine, you're ready to build, test, and launch your own -sovereign rollup. - -An example start command on `arabica-9` would look like this: - -```bash -celestia light start --core.ip consensus-full-arabica-9.celestia-arabica.com --p2p.network arabica -``` - -### 💬 Say gm world {#say-gm-world} - -Now, we're going to get our blockchain to say `gm world!` - in order to do so -you need to make the following changes: - -* Modify a protocol buffer file -* Create a keeper query function that returns data - -Protocol buffer files contain proto RPC calls that define Cosmos SDK queries -and message handlers, and proto messages that define Cosmos SDK types. The RPC -calls are also responsible for exposing an HTTP API. - -The `Keeper` is required for each Cosmos SDK module and is an abstraction for -modifying the state of the blockchain. Keeper functions allow us to query or -write to the state. - -#### ✋ Create your first query {#create-first-query} - -**Open a new terminal instance that is not the -same that you started the chain in.** - -In your new terminal, `cd` into the `gm` directory and run this command -to create the `gm` query: - -```bash -ignite scaffold query gm --response text -``` - -Response: - -```bash -modify proto/gm/gm/query.proto -modify x/gm/client/cli/query.go -create x/gm/client/cli/query_gm.go -create x/gm/keeper/query_gm.go - -🎉 Created a query `gm`. -``` - -What just happened? `query` accepts the name of the query (`gm`), an optional -list of request parameters (empty in this tutorial), and an optional -comma-separated list of response field with a `--response` flag (`text` in this -tutorial). - -Navigate to the `gm/proto/gm/gm/query.proto` file, you’ll see that `Gm` RPC has -been added to the `Query` service: - -```proto title="gm/proto/gm/gm/query.proto" -service Query { - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/gm/gm/params"; - } - rpc Gm(QueryGmRequest) returns (QueryGmResponse) { - option (google.api.http).get = "/gm/gm/gm"; - } -} -``` - -The `Gm` RPC for the `Query` service: - -* is responsible for returning a `text` string -* Accepts request parameters (`QueryGmRequest`) -* Returns response of type `QueryGmResponse` -* The `option` defines the endpoint that is used by gRPC to generate an HTTP API - -#### 📨 Query request and response types {#query-request-and-response-types} - -In the same file, we will find: - -* `QueryGmRequest` is empty because it does not require parameters -* `QueryGmResponse` contains `text` that is returned from the chain - -```proto title="gm/proto/gm/gm/query.proto" -message QueryGmRequest { -} - -message QueryGmResponse { - string text = 1; -} -``` - -#### 👋 Gm keeper function {#gm-keeper-function} - -The `gm/x/gm/keeper/query_gm.go` file contains the `Gm` keeper function that -handles the query and returns data. - - - -```go title="gm/x/gm/keeper/query_gm.go" -func (k Keeper) Gm(goCtx context.Context, req *types.QueryGmRequest) (*types.QueryGmResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(goCtx) - _ = ctx - return &types.QueryGmResponse{}, nil -} -``` - - - -The `Gm` function performs the following actions: - -* Makes a basic check on the request and throws an error if it’s `nil` -* Stores context in a `ctx` variable that contains information about the -environment of the request -* Returns a response of type `QueryGmResponse` - -Currently, the response is empty and you'll need to update the keeper function. - -Our `query.proto` file defines that the response accepts `text`. Use your text -editor to modify the keeper function in `gm/x/gm/keeper/query_gm.go` . - - - -```go title="gm/x/gm/keeper/query_gm.go" -func (k Keeper) Gm(goCtx context.Context, req *types.QueryGmRequest) (*types.QueryGmResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(goCtx) - _ = ctx - return &types.QueryGmResponse{Text: "gm world!"}, nil // [!code focus] -} -``` - - - -#### 🟢 Start your sovereign rollup {#start-your-sovereign-rollup} - -We have a handy `init-testnet.sh` found in this repo -[here](https://github.com/rollkit/docs/tree/main/scripts/gm). - -We can copy it over to our directory with the following commands: - - -```bash -# From inside the `gm` directory -wget https://raw.githubusercontent.com/rollkit/docs/main/scripts/gm/init-testnet.sh -``` - - -This copies over our `init-testnet.sh` script to initialize our -`gm` rollup. - -You can view the contents of the script to see how we -initialize the gm rollup. - -##### Clear previous chain history - -Before starting the rollup, we need to remove the old project folders: - -```bash -rm -r $HOME/go/bin/gmd && rm -rf $HOME/.gm -``` - -##### Set the auth token for your light node - -You will also need to set the auth token for your Celestia light node -before running the rollup. In the terminal that you will run the -`init-testnet.sh` script in, run the following: - -```bash -export AUTH_TOKEN=$(celestia light auth admin --p2p.network arabica) -``` - -##### Start the new chain {#start-the-new-chain} - -Now, you can initialize the script with the following command: - -```bash -bash init-testnet.sh -``` - -With that, we have kickstarted our second `gmd` network! - -The `query` command has also scaffolded -`x/gm/client/cli/query_gm.go` that -implements a CLI equivalent of the gm query and mounted this command in -`x/gm/client/cli/query.go`. - -In a separate window, run the following command: - -```bash -gmd q gm gm -``` - -We will get the following JSON response: - -```bash -text: gm world! -``` - -![gm.png](/gm/gm.png) - -Congratulations 🎉 you've successfully built your first rollup and queried it! - -If you're interested in looking at the demo repository -for this tutorial, you can at [https://github.com/rollkit/gm](https://github.com/rollkit/gm). - -## Part three - -In this section, we will cover how to deploy to Celestia's Mainnet Beta. - -For this portion, you will need to stop the rollup that you have -running from above using `Control + C` in the terminal. - -1. Start your Celestia light node with state access -(using the `--core.ip string` flag), this time on `celestia`, -which is the chain ID for Mainnet Beta. - - ```bash - celestia light start --core.ip rpc.celestia.pops.one - ``` - -2. Download the script for deploying to Celestia's Mainnet Beta: - - - ```bash - # From inside the `gm` directory - wget https://raw.githubusercontent.com/rollkit/docs/main/scripts/gm/init-mainnet.sh - ``` - - -3. Ensure that the account for your light node is funded. - -4. Run the `init-mainnet.sh` script: - - ```bash - bash init-mainnet.sh - ``` - -5. Watch as your rollup posts blocks to Celestia! - -To deploy to a different DA layer, modify the script to fit your architecture. - ## Next steps -If you're interested in setting up a full node alongside your sequencer, -see the [Full and sequencer node rollup setup](./full-and-sequencer-node) tutorial. +Congratulations! You've built a local rollup that posts to a +local Celestia devnet. In the next tutorial, you can learn +how to post data to Celestia's Mocha testnet. diff --git a/tutorials/overview.md b/tutorials/overview.md index 69f1000ae..f9573416a 100644 --- a/tutorials/overview.md +++ b/tutorials/overview.md @@ -17,8 +17,8 @@ that best suit your needs. In this section, you'll find: * Beginner - * [GM World rollup](/tutorials/gm-world.md) - * [GM World frontend](/tutorials/gm-world-frontend.md) + * [GM world rollup](/tutorials/gm-world.md) + * [GM world frontend](/tutorials/gm-world-frontend.md) * [Recipe Book rollup](/tutorials/recipe-book.md) * [How to restart your rollup](/tutorials/restart-rollup.md) * Intermediate diff --git a/tutorials/recipe-book.md b/tutorials/recipe-book.md index c1d94fce2..d70a384c0 100644 --- a/tutorials/recipe-book.md +++ b/tutorials/recipe-book.md @@ -9,7 +9,7 @@ you to write and read data to and from your application-specific blockchain. The end user will be able to submit new recipes and read them from the blockchain. -In the [`GM World` tutorial](/tutorials/gm-world), we defined a +In the [`GM world` tutorial](/tutorials/gm-world), we defined a new API endpoint and modified a keeper query function to return static data. In this tutorial, we will be modifying the state with transactions (Cosmos SDK messages) @@ -32,7 +32,7 @@ The script for this tutorial is built for Celestia's ## 💻 Prerequisites {#prerequisites} -- [GM World tutorial](/tutorials/gm-world) +- [GM world tutorial](/tutorials/gm-world) ## 🏗 Scaffolding your rollup {#scaffolding-your-rollup} diff --git a/tutorials/restart-rollup.md b/tutorials/restart-rollup.md index 42bf02a72..2b417dfe6 100644 --- a/tutorials/restart-rollup.md +++ b/tutorials/restart-rollup.md @@ -8,9 +8,9 @@ This section covers the case where you need to restart your rollup. In order to restart your rollup, you will need to run the `d start [...args]` command for your rollup. -This [is the example for the GM World tutorial](https://github.com/rollkit/docs/blob/8c69bfc1a545b758a260198feecb39806e9794a7/scripts/gm/init-local.sh#L94). +This [is the example for the GM world tutorial](https://github.com/rollkit/docs/blob/8c69bfc1a545b758a260198feecb39806e9794a7/scripts/gm/init-local.sh#L94). -For the GM World tutorial, you can restart the chain by +For the GM world tutorial, you can restart the chain by [running the `restart-local.sh` script that was generated by `init-local.sh`](https://github.com/rollkit/docs/blob/8c69bfc1a545b758a260198feecb39806e9794a7/scripts/gm/init-local.sh#L85-L91). Use the `DA_START_HEIGHT`, `NAMESPACE`, and `AUTH_TOKEN` variables from your original @@ -37,7 +37,7 @@ you are using to post blocks to your DA and consensus layer runs out of funds (t and you need to restart your rollup. In this example, we're using Celestia's [Mocha testnet](https://docs.celestia.org/nodes/mocha-testnet/) -and running a [GM World rollup](./gm-world.md). In this example, our Celestia DA light node +and running a [GM world rollup](./gm-world.md). In this example, our Celestia DA light node ran out of Mocha testnet TIA and we are unable to post new blocks to Celestia due to a [`Code: 19`](https://github.com/cosmos/cosmos-sdk/blob/main/types/errors/errors.go#L95) error. This error is defined by Cosmos SDK as: diff --git a/tutorials/starter-rollup.md b/tutorials/starter-rollup.md index a263cf76b..b66748dc4 100644 --- a/tutorials/starter-rollup.md +++ b/tutorials/starter-rollup.md @@ -59,4 +59,4 @@ The rollup logs will begin to look similar to this: ## Next steps -In the next tutorial, you'll learn how to build the GM World rollup using Ignite CLI. +In the next tutorial, you'll learn how to build the GM world rollup using Ignite CLI. diff --git a/tutorials/wordle.md b/tutorials/wordle.md index 77c1c8244..f07c9f18b 100644 --- a/tutorials/wordle.md +++ b/tutorials/wordle.md @@ -33,7 +33,7 @@ in Cosmos-SDK, we recommend you go over the following tutorials in Ignite to understand all the different components in Cosmos-SDK before proceeding with this tutorial. -* [GM World](/tutorials/gm-world) +* [GM world](/tutorials/gm-world) * [Recipe Book](/tutorials/recipe-book) or [Blog and Module Basics](https://docs.ignite.com/guide/blog/intro) * [Nameservice Tutorial](https://docs.ignite.com/v0.25.2/guide/nameservice) * [Scavenger Hunt](https://docs.ignite.com/v0.25.2/guide/scavenge) From 27085dac7188ebc8bc5f22493083cb223772a8b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?joshcs=2Eeth=20=E1=B5=8D=E1=B5=90?= Date: Sat, 6 Jan 2024 15:57:55 -0500 Subject: [PATCH 4/6] feat: add subtitle --- tutorials/gm-world.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tutorials/gm-world.md b/tutorials/gm-world.md index e3373fe78..6cdf5144a 100644 --- a/tutorials/gm-world.md +++ b/tutorials/gm-world.md @@ -2,9 +2,11 @@ description: Build a sovereign rollup with Ignite CLI, Celestia and Rollkit locally and on a testnet --- -# GM world rollup +# GM world rollup: Part one -## ☀️ Introduction {#introduction} +## Building a rollup locally + +### ☀️ Introduction {#introduction} In this tutorial, we will build a sovereign `gm-world` rollup using Rollkit and Celestia’s data availability and consensus layer to submit Rollkit blocks. From 6c1201d8b875ed0042afec5da5ec28a5a4eb47a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?joshcs=2Eeth=20=E1=B5=8D=E1=B5=90?= Date: Sat, 6 Jan 2024 16:21:46 -0500 Subject: [PATCH 5/6] feat: fix backlinks and update gm world --- tutorials/full-and-sequencer-node.md | 2 +- tutorials/gm-world-testnet.md | 5 +++ tutorials/gm-world.md | 55 ++++++++++------------------ 3 files changed, 25 insertions(+), 37 deletions(-) diff --git a/tutorials/full-and-sequencer-node.md b/tutorials/full-and-sequencer-node.md index aa6065448..82f6ab532 100644 --- a/tutorials/full-and-sequencer-node.md +++ b/tutorials/full-and-sequencer-node.md @@ -17,7 +17,7 @@ This is the same way that celestia-node syncs blocks over p2p. First, you'll need to complete the [GM world](./gm-world) tutorial. In this demo, we'll be using the local-celestia-devnet setup used -in [Part One](./gm-world#part-one). +in [part one](./gm-world). ## Getting started diff --git a/tutorials/gm-world-testnet.md b/tutorials/gm-world-testnet.md index 79f5491b3..67e983f9d 100644 --- a/tutorials/gm-world-testnet.md +++ b/tutorials/gm-world-testnet.md @@ -4,6 +4,11 @@ This tutorial is under construction. 🏗️ ::: +::: warning +The script for this tutorial is built for Celestia's +[Arabica devnet](https://docs.celestia.org/nodes/arabica-devnet). +::: + ## Deploying to a Celestia testnet This tutorial is part two of the GM world rollup tutorials. In this tutorial, diff --git a/tutorials/gm-world.md b/tutorials/gm-world.md index 6cdf5144a..d1dde2f40 100644 --- a/tutorials/gm-world.md +++ b/tutorials/gm-world.md @@ -8,26 +8,24 @@ description: Build a sovereign rollup with Ignite CLI, Celestia and Rollkit loca ### ☀️ Introduction {#introduction} -In this tutorial, we will build a sovereign `gm-world` rollup using Rollkit -and Celestia’s data availability and consensus layer to submit Rollkit blocks. +This tutorial will guide you through building a sovereign `gm-world` rollup using Rollkit, +using Celestia’s data availability and consensus layer to submit Rollkit blocks. -This tutorial will cover setting up Ignite CLI, +We'll cover setting up Ignite CLI, building a Cosmos-SDK application-specific rollup blockchain, and posting data to Celestia. -First, we will test on a local DA network and then we will deploy to a live -testnet. +First, we will test on a local DA network, then to a live +testnet, and lastly to mainnet. + +1. Part one (This page): Run your rollup and post DA to a local devnet, and make sure everything works as expected. +2. [Part two](./gm-world-testnet.md): Deploy the rollup, posting to a DA testnet. Confirm again that everything is functioning properly. +3. [Part three](./gm-world-mainnet.md): Deploy your rollup to the DA layer's mainnet. The [Cosmos SDK](https://github.com/cosmos/cosmos-sdk) is a framework for building blockchain applications. The Cosmos Ecosystem uses [Inter-Blockchain Communication (IBC)](https://github.com/cosmos/ibc-go) to allow blockchains to communicate with one another. -The development journey for your rollup will look something like this: - -1. Part one(This page): Run your rollup and post DA to a local devnet, and make sure everything works as expected -2. [Part two](./gm-world-testnet.md): Deploy the rollup, posting to a DA testnet. Confirm again that everything is functioning properly -3. [Part three](./gm-world-mainnet.md): Deploy your rollup to the DA layer's mainnet - ::: tip This tutorial will explore developing with Rollkit, which is still in Alpha stage. If you run into bugs, please write a Github @@ -37,11 +35,6 @@ or let us know in our [Telegram](https://t.me/rollkit). Learn how to [restart your rollup](restart-rollup.md). ::: -::: warning -The script for this tutorial is built for Celestia's -[Arabica devnet](https://docs.celestia.org/nodes/arabica-devnet). -::: - ## 🤔 What is GM? {#what-is-gm} GM means good morning. It's GM o'clock somewhere, so there's never a bad time @@ -57,14 +50,6 @@ to say GM, Gm, or gm. You can think of "GM" as the new version of * [wget](https://www.gnu.org/software/wget) * [A Celestia Light Node](https://docs.celestia.org/nodes/light-node) -::: tip -If you are only planning to complete [part one](#part-one), -feel free to skip to the [part two](#part-two). - -Be sure to use the same testnet installation instructions through this -entire tutorial. -::: - ## Linux setup ### 🏃 Install Golang on Linux {#install-golang-linux} @@ -95,7 +80,6 @@ curl https://get.ignite.com/cli@v28.1.0! | bash ✋ On some machines, you may run into permissions errors like the one below. You can resolve this error by following the guidance [here](https://docs.ignite.com/v0.25.2/guide/install#write-permission) or below. -::: ```bash # Error @@ -118,6 +102,8 @@ The following command will resolve the permissions error: sudo curl https://get.ignite.com/cli@v28.1.0! | bash ``` +::: + A successful installation will return something similar to the response below: ```bash @@ -156,14 +142,6 @@ Is on Gitpod: false ## macOS setup -::: tip -If you are only planning to complete [part one](#part-one), -feel free to skip to the [part two](#part-two). - -Be sure to use the same testnet installation instructions through this -entire tutorial. -::: - ### 🏃 Install Golang on macOS {#install-golang-mac} [Celestia-App](https://github.com/celestiaorg/celestia-app), @@ -192,7 +170,6 @@ curl https://get.ignite.com/cli@v28.1.0! | bash ✋ On some machines, you may run into permissions errors like the one below. You can resolve this error by following the guidance [here](https://docs.ignite.com/v0.25.2/guide/install#write-permission) or below. -::: ```bash # Error @@ -215,6 +192,8 @@ The following command will resolve the permissions error: sudo curl https://get.ignite.com/cli@v28.1.0! | sudo bash ``` +::: + A successful installation will return something similar the response below: ```bash @@ -308,13 +287,17 @@ docker run -t -i \ ghcr.io/rollkit/local-celestia-devnet:v0.12.5 ``` -The docker image automatically creates a NAMESPACE_ID (as shown below) while starting the celestia-da server. If you want to set your own NAMESPACE_ID, set the env variable `CELESTIA_NAMESPACE`. +The docker image automatically creates a `NAMESPACE_ID` +(as shown below) while starting the celestia-da server. +If you want to set your own `NAMESPACE_ID`, set the env variable +`CELESTIA_NAMESPACE`. ```bash CELESTIA_NAMESPACE=0000$(openssl rand -hex 8) ``` -The port `26650` is where the celestia-da server is run +The port `26650` is where the +[celestia-da](https://github.com/rollkit/celestia-da) server is run (which also runs a Celestia DA bridge node). ### 🔎 Query your balance {#query-your-balance} From bd573f41a50a0869c3962884d920c5980205f93c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?joshcs=2Eeth=20=E1=B5=8D=E1=B5=90?= Date: Sat, 6 Jan 2024 16:41:35 -0500 Subject: [PATCH 6/6] feat: update gm world part 1 --- scripts/gm/init-local.sh | 4 +-- tutorials/gm-world.md | 64 ++++++---------------------------------- 2 files changed, 11 insertions(+), 57 deletions(-) diff --git a/scripts/gm/init-local.sh b/scripts/gm/init-local.sh index 46ca3567a..a39086bf7 100644 --- a/scripts/gm/init-local.sh +++ b/scripts/gm/init-local.sh @@ -49,7 +49,7 @@ cat <<'EOF' EOF # echo variables for the chain -echo -e "\n\n\n\n\n Your DA_BLOCK_HEIGHT is $DA_BLOCK_HEIGHT \n\n\n\n\n" +echo -e "\n Your DA_BLOCK_HEIGHT is $DA_BLOCK_HEIGHT \n" # build the gm chain with Rollkit ignite chain build @@ -87,7 +87,7 @@ echo "DA_BLOCK_HEIGHT=$DA_BLOCK_HEIGHT" >> restart-local.sh echo "gmd start --rollkit.aggregator true --rollkit.da_address=":26650" --rollkit.da_start_height \$DA_BLOCK_HEIGHT --rpc.laddr tcp://127.0.0.1:36657 --p2p.laddr \"0.0.0.0:36656\"" >> restart-local.sh # start the chain -gmd start --rollkit.aggregator true --rollkit.da_address=":26650" --rollkit.da_start_height $DA_BLOCK_HEIGHT --rpc.laddr tcp://127.0.0.1:36657 --p2p.laddr "0.0.0.0:36656" +gmd start --rollkit.aggregator true --rollkit.da_address=":26650" --rollkit.da_start_height $DA_BLOCK_HEIGHT --rpc.laddr tcp://127.0.0.1:36657 --p2p.laddr "0.0.0.0:36656" --minimum-gas-prices="0.025stake" # uncomment the next command if you are using lazy aggregation # gmd start --rollkit.aggregator true --rollkit.da_address=":26650" --rollkit.da_start_height $DA_BLOCK_HEIGHT --rollkit.lazy_aggregator diff --git a/tutorials/gm-world.md b/tutorials/gm-world.md index d1dde2f40..0be7916a0 100644 --- a/tutorials/gm-world.md +++ b/tutorials/gm-world.md @@ -6,7 +6,7 @@ description: Build a sovereign rollup with Ignite CLI, Celestia and Rollkit loca ## Building a rollup locally -### ☀️ Introduction {#introduction} +### 🌅 Introduction {#introduction} This tutorial will guide you through building a sovereign `gm-world` rollup using Rollkit, using Celestia’s data availability and consensus layer to submit Rollkit blocks. @@ -50,6 +50,8 @@ to say GM, Gm, or gm. You can think of "GM" as the new version of * [wget](https://www.gnu.org/software/wget) * [A Celestia Light Node](https://docs.celestia.org/nodes/light-node) +Next, head either to [Linux setup](#linux-setup) or [MacOS setup](#macos-setup). + ## Linux setup ### 🏃 Install Golang on Linux {#install-golang-linux} @@ -140,6 +142,8 @@ Your cwd: /Users/joshstein Is on Gitpod: false ``` +Your development environment is setup! Now, head to [part one](#part-one). + ## macOS setup ### 🏃 Install Golang on macOS {#install-golang-mac} @@ -255,6 +259,8 @@ wget is an Internet file retriever: brew install wget ``` +Your development environment is setup! Now, head to [part one](#part-one). + ## Part one This part of the tutorial will teach developers how to easily run a local data availability (DA) devnet on their own machine (or in the cloud). @@ -300,35 +306,6 @@ The port `26650` is where the [celestia-da](https://github.com/rollkit/celestia-da) server is run (which also runs a Celestia DA bridge node). -### 🔎 Query your balance {#query-your-balance} - -Open a new terminal instance. Check the balance on your account that you'll be using to post blocks to the -local network, this will make sure you can post rollup blocks to your Celestia Devnet for DA & consensus. - -First, set your auth token: - -```bash -export CELESTIA_NODE_AUTH_TOKEN=$(docker exec $(docker ps -f ancestor=ghcr.io/rollkit/local-celestia-devnet:v0.12.5 -q) celestia bridge --node.store /home/celestia/bridge/ auth admin) -``` - -Next, check your balance: - -```bash -docker exec $(docker ps -f ancestor=ghcr.io/rollkit/local-celestia-devnet:v0.12.5 -q) celestia state balance --token $CELESTIA_NODE_AUTH_TOKEN -``` - -You will see something like this, denoting your balance in TIA x 10-6: - - -```bash -{ - "result": { - "denom": "utia", - "amount": "999994999970000" - } -} -``` - ### 🏗️ Building your sovereign rollup {#building-your-sovereign-rollup} Now that you have a Celestia devnet running, we are ready to use Golang @@ -400,22 +377,12 @@ Most of our work in this tutorial will happen in the `x` directory. To swap out CometBFT for Rollkit, run the following command from inside the `gm` directory: -::: code-group - -```bash [local-celestia-devnet] -go mod edit -replace github.com/cosmos/cosmos-sdk=github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.9-no-fraud-proofs -go mod tidy -go mod download -``` - -```bash [Arabica Devnet] +```bash go mod edit -replace github.com/cosmos/cosmos-sdk=github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.9-no-fraud-proofs go mod tidy go mod download ``` -::: - ### ▶️ Start your rollup {#start-your-rollup} Download the `init-local.sh` script to start the chain: @@ -425,19 +392,6 @@ Download the `init-local.sh` script to start the chain: wget https://raw.githubusercontent.com/rollkit/docs/main/scripts/gm/init-local.sh ``` -Next, you'll need to set the auth token in your terminal to be consumed by -your `init-local.sh` script. - -In the terminal that you will run the script in, set the auth token for the -local-celestia-devnet. This is so that you can post data to the local DA. - -Remember that the following command assumes that there is only one container, -otherwise you can pass the container name. - -```bash -export AUTH_TOKEN=$(docker exec $(docker ps -f ancestor=ghcr.io/rollkit/local-celestia-devnet:v0.12.1 -q) celestia bridge --node.store /home/celestia/bridge/ auth admin) -``` - Run the `init-local.sh` script: ```bash @@ -501,7 +455,7 @@ So using our information from the [keys](#keys) command, we can construct the tr ```bash gmd tx bank send $KEY1 $KEY2 42069stake --keyring-backend test \ ---node tcp://127.0.0.1:36657 +--node tcp://127.0.0.1:36657 --chain-id gm ``` ::: tip