paint-brush
Bitboost: an EVM Co-processor for Bitcoin Mainnetby@bitboost
186 reads

Bitboost: an EVM Co-processor for Bitcoin Mainnet

by BitboostDecember 19th, 2023
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

The Bitboost co-processor is a programmable execution environment on Bitcoin. It uses Bitcoin for sequencing and storage of transactions, while an indexer with EVM integrated is used for transaction execution.

Company Mentioned

Mention Thumbnail
featured image - Bitboost: an EVM Co-processor for Bitcoin Mainnet
Bitboost HackerNoon profile picture

We have seen a trend of issuing assets on Bitcoin, for example, protocols like Ordinals, BRC-20, and Atomicals. These protocols store data on the Bitcoin blockchain and use an off-chain indexer to parse the data and generate states. This greatly enriches the assets and ecosystem on Bitcoin.


However, currently these protocols only support some basic functions of assets, such as deployment, minting, transfer, and exchanges with BTC through PSBT (Partially Signed Bitcoin Transactions). Users cannot define more behaviors of assets, which limits the application scenarios of these assets. Applications such as swaps, lending, stablecoins, etc. cannot be implemented on existing protocols.


Therefore, we propose an upgraded protocol to build a programmable execution environment on Bitcoin and call it a Bitcoin co-processor. It uses Bitcoin for sequencing and storage of transactions, while an indexer with EVM integrated is used for transaction execution. In this co-processor, there is a native token that is minted through PoW (Proof of Work). The native token can be exchanged with BTC trustlessly using PSBT, establishing an economic link between the co-processor and BTC. Users can use the native token as gas to create and call smart contracts in the co-processor.


The architecture of Bitboost co-processor

How it works

Transaction Structure

An EVM-executable co-processor transaction consists of the following fields. Please note that when the Data field is empty, it is a token transfer transaction; when the Data field has content, it is a smart contract transaction.


Nonce
Sig
From
To
Value
Gas
Data


We store it in a Bitcoin transaction in the following format.

  • All fields are inscribed into the witness of an input.

Transaction

When the indexer detects a transaction on Bitcoin that matches this format, it triggers its execution in EVM.

Mint Transaction

To mint the native token in the co-processor, we define the mint transaction. It is similar to the coinbase transaction in Bitcoin.

  • The first input inscribes To into its witness.

Mint Transaction

Miners can try different ways to modify the transaction hash until it meets a difficulty requirement, for example, changing the change address or adding an OP_RETURN output with random data inside. Once such a transaction appears on Bitcoin, the native token will be rewarded to the To address. We will also introduce a difficulty adjustment mechanism to ensure that the native token is minted at a constant rate over time.

Lock Transaction

The lock transaction is used to lock a certain amount of native token into a UTXO, which can be later used for PSBT exchange with BTC. Its transaction structure is as follows.

  • All needed fields are inscribed into the witness of an input.
  • The first output is the target UTXO where the native token will be locked.

Lock Transaction

This transaction will deduct the Value amount of the native token from the From address's balance and lock it into the target UTXO.

Exchange Transaction

The exchange transaction uses UTXO from the lock transaction to construct a PSBT, which sells the native token for BTC trustlessly. Its structure is as follows.

  • The first input is the UTXO with native token locked. Its signature only applies to the first input and the first output.
  • The buyer will add the second input, which contains the BTC to spend and all needed fields inscribed into its witness.
  • The first output is the BTC receiving address from the seller.

Exchange Transaction

When such a transaction is detected, the native token will be unlocked from the UTXO and added to the To's balance.

Performance Improvements

Batch Inscription

Multiple co-processor transactions can be inscribed into a single Bitcoin transaction to save gas fees. In this way, each co-processor transaction only requires about 1/4 of the gas fee compared to a Bitcoin transaction because all of its data is stored in the witness.

Batch Inscription

Any third party can be a batch builder, receiving co-processor transactions and inscribing them into a Bitcoin transaction. This will increase the finality speed of co-processor transactions. For example, you can create a Uniswap on Bitboost and then maintain a batch builder for receiving all the transactions that interact with the Uniswap. In this way, you sequence these Uniswap transactions and provide instant finality, just like a sequencer in rollups.

Transaction Compression

Co-processor transactions can be further compressed like rollup transactions. This will reduce the transaction size to 12 bytes, which is approximately 1/10 of its original size. So, overall, the gas fee for a Bitboost transaction can be as low as about 1/40 of a Bitcoin transaction.

From https://vitalik.eth.limo/general/2021/01/05/rollup.html

Conclusion

This protocol builds an EVM execution environment on Bitcoin. Users can do anything in this execution environment just like on Ethereum, such as transferring native tokens, issuing ERC-20 or ERC-721 tokens, creating smart contracts, etc. It uses Bitcoin as the sequencer and data availability layer. Its only connection to Bitcoin is a PSBT-based decentralized trading pair between the native token and BTC. Some improvements can be applied to reduce its gas costs to about 1/40 of Bitcoin. The entire protocol is trustless and has the same security level as Bitcoin.


A more detailed and frequently updated version is also published here https://docs.bitboost.org/