Brought to you by @ 0xfan
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
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
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
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
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
curl -X GET http://0.0.0.0:26659/balance | jq
Note that if you cannot connect to the network, it is recommended to use https://golang.google.cn/dl instead.
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.
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
Then, check the version of Ignite and then build a new rollup.
ignite version ignite scaffold chain gm
You can query the balance of an account using the following commands:
gmd query bank balances $KEY1 gmd query bank balances $KEY2
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.