🗞️Sovereign rollups on Bitcoin with Rollkit

By Rollkit

Posting data on Bitcoin with Taproot

On Feb. 1, 2023, the Luxor mining pool mined the largest Bitcoin block (#774628) ever, approximately 4 MB. Most of the blockspace was used to inscribe a Taproot Wizards NFT with Ordinals, a project that implements NFTs on Bitcoin by publishing the image data on-chain.

Bitcoin NFTs use Taproot witnesses to inscribe arbitrary data, enabled by Bitcoin's Taproot upgrade. Taproot witnesses provide a slightly better payload-to-data ratio than SegWit transactions. A standard transaction can include up to around 390kB of arbitrary data while still passing through the public mempool. A non-standard transaction, included by a miner directly without passing through the mempool, can include close to 4MB of arbitrary data. In short, with SegWit, it became viable to post big blobs of data to the Bitcoin blockchain.

Since then, the usage of Ordinals for NFT inscriptions and Taproot utilization has kicked off. Eric Wall found that at the time of his tweet, posting data on Bitcoin was 7x cheaper than Ethereum. Now that there are thousands of inscriptions on Bitcoin, it has become clear that sovereign rollups and an ecosystem of dapps on Bitcoin could become a reality. The missing piece: a rollup framework for easily integrating Bitcoin as a data availability layer.

Integrating Bitcoin as a data availability layer into Rollkit

Rollkit is a modular framework for rollups, where developers can plug-in custom execution layers and data availability layers. Initially, Rollkit only supported Celestia as an option for data availability and consensus. Now, Bitcoin is an option, thanks to an early research implementation of a Bitcoin data availability module for Rollkit. In this case, sovereign rollups manage their own execution and settlement while offloading consensus and data availability to Bitcoin.

How Rollkit posts data to Bitcoin

To write and read data on Bitcoin, we make use of Taproot transactions. To facilitate this, we implemented a Go package called bitcoin-da that provides a reader/writer interface to Bitcoin. For details of how the interface works and how it uses Taproot, see the specs. The package can be re-used by any project that wants to read or write data on Bitcoin.

Rollkit was built with modularity at its core. It has a data availability interface so that developers can simply implement specific methods to add a new data availability layer. To add a data availability layer, implementers need to satisfy the DataAvailabilityLayerClient interface which defines the behavior of the data availability client, and the BlockRetriever interface which defines how blocks can be synced. These interfaces live in the da package. The most important methods in these interfaces are SubmitBlock and RetrieveBlock for reading and writing the blocks.

After implementing the Taproot reader/writer interface for Bitcoin (bitcoin-da), adding it as a data availability module for Rollkit took less than a day. We mostly only had to implement the SubmitBlock and RetrieveBlocks functions for Rollkit to call the Read and Write methods in bitcoin-da.

Last updated