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 installedcurl 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:
cd $HOME && rm -rf gm
ignite scaffold chain gm --address-prefix gm --no-module
Install the Rollkit app to ignite:
cd $HOME/gm
ignite app install github.com/ignite/apps/rollkit@rollkit/v0.2.1
Add the Rollkit app:
ignite rollkit add
Build the rollup node binary to use it for the chain configuration and to initialize:
ignite chain build
Initialize the Rollkit chain configuration:
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:
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.
- Mocha testnet: https://rpc-mocha.pops.one/block
- Mainnet Beta: https://rpc.lunaroasis.net/block
Here is an example for the Mocha testnet (replace URL for Mainnet Beta accordingly):
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:
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):
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:
Your DA AUTH_TOKEN is eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJwdWJsaWMiLCJyZWFkIiwid3JpdGUiXX0.cSrJjpfUdTNFtzGho69V0D_8kyECn9Mzv8ghJSpKRDE
Next, let's set up the namespace to be used for posting data on Celestia:
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 ð):
openssl rand -hex 10
Replace the last 20 characters (10 bytes) in 00000000000000000000000000000000000000000008e5f679bf7116cb
with the newly generated 10 bytes.
Lastly, set your DA address for your light node, which by default runs at port 26658:
DA_ADDRESS=http://localhost:26658
ðĨ Running your rollup connected to Celestia light node â
Finally, let's initiate the rollup node with all the flags:
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!