Skip to content

Commit

Permalink
adjust gm tutorial based on latest rollkit/cosmos-sdk releases and lo…
Browse files Browse the repository at this point in the history
…cal-celestia-devnet changes
  • Loading branch information
Ganesha Upadhyaya authored and Ganesha Upadhyaya committed Jan 3, 2024
1 parent 09ae7a2 commit 5332077
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 57 deletions.
28 changes: 9 additions & 19 deletions scripts/gm/init-local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
69 changes: 31 additions & 38 deletions tutorials/gm-world.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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]
Expand All @@ -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:
Expand All @@ -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]
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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]
Expand All @@ -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:
Expand All @@ -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]
```
Expand All @@ -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
Expand Down Expand Up @@ -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). <ADD MORE DETAILS>

### 🔎 Query your balance {#query-your-balance}

Expand Down Expand Up @@ -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/[email protected]
go mod edit -replace github.com/gogo/protobuf=github.com/regen-network/[email protected]
go mod edit -replace github.com/cosmos/cosmos-sdk=github.com/rollkit/[email protected]
go mod tidy
go mod download
```

```bash [Arabica Devnet]
go mod edit -replace github.com/cosmos/cosmos-sdk=github.com/rollkit/[email protected]
go mod edit -replace github.com/gogo/protobuf=github.com/regen-network/[email protected]
go mod edit -replace github.com/cosmos/cosmos-sdk=github.com/rollkit/[email protected]
go mod tidy
go mod download
```
Expand Down

0 comments on commit 5332077

Please sign in to comment.