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

Bitcoin to Stacks Bridge (sBTC) #23

Open
will-corcoran opened this issue Jun 21, 2024 · 5 comments
Open

Bitcoin to Stacks Bridge (sBTC) #23

will-corcoran opened this issue Jun 21, 2024 · 5 comments

Comments

@will-corcoran
Copy link
Contributor

will-corcoran commented Jun 21, 2024

Recipient: Set Crew
Bounty: $60,000

Project Approach

  • Objective: Build a centralized website for sBTC <> BTC bridging for Stacks and Bitcoin users.
  • Features:
    • Depositing BTC: Guide users to deposit BTC and exchange it for sBTC, providing clear user paths.
    • Withdrawing sBTC: Enable secure withdrawal from sBTC to BTC, completing the user experience.
    • Transaction History: Allow users to confirm transaction statuses with detailed history.
    • Resources: Provide comprehensive information, FAQs, and documentation about sBTC.

Deliverables

  • Module I - Kickoff:
    • High-Fidelity Designs
    • Project Scaffolding
  • Module II - Routes:
    • Withdrawal and Deposit Routes
    • Fetchers
    • Wallet Integration
  • Module III - Views:
    • Dashboard, History, and Resources Views
    • Additional and Route Integration Views
  • Module IV - Deployment:
    • Post-Conditions
    • Integration and Testnet Tests
    • Deployment
  • Module V - Maintenance:
    • Quarterly Maintenance (Q4 2024 & Q1 2025)

Roadmap & Timeline

  • Development Timeline: Kickoff on Jun. 1st with target delivery by Aug. 15th.
  • Deliverables: Tangible outputs such as designs, routes, views, and integrations at each milestone.
  • Maintenance: Commitment to two quarters of maintenance post-launch for bug fixes and feature updates.
@will-corcoran
Copy link
Contributor Author

Hi @setbern -

I hope you are well.

Now that we are about a month into having awarded this Critical Bounty, we would kindly request that you provide an update here for the community. Before the end of the week (Friday, August 16th) can you please provide us an update on the status of your Critical Bounty, please make sure to include:

  • Summary of CB-related work that has been done to date
  • Summary of CB roadmap from here to completion
  • Flag an potential blockers
  • Anticipated date of completion
  • Link to all related repos (remember all funded work should be open source)

Thanks!
Will

cc: @shaktistacks

@setbern
Copy link

setbern commented Aug 27, 2024

  1. Summary of CB-related work that has been done to date

    • Completed designs
    • Completed front end UI with mocked logic
    • Helping sbtc emily api team

    Here is a link towards a documentation/updates gitbook which details latest updates/ designs and current working items.
    Documentation

  2. Summary of CB roadmap from here to completion

    • Currently the sbtc bridge is blocked by the emily api, waiting for completion of the api will enable the sbtc bridge to start testing and moving forward towards completion
  3. Flag a blockers

    • Emily API (the powerhouse behind the curtain that handles deposit and withdraws)
  4. Anticipated date of completion

    • This is hard to estimate since I'm not in full control over when it can be completed, sbtc bridge is heavily dependent on the emily api and this is currently being worked on. The sbtc team has estimated the api will be in testing state in 2 weeks which would allow me 2 weeks to plug in and test. Estimate end of September.
  5. Link to all related repos (remember all funded work should be open source)

Documentation - https://github.com/Strata-Labs/sbtc-bridge-docs
Code - https://github.com/Strata-Labs/sbtc-bridge

@will-corcoran
Copy link
Contributor Author

Hi @setbern

We're exploring allocating our remaining 2024 grants budget and considering follow-up funding for current Critical Bounty recipients. If you have ideas to enhance your previously awarded work, we'd like to hear from you.

Next Steps:

  1. If you're interested in follow-up funding, please let us know by the end of this week.
  2. You can either:
  • Post your proposal as a comment on this issue (preferred for final submissions)
  • Email me your initial thoughts if you're still developing your idea or prefer privacy

Proposal Details:

  • Please include:
    • Additional scope or enhancements
    • Associated costs
    • Justification for how a follow-up grant could significantly boost the ROI of the initial grant

We look forward to your ideas!

Best,
Will

@setbern
Copy link

setbern commented Sep 25, 2024

@will-corcoran

