Bitget App
Trade smarter
Buy cryptoMarketsTradeCopyBotsEarnWeb3

How to Deploy a Sovereign Rollup on Celestia’s Local Devnet

Smrti LabSmrti Lab2023/09/29 03:42
By:Smrti Lab

Brought to you by @ 0xfan

0. Introduction

Rollups are intended to provide scaling benefits to Layer 1s. They consist of various components, such as a user client, VM, sequencer, proving system (especially for zk rollups), one or more mempools, and a bridge contract on the Layer 1. There are two primary types of rollups in use today: settlement rollups and sovereign rollups. These types differ significantly from one another.

Settlement Rollups refer to the type that relies on the smart contract on the settlement layer to verify proofs and bridge assets. This smart contract acts as the source of truth for the rollup chain. To protect this bridge smart contract, many rollup teams, like Arbitrum and Optimism, hold tight to the upgrade key to fix any apparent bugs on the rollup at any time. However, this authority, on the other hand, also poses risks for changing the code arbitrarily without being noticed.

Sovereign Rollups were introduced by Celestia, where the rollups themselves operate like a layer 1 blockchain. The Sovereign rollup itself is the source of truth, not the L1. The rollup nodes transfer fraud (validity) proofs through their own P2P network and verify them locally, while only using the base chain to store ordered transactions.

This post provides a guide to building a basic sovereign rollup that uses Celestia as the data availability (DA) and consensus layer for submitting blocks. To implement a basic transfer token function on the rollup, we will use modules like Rollkit and Ignite, and run it on a local devnet. We tested and deployed this on a laptop with the following specifications:

  • CPU: 12th Gen Intel(R) Core(TM) i5-12500H

  • OS: Ubuntu 22.10 x64

  • Memory: 7811 MB

  • Disk: 256 GB SSD Storage

1. Install Docker

  • To begin, update apt-get by running the following command: sudo apt-get update
Update the apt-get
  • To install the latest version of Docker, execute the following command:

    sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Install the latest version of Docker

2. Running Celestia’s local devnet

  • You can initiate Celestia's local devnet by running the following command:

    docker run --platform linux/amd64 -p 26650:26657 -p 26659:26659 ghcr.io/celestiaorg/local-celestia-devnet:main

Running local devnet
  • If you are using WSL, every time you start the WSL, you have to start the docker service by sudo service docker start

  • If sudo service docker start says "Starting Docker: docker" but sudo service docker status shows "Docker is not running":

    • sudo update-alternatives --config iptables

    • and select the path of /usr/sbin/iptables-legacy

  • To stop Docker, first check the container ID by running docker ps. Then, choose the ID of the container you want to stop. For example docker stop a50a233aed94
Docker information
  • After running a devnet, you can check the balance of the smart contract that will be used to post rollup blocks into Celestia's local network. To display this information in a more readable format, you can install jq.

    curl -X GET http://0.0.0.0:26659/balance sudo apt install jq

Check the balance and install jq

curl -X GET http://0.0.0.0:26659/balance | jq

Using jq to display the information

3. Install the Golang and set the environment variables

  • To build this basic rollup based on Cosmos-SDK, you need to install Golang. First, delete the old version of the Golang package.
sudo rm -rf /usr/local/go sudo apt-get remove golang sudo apt-get remove golang-go sudo apt-get autoremove
  • Next, install the Golang package with version 1.19.1.
ver="1.19.1" cd $HOME wget "https://golang.org/dl/go$ver.linux-amd64.tar.gz" sudo tar -C /usr/local -xzf "go$ver.linux-amd64.tar.gz"
Installing Golang Package

Note that if you cannot connect to the network, it is recommended to use https://golang.google.cn/dl instead.

  • Then, we should set the $PATH before running the rollup.
sudo nano /etc/profile export GOROOT=/usr/local/go export GOPATH=$HOME/gowork export GOBIN=$GOPATH/bin export PATH=$GOPATH:$GOBIN:$GOROOT/bin:$PATH
Set the $PATH

