bob-collective / bob

BOB is a hybrid L2 that combines the security of Bitcoin with the versatility of Ethereum.
https://app.gobob.xyz/
85 stars 42 forks source link

BOB: Late Middle Ages #4

Closed nud3l closed 1 year ago

nud3l commented 1 year ago

Abstract

Develop a PoC for the BOB stack that allows:

  1. Builders to deploy EVM contracts and use a BTC relay to interact with Bitcoin.
  2. Users to bridge between a testnet and the rollup (ETH, ERC20) as well as bridge between Bitcoin (BTC) and the rollup via a mock BTC bridge.

Motivation

The Late Middle Age was a period in Europe preceding the Renaissance. It was characterized by many crisis but saw great progress in the arts and sciences. We chose this name for BOB to reflect the many decisions that will have to be made for the stack and at the same time, the new achievements we will be able to make.

BOB is a large project, and having a PoC will allow us to understand the difficulties in bringing it to the testnet and mainnet readiness.

Goals

Target completion: End of September 2023

Specification

Deliver a proof of concept implementation of the BOB stack rollup and builder platform.

Organizational

Research

Chain

Smart Contracts

Solidity/EVM

UI

gregdhill commented 1 year ago

We have chosen to use the production ready tBTC-v2 (summa / keep-network) relay contracts and supporting libraries to support the initial development of the BOB stack. The contracts are already well-optimized for gas consumption and have been used on mainnet Ethereum for quite some time.

A specific advantage of using the Simple Payment Verification (SPV) "Light Relay" developed for tBTC is that we do not need to store all block headers from the genesis / initialization height. It uses stateless SPV proofs and provides some recency guarantee using Bitcoin's difficulty adjustment based on the latest retarget.

How does it work?

Notes

There was only one issue highlighted in the Least Authority audit related to the SPV client which was also identified in the interBTC (Substrate / Polkadot) code here. We can solve this issue by checking the coinbase proof as was implemented there. Since BOB will be deployed as a rollup we can make some tradeoffs with regard to gas consumption.

Alternatives

interlay/btc-relay-solidity

This is a Bitcoin chain relay we (Interlay) built a few years ago. It makes use of the summa libraries and provides additional tooling for alternate script types. The relay itself is a "full" SPV client which requires us to validate and store all blocks. It is not gas efficient and contains several notable bugs including reorging the chain based on the height alone - not considering work accumulated. We made the same mistake in the interBTC (Substrate / Polkadot) code here.

ethereum/btcrelay

The "official" Ethereum BTC Relay which has mostly been abandoned by this point. The code has not been updated in several years and the deployment is also unmaintained. It was built using serpent an assembly language with high-level features that compiles to EVM code - the tooling is also not maintained.

Resources

nud3l commented 1 year ago

@gregdhill as a follow up, can you create a new issue on deploying the BTC relay and figuring out our open questions? Then we can close this issue.