1) Custodial Wallet Functionality (50 hours)

At the launch of the sBTC bridge we'll only support Leather and Xverse wallets to interact with the bridge.
We'd like to be able to support custodial wallet opening up the possibility of accounts from Coinbase, Kraken etc to leverage the sBTC bridge themselves

1.1) Withdraw (20 hours)
1.2) Deposit (20 hours)
1.3) Testing (10 Hours)

2) Transaction Sponsorship (40 hours)

We'd like to give the ability for user to have their transaction sponsored to decrease the friction for interacting with stacks and sBTC from either side. Giving users the ability to have their transaction sponsored (from either Deposit or Withdraw) from a white listed service or application would open funnels for their service or apps.

2.1) Stacks Sponsorship (10 hours)
2.2) Bitcoin Sponsorship (20 hours)
2.3) Testing (10 hours)

3) Improve Transaction Tracking/Events (35 hours)

Our event tracking is barebone to get the most important features out as soon as possible, we've left out some helpful items that would aid in user usage. Specifically, letting the user know exactly when their funds are ready to be used on either Deposit or Withdraw events from a web based push notification. Additionally expanding on our user event page giving the user the ability to search for a transaction or events based on a wallet (either BTC or Stacks based) for greater clarity.

3.1) Add browser based notifications (15 hours)
3.2) Improve user history (10 hours)
3.3) Testing (10 hours)

@setbern
Copy link

setbern commented Oct 25, 2024

@will-corcoran

Project Updates

Working with the sBTC team has been nothing short of a pleasure, we've made great progress and built something we're all really proud of!

As of today the bridge has been laser focused to guide and enchance the user through the deposit flow. Choosing to withhold development resources for Withdraw until we've nailed the deposit flow as expected.

Below is a break down of how the bridge currently handles the deposit and what is currently being worked on to wrap up the previous work commitment.

These sections are broken down into the following sections

  1. Information Collection And Display
  2. Bitcoin Deposit Transaction
  3. External API Integration

Information Collection and Display

We've designed (Check resources) and mapped all our user actions that are most critical.

Deposit Flow Design

  • Collect amount desired to deposit
  • Collect STX Address
  • Confirm Necessary info for deposit transaction
  • Confirmation of Deposit transaction
  • Transaction Status (Via Emily)
  • Transaction Status (Via RPC)
    (the last 2 items are very similar view but vary based on the current status of the deposit transaction)

Withdraw Flow Design

  • Collect amount desired to withdraw
  • Collect BTC Payout Address
  • Confirm Necessary info for deposit transaction
  • Confirmation of Deposit transaction
  • Transaction Status (Via Emily & Stacks Blockchain API)
  • Transaction Status (Via RPC)

Deposit Flow Display & Data Handling

All of the deposit flow display designs are built out and currently being battle testing against our development environment aka devenv.
While this is sadly still at a local development stage and very hard to test in publicly accessible way, though this falls into our priority for the following week.

That being said I will follow up with a demo video of the current moving parts in the next days.

Bitcoin Deposit Transaction

While tucked in between the Data Confirmation view and Transaction Confirmation view the mvp of functionality so far for the bridge has been manually creating (for the time being)
the deposit transaction.

The deposit transaction is a custom transaction with X amount of inputs and 2 outputs.
The inputs are dynamically created based on the current amount of btc held with said wallet and how much is being sent out (nothing too crazy here)

The outputs are our north start, we have 2 main outputs in the same order

  1. a P2TR output
  2. a P2WPK for any change to be sent back to the sender

The P2TR output is a script spend path with 2 tap leaves.
The first being the deposit script which will be used by the signer if all goes all planned
The second being the reclaim script for the ability for the sender wallet to reclaim in case the signer was not able to use the deposit.

This custom transaction relies on some external data so is subjected to improvements.
As well we have planned to support Leather Wallet PSBT API for native Leather Wallet use.

External API Integration

The bridge relies heavily on pulling status information from 2 main parties, the Bitcoin RPC the transmitted the transaction and our famous Emily API.

While the usage and capabilities of Bitcoin RPC are out of scope for this document we will detail how Emily plays a vital role for the Bridge.
Emily provides the current status for a withdraw or a deposit based on the response from querying a certain Bitcoin deposit transaction ID or STX withdraw transaction ID.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants