Skip to content

Commit

Permalink
Updates to Wordle tutorial:
Browse files Browse the repository at this point in the history
- Update links to Cosmos SDK docs
- Remove Celestia DA from script and steps
- Add "Next Steps" section pointing to Celestia DA
  • Loading branch information
yarikbratashchuk committed May 13, 2024
1 parent 6bc7c2c commit f5a0cdb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 47 deletions.
17 changes: 2 additions & 15 deletions public/wordle/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,6 @@ CHAINFLAG="--chain-id ${CHAIN_ID}"
TOKEN_AMOUNT="10000000000000000000000000stake"
STAKING_AMOUNT="1000000000stake"

# query the DA Layer start height, in this case we are querying
# an RPC endpoint provided by Celestia Labs. The RPC endpoint is
# to allow users to interact with Celestia's core network by querying
# the node's state and broadcasting transactions on the Celestia
# network. This is for Arabica, if using another network, change the RPC.
DA_BLOCK_HEIGHT=$(curl https://rpc.celestia-arabica-11.com/block | jq -r '.result.block.header.height')
echo -e "\n Your DA_BLOCK_HEIGHT is $DA_BLOCK_HEIGHT \n"

AUTH_TOKEN=$(celestia light auth write --p2p.network arabica)
echo -e "\n Your DA AUTH_TOKEN is $AUTH_TOKEN \n"

# build the wordle chain with Rollkit
ignite chain build

Expand Down Expand Up @@ -48,10 +37,8 @@ jq --argjson pubKey "$PUB_KEY" '.consensus["validators"]=[{"address": "'$ADDRESS

# create a restart-testnet.sh file to restart the chain later
[ -f restart-wordle.sh ] && rm restart-wordle.sh
echo "DA_BLOCK_HEIGHT=$DA_BLOCK_HEIGHT" >> restart-wordle.sh
echo "AUTH_TOKEN=$AUTH_TOKEN" >> restart-wordle.sh

echo "wordled start --rollkit.aggregator --rollkit.da_auth_token=\$AUTH_TOKEN --rollkit.da_namespace 00000000000000000000000000000000000000000008e5f679bf7116cb --rollkit.da_start_height \$DA_BLOCK_HEIGHT --rpc.laddr tcp://127.0.0.1:36657 --grpc.address 127.0.0.1:9290 --p2p.laddr \"0.0.0.0:36656\" --minimum-gas-prices="0.025stake"" >> restart-wordle.sh
echo "wordled start --rollkit.aggregator --rpc.laddr tcp://127.0.0.1:36657 --grpc.address 127.0.0.1:9290 --p2p.laddr \"0.0.0.0:36656\" --minimum-gas-prices=\"0.025stake\" --rollkit.da_address \"http://localhost:7980\"" >> restart-wordle.sh

# start the chain
wordled start --rollkit.aggregator --rollkit.da_auth_token=$AUTH_TOKEN --rollkit.da_namespace 00000000000000000000000000000000000000000008e5f679bf7116cb --rollkit.da_start_height $DA_BLOCK_HEIGHT --rpc.laddr tcp://127.0.0.1:36657 --grpc.address 127.0.0.1:9290 --p2p.laddr "0.0.0.0:36656" --minimum-gas-prices="0.025stake"
wordled start --rollkit.aggregator --rpc.laddr tcp://127.0.0.1:36657 --grpc.address 127.0.0.1:9290 --p2p.laddr "0.0.0.0:36656" --minimum-gas-prices="0.025stake" --rollkit.da_address "http://localhost:7980"
49 changes: 17 additions & 32 deletions tutorials/wordle.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ import constants from '../.vitepress/constants/constants.js'
:::
<!-- markdownlint-enable MD033 -->

::: warning
The script for this tutorial is built for Celestia's
[Arabica devnet](https://docs.celestia.org/nodes/arabica-devnet).
:::

## 💻 Pre-requisites {#prerequisites}

Given this tutorial is targeted for developers who are experienced
Expand Down Expand Up @@ -187,7 +182,7 @@ let's build the Wordle app!

For the Wordle module, we can add dependencies offered by Cosmos-SDK.

From the Cosmos-SDK docs, a [module](https://docs.ignite.com/v0.25.2/guide/nameservice#cosmos-sdk-modules)
From the Cosmos-SDK docs, a [module](https://docs.cosmos.network/main/glossary#module)
is defined as the following:

> In a Cosmos SDK blockchain, application-specific logic
Expand Down Expand Up @@ -224,7 +219,7 @@ This will scaffold the Wordle module to our Wordle Chain project.

Messages allow us to process and submit information to our specific module.

From the Cosmos-SDK docs, [messages](https://docs.cosmos.network/main/building-modules/messages-and-queries.html#messages)
From the Cosmos-SDK docs, [messages](https://docs.cosmos.network/main/build/building-modules/messages-and-queries)
are:

> In the Cosmos SDK, messages are objects that are contained
Expand Down Expand Up @@ -287,7 +282,7 @@ this address submitted.
<!-- markdownlint-disable MD013 -->

Now it’s time to implement the Keeper functions for each
message. From the Cosmos-SDK docs, [Keeper](https://docs.cosmos.network/main/building-modules/keeper.html)
message. From the Cosmos-SDK docs, [Keeper](https://docs.cosmos.network/main/build/building-modules/keeper)
is defined as the following:

> The main core of a Cosmos SDK module is a piece called the keeper.
Expand Down Expand Up @@ -550,27 +545,18 @@ compile the blockchain and take it out for a test drive.
## ⛓️ Run the wordle chain
<!-- markdownlint-disable MD013 -->

### 🪶 Run a Celestia light node {#run-celestia-light-node}

Follow instructions to install and start your Celestia Data Availability
layer Light Node selecting the Arabica Devnet. You can
find instructions to install and run the node [here](https://docs.celestia.org/nodes/light-node).
### 🪶 Run a mock DA node {#run-mock-da-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.
To set up a mock data availability network node run:

Be sure you have initialized your node before trying to start it.
Your start command should look similar to:

<!-- markdownlint-disable MD013 -->
```bash
celestia light start --core.ip validator-1.celestia-arabica-11.com --p2p.network arabica
```bash-vue
curl -sSL https://rollkit.dev/install-mock-da.sh | sh {{constants.mockDALatestTag}}
```

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.
This script builds and runs the node, now listening on port `7980`.

After you have Go and Ignite CLI installed, and your mock data availability node
running on your machine, you're ready to build, test, and launch your own sovereign rollup.

### 🟢 Building and running wordle chain {#build-and-run-wordle-chain}

Expand Down Expand Up @@ -599,9 +585,6 @@ bash init.sh

With that, we have kickstarted our `wordled` network!

Find
[your account address on an Arabica explorer to see your `PayForBlobs` transactions](https://explorer.modular.cloud/celestia-arabica/addresses/celestia10rdu7l3gzeuxplpnr5vxchvxxflx7ym0q6wt5v).

In another window, run the following to submit a Wordle:

<!-- markdownlint-disable MD013 -->
Expand All @@ -612,7 +595,7 @@ wordled tx wordle submit-wordle giant --from wordle-key --keyring-backend test -

> NOTE: We are submitting a transaction asynchronously to avoid
any timeout errors. With Rollkit as a replacement to CometBFT, we
need to wait for Celestia's Data-Availability network to ensure a block
need to wait for data availability network to ensure a block
was included from Wordle, before proceeding to the next block. Currently,
in Rollkit, the single aggregator is not moving forward with the next block
production as long as it is trying to submit the current block to the DA network.
Expand Down Expand Up @@ -760,9 +743,6 @@ extend the code base.

### 🔮 Extending in the future {#extending-in-the-future}

You can extend the codebase and improve this tutorial by checking
out the repository [here](https://github.com/celestiaorg/wordle).

There are many ways this codebase can be extended:

1. You can improve messaging around when you guess the correct word.
Expand All @@ -776,3 +756,8 @@ There are many ways this codebase can be extended:
5. You can create a bot that submits a wordle every day at a specific time.
6. You can create a vue.js front-end with Ignite using example open-source
repositories [here](https://github.com/yyx990803/vue-wordle) and [here](https://github.com/xudafeng/wordle).

## 🎉 Next steps

Congratulations! You've built a Wordle app using Cosmos-SDK and Rollkit.
Now it's time to explore how you can connect your rollup to the DA networks such as Celestia.

0 comments on commit f5a0cdb

Please sign in to comment.