One can add environment variables to the user root directory in the .bashrc file to avoid repeated work. Add source /etc/profile at the end of the file.

Adding environment variables to the .bashrc
  • Finally, you can check if the environment is working by using go env
Check the environment

4. Installing Ignite CLI and Rollkit

The Ignite CLI wrapped and included everything that is needed to build a rollup. By using this, it can make the development of the rollup quicker and safer.

  • First, use the following command to install Ignite CLI:

    curl https://get.ignite.com/cli! | bash

Downloading Ignite CLI
  • Then, check the version of Ignite and then build a new rollup.

    ignite version ignite scaffold chain gm

Check the Ignite version
Create a new rollup chain
  • Next, you can install Rollkit by running the following code inside the gm folder.
go mod edit -replace github.com/cosmos/cosmos-sdk=github.com/rollkit/[email protected] go mod edit -replace github.com/tendermint/tendermint=github.com/celestiaorg/[email protected] go mod tidy go mod download
Installing Rollkit

5. Running your basic sovereign rollup

  • To start the rollup, navigate to the gm folder and download the init-local.sh script.
wget https://raw.githubusercontent.com/rollkit/docs/main/docs/scripts/gm/init-local.sh bash init-local.sh
Results of running init-local.sh
  • After starting the rollup, it will be connected to the local Celestia devnet that you are running. The rollup's block is then posted into the devnet, where it functions as the data availability layer.
The rollup’s network
  • To test this simple rollup, you can explore it by sending its native token from one address to another.
gmd keys list --keyring-backend test export KEY1=gm1q6kqngl06ytpgv3z5ft6cmjyke7rg3s5qfduwd export KEY2=gm1a9eh7stvvdpf53w9rass3ka7tnwf9lng74h3cd gmd tx bank send $KEY1 $KEY2 42069stake --keyring-backend test
Confirm the transaction before signing and broadcasting
Successfully transferred
  • You can query the balance of an account using the following commands:

    gmd query bank balances $KEY1 gmd query bank balances $KEY2

Query the balances of both accounts.

6. Conclusion

Starting a sovereign rollup on Celestia's local devnet using well-developed modules like Rollkit and Ignite is very convenient. This post does not cover how to add more functionality to the rollup, which is slightly irrelevant to the post's topic and will be explored in the future.

Mint Entry
0

Disclaimer: everything in the article represents the author's point of view and has nothing to do with this platform. This article is not intended to be used as a reference for making investment decisions.

You may also like

A Physical Dogecoin Could Reach the Moon in December

Dogecoin community plans to send a physical token to the moon in a December mission by space payload transporter Astrobotic.

Coindesk2023/11/16 05:01

Bitcoin Is Coming to Sushi as DeFi Platform Expands to ZetaChain

The move allows users to access the liquidity of bitcoin on decentralized finance (DeFi) without going through intermediaries like wrappers.

Coindesk2023/11/16 08:00

CoinShares Secures Option to Buy Valkyrie's ETF Unit

A takeover would give the company a foothold in the U.S. as investors get optimistic that crypto ETFs will win SEC approval.

Coindesk2023/11/16 08:29

255M Pyth Tokens to Be Airdropped to 90K Wallets Next Week

The Pyth network currently has $1.57 billion in total value secured across 120 protocols.

Coindesk2023/11/16 08:48

‌Spot copy trading

More
AIOnline
AIOnline
insight1000/1000
9359.81%
ROI
Total profit $47735.04
WhaleGo_YouTube
WhaleGo_YouTube
insight500/500
1269.4%
ROI
Total profit $3685.87

Bot copy trading

More
BGUSER-FFF8CNJ4
BGUSER-FFF8CNJ4
insight8/150
$7892.34
Total profit
Total subscriber profits $210.93
TopTrader85
TopTrader85
insight150/150
$13284.03
Total profit
Total subscriber profits $137.16