Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adjust gm tutorial based on latest rollkit/cosmos-sdk releases and local-celestia-devnet changes #287

Merged
merged 6 commits into from
Jan 6, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'},
]
Expand Down
4 changes: 2 additions & 2 deletions learn/building-and-deploying-a-rollup.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions learn/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
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
2 changes: 1 addition & 1 deletion tutorials/block-times.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
4 changes: 2 additions & 2 deletions tutorials/full-and-sequencer-node.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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).
Expand Down
6 changes: 3 additions & 3 deletions tutorials/gm-world-frontend.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
52 changes: 52 additions & 0 deletions tutorials/gm-world-mainnet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# GM world rollup: Part three

:::warning
This tutorial is under construction. 🏗️
:::
jcstein marked this conversation as resolved.
Show resolved Hide resolved

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:

<!-- markdownlint-disable MD013 -->
```bash
# From inside the `gm` directory
wget https://raw.githubusercontent.com/rollkit/docs/main/scripts/gm/init-mainnet.sh
```
<!-- markdownlint-enable MD013 -->

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.
jcstein marked this conversation as resolved.
Show resolved Hide resolved

## 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.
Loading