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.
ðïļ Prerequisites â
From the GM world rollup tutorial, you should already have the rollkit
CLI and ignite
installed.
ðïļ 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
Next, move to the gm
directory and add the Rollkit app:
ignite rollkit add
Initialize the Rollkit chain configuration:
ignite rollkit init
This will create a $HOME/.gm
directory with the chain configuration files.
𧰠Configuring your rollup â
From inside the $HOME/gm
directory, generate a rollkit.toml file by running:
rollkit toml init
The output should be similar to this (our $HOME
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
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, and for mainnet beta - https://rpc.lunaroasis.net/block
Here is an example for the Mocha testnet (replace URL for mainnet beta if needed):
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:
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):
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:
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:
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.
ðĨ Running your rollup connected to a Celestia light node â
Now let's run our rollup node with all DA flags:
rollkit start \
--rollkit.aggregator \
--rollkit.da_auth_token $AUTH_TOKEN \
--rollkit.da_namespace $DA_NAMESPACE \
--rollkit.da_start_height $DA_BLOCK_HEIGHT \
--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 or mainnet beta explorers.
INFO
For details on configuring gas prices specifically for the DA network, see our DA Network Gas Price Guide. This is separate from the --minimum-gas-prices="0.025stake"
setting, which is used for 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!