Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BOB: Late Middle Ages #4

Closed
11 of 12 tasks
nud3l opened this issue Aug 30, 2023 · 2 comments
Closed
11 of 12 tasks

BOB: Late Middle Ages #4

nud3l opened this issue Aug 30, 2023 · 2 comments
Labels

Comments

@nud3l
Copy link
Contributor

nud3l commented Aug 30, 2023

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

  • Builders can spin up a local testnet
  • Builders can deploy EVM smart contracts on the local testnet
  • Builders can interact with a BTC relay (can still be mocked in parts)
  • Users can interact with a local testnet via EVM interfaces (wallets, ethers.js) bridging ETH/ERC20s/BTC
  • Completed design for a novel Bitcoin bridge
  • Alpha-stage documentation for the rollup design and how to build on it

Specification

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

Organizational

  • Create a new GitHub org
  • Publish new docs

Research

  • Specification for BTC bridge
  • Decide which rollup stack to use

Chain

Smart Contracts

Solidity/EVM

  • Mock deployment for BTC bridge: supply collateral, mint synthetic BTC, redeem synthetic BTC, swap synthetic BTC with BTC
  • Evaluate existing BTC relay options (Interlay, tBTC, ...) according to maturity, cost, features (taproot, segwit, ...)
  • Deploy a BTC relay

UI

  • Create a new UI repo
  • Proof of concept
    • Setup ethers.js for account management and runtime interaction
    • WalletConnect 2.0 or MetaMask wallet integration
    • Transfer ERC20 on rollup
@nud3l nud3l added the roadmap label Aug 30, 2023
@nud3l nud3l changed the title Milestone 1: Middle Ages BOB: Middle Ages Sep 11, 2023
@nud3l nud3l changed the title BOB: Middle Ages BOB: Late Middle Ages Sep 15, 2023
@gregdhill
Copy link
Contributor

gregdhill commented Oct 10, 2023

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?

  • The light relay is initialized to the beginning of a difficulty period (epoch)
  • A "maintainer" submits proofLength block headers before and after the retarget
  • The relay validates the chain and updates the expected difficulty for blocks in that epoch
  • A user can then submit a transaction proof in that or the last period
    • Requires header chain of at least txProofDifficultyFactor

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
Copy link
Contributor Author

nud3l commented Oct 16, 2023

@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.

@nud3l nud3l closed this as completed Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

No branches or pull requests

2 participants