Skip to content

Deploying a rollup to Celestia ​

🌞 Introduction ​

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 tutorial, which covers setting up a local sovereign gm-world rollup and connecting it to a local DA node.

ðŸŠķ Running a Celestia light node ​

Before you can start your rollup node, you need to initiate, sync, and possibly fund a light node on one of Celestia's networks:

The main difference lies in how you fund your wallet address: using testnet TIA or 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 to Celestia.

🏗ïļ Prerequisites ​

  • rollkit CLI installed from the GM world rollup tutorial.
  • ignite CLI v28.4.0 installed curl https://get.ignite.com/cli@v28.4.0! | bash

🏗ïļ Building your sovereign rollup ​

Remove the existing gm project and create a new one using ignite:

bash
cd $HOME && rm -rf gm
ignite scaffold chain gm --address-prefix gm --no-module

Install the Rollkit app to ignite:

bash
cd $HOME/gm
ignite app install github.com/ignite/apps/rollkit@rollkit/v0.2.1

Add the Rollkit app:

bash
ignite rollkit add

Build the rollup node binary to use it for the chain configuration and to initialize:

bash
ignite chain build

Initialize the Rollkit chain configuration:

bash
ignite rollkit init

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

🧰 Configuring your sovereign rollup ​

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

bash
rollkit toml init

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
Found rollup configuration under /root/.gm, adding to rollkit.toml
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:

  • --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.

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"

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

bash
 Your DA_BLOCK_HEIGHT is 1777655

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 of the command above will look similar to this:

bash
 Your DA AUTH_TOKEN is eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJwdWJsaWMiLCJyZWFkIiwid3JpdGUiXX0.cSrJjpfUdTNFtzGho69V0D_8kyECn9Mzv8ghJSpKRDE

Next, 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 😎):

bash
openssl rand -hex 10

Replace the last 20 characters (10 bytes) in 00000000000000000000000000000000000000000008e5f679bf7116cb with the newly generated 10 bytes.

Learn more about namespaces.

Lastly, set your DA address for your light node, which by default runs at port 26658:

bash
DA_ADDRESS=http://localhost:26658

ðŸ”Ĩ Running your rollup connected to Celestia light node ​

Finally, let's initiate the rollup node with all the flags:

bash
rollkit start \
    --rollkit.aggregator \
    --rollkit.da_auth_token $AUTH_TOKEN \
    --rollkit.da_namespace $DA_NAMESPACE \
    --rollkit.da_start_height $DA_BLOCK_HEIGHT \
    --rollkit.da_address $DA_ADDRESS \
    --minimum-gas-prices="0.025stake"

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 or Mainnet Beta explorers.

INFO

For details on configuring gas prices, specifically for the Celestia network, see the DA Network Gas Price Guide. 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 data to Celestia's DA layer. Well done! Now, go forth and build something great! Good luck!

Released under the APACHE-2.0 License