Skip to content

Commit

Permalink
chore: update celestia-da.md (#396)
Browse files Browse the repository at this point in the history
* Update celestia-da.md

- Added couple of missing commands.
- Polished the document.

* Apply suggestions from code review

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Apply suggestions from code review

* chore: remove `ignite chain build` per suggestion

---------

Co-authored-by: joshcs.eth <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Yarik Bratashchuk <[email protected]>
Co-authored-by: Manav Aggarwal <[email protected]>
  • Loading branch information
5 people authored Jun 28, 2024
1 parent f1890b5 commit 4f8b4b5
Showing 1 changed file with 27 additions and 25 deletions.
52 changes: 27 additions & 25 deletions tutorials/celestia-da.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Deploying a rollup to Celestia
# Deploying a rollup to Celestia

<!-- markdownlint-disable MD033 -->
<script setup>
Expand All @@ -9,7 +9,7 @@ import constants from '../.vitepress/constants/constants.js'

This tutorial serves as a comprehensive guide for deploying your rollup on Celestia's data availability (DA) network. From the Rollkit perspective, there's no difference in posting blocks to Celestia's testnets or Mainnet Beta.

Before proceeding, ensure that you have completed the [GM world rollup](/tutorials/gm-world) tutorial, which covers setting up a local sovereign gm-world rollup and connecting it to a local DA node.
Before proceeding, ensure that you have completed the [GM world rollup](/tutorials/gm-world) tutorial, which covers setting up a local sovereign `gm-world` rollup and connecting it to a local DA node.

## 🪶 Running a Celestia light node

Expand All @@ -21,11 +21,11 @@ Before you can start your rollup node, you need to initiate, sync, and possibly

The main difference lies in how you fund your wallet address: using testnet TIA or [TIA](https://docs.celestia.org/learn/tia#overview-of-tia) for Mainnet Beta.

After successfully starting a light node, it's time to start posting the batches of blocks of data that your rollup generates.
After successfully starting a light node, it's time to start posting the batches of blocks of data that your rollup generates to Celestia.

## 🏗️ Prerequisites {#prerequisites}
## 🏗️ Prerequisites {#prerequisites}

From the [GM world rollup](/tutorials/gm-world) tutorial, you should already have the `rollkit` CLI and `ignite` installed.
From the [GM world rollup](/tutorials/gm-world) tutorial, you should already have the `rollkit` CLI and `ignite` CLI installed.

## 🏗️ Building your sovereign rollup {#building-your-sovereign-rollup}

Expand All @@ -43,7 +43,7 @@ cd $HOME/gm
ignite app install github.com/ignite/apps/rollkit@rollkit/{{constants.rollkitIgniteAppVersion}}
```

Next, move to the `gm` directory and add the Rollkit app:
Add the Rollkit app:

```bash
ignite rollkit add
Expand All @@ -57,17 +57,15 @@ ignite rollkit init

This will create a `$HOME/.gm` directory with the chain configuration files.

## 🧰 Configuring your sovereign rollup {#configuring-your-sovereign-rollup}

## 🧰 Configuring your rollup {#configuring-your-rollup}


From inside the `$HOME/gm` directory, generate a rollkit.toml file by running:
From the `$HOME/gm` directory, generate a `rollkit.toml` file by running:

```bash
rollkit toml init
```

The output should be similar to this (our `$HOME` is `/root`):
The output should be similar to this (`$HOME` in the below example is `/root`):

```
Found rollup entrypoint: /root/gm/cmd/gmd/main.go, adding to rollkit.toml
Expand All @@ -77,55 +75,59 @@ Initialized rollkit.toml file in the current directory.

## 🛠️ Configuring flags for DA

Now we're prepared to initiate our rollup and establish a connection with the Celestia light node. The `rollkit start` command requires three DA configuration flags:
Now, we're prepared to initiate our rollup and establish a connection with the Celestia light node. The `rollkit start` command requires three DA configuration flags:

- `--rollkit.da_start_height`
- `--rollkit.da_auth_token`
- `--rollkit.da_namespace`

Let's determine which values to provide for each of them.

First, let's query the DA layer start height using an RPC endpoint provided by Celestia's documentation.

::: tip
Optionally, you could also set the `--rollkit.da_block_time` flag. This should be set to the finality time of the DA layer, not its actual block time, as Rollkit does not handle reorganization logic. The default value is 15 seconds.
:::

Let's determine what to provide for each of them.

First, let's query the DA Layer start height using an RPC endpoint provided by Celestia Labs. For Mocha testnet it would be - [https://rpc-mocha.pops.one/block](https://rpc-mocha.pops.one/block), and for mainnet beta - [https://rpc.lunaroasis.net/block](https://rpc.lunaroasis.net/block)
- Mocha testnet: [https://rpc-mocha.pops.one/block](https://rpc-mocha.pops.one/block)
- Mainnet Beta: [https://rpc.lunaroasis.net/block](https://rpc.lunaroasis.net/block)

Here is an example for the Mocha testnet (replace URL for mainnet beta if needed):
Here is an example for the Mocha testnet (replace URL for Mainnet Beta accordingly):

```bash
DA_BLOCK_HEIGHT=$(curl https://rpc-mocha.pops.one/block | jq -r '.result.block.header.height')
echo -e "\n Your DA_BLOCK_HEIGHT is $DA_BLOCK_HEIGHT \n"
```

You will see the output like this:
The output of the command above will look similar to this:

```bash
Your DA_BLOCK_HEIGHT is 1777655
```

Now, obtain an authentication token for your light node as follows (for Mainnet Beta, simply omit the --p2p.network flag):
Now, let's obtain the authentication token of your light node using the following command (omit the --p2p.network flag for Mainnet Beta):

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

The output will look like this:
The output of the command above will look similar to this:

```bash
Your DA AUTH_TOKEN is eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJwdWJsaWMiLCJyZWFkIiwid3JpdGUiXX0.cSrJjpfUdTNFtzGho69V0D_8kyECn9Mzv8ghJSpKRDE
```

Now, let's also set up a namespace for our blocks by simply setting a variable like this:
Lastly, let's set up the namespace to be used for posting data on Celestia:

```bash
DA_NAMESPACE=00000000000000000000000000000000000000000008e5f679bf7116cb
```

:::tip
`00000000000000000000000000000000000000000008e5f679bf7116cb` is a default namespace for Mocha testnet. You can set your own by using a command
similar to this (or, you could get creative 😎):
`00000000000000000000000000000000000000000008e5f679bf7116cb` is a default namespace for Mocha testnet. You can set your own by using a command similar to this (or, you could get creative 😎):

```bash
openssl rand -hex 10
Expand All @@ -136,9 +138,9 @@ Replace the last 20 characters (10 bytes) in `0000000000000000000000000000000000
[Learn more about namespaces](https://docs.celestia.org/developers/node-tutorial#namespaces).
:::

## 🔥 Running your rollup connected to a Celestia light node
## 🔥 Running your rollup connected to Celestia light node

Now let's run our rollup node with all DA flags:
Finally, let's initiate the rollup node with all the flags:

```bash
rollkit start \
Expand All @@ -149,12 +151,12 @@ rollkit start \
--minimum-gas-prices="0.025stake"
```

Now, the rollup is running and posting blocks (aggregated in batches) to Celestia. You can view your rollup by finding your namespace or account on [Mocha testnet](https://docs.celestia.org/nodes/mocha-testnet#explorers) or [mainnet beta](https://docs.celestia.org/nodes/mainnet#explorers) explorers.
Now, the rollup is running and posting blocks (aggregated in batches) to Celestia. You can view your rollup by using your namespace or account on [Mocha testnet](https://docs.celestia.org/nodes/mocha-testnet#explorers) or [Mainnet Beta](https://docs.celestia.org/nodes/mainnet#explorers) explorers.

::: info
For details on configuring gas prices specifically for the DA network, see our [DA Network Gas Price Guide](/guides/gas-price). This is separate from the `--minimum-gas-prices="0.025stake"` setting, which is used for rollup network operations.
For details on configuring gas prices, specifically for the Celestia network, see the [DA Network Gas Price Guide](/guides/gas-price). The Celestia gas price is separate from the `--minimum-gas-prices="0.025stake"` setting, which is used for the rollup network operations.
:::

## 🎉 Next steps

Congratulations! You've built a local rollup that posts to Celestia's testnets or Mainnet Beta. Well done! Now, go forth and build something great! Good luck!
Congratulations! You've built a local rollup that posts data to Celestia's DA layer. Well done! Now, go forth and build something great! Good luck!

0 comments on commit 4f8b4b5

Please sign in to comment.