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

[Feature]: Link stacks blocks with bitcoin blocks #559

Open
3 tasks
djordon opened this issue Sep 24, 2024 · 0 comments
Open
3 tasks

[Feature]: Link stacks blocks with bitcoin blocks #559

djordon opened this issue Sep 24, 2024 · 0 comments
Labels
sbtc bootstrap signer The sBTC Bootstrap Signer.

Comments

@djordon
Copy link
Contributor

djordon commented Sep 24, 2024

Feature - Link Stacks blocks with Bitcoin blocks

1. Description

The signer data model ties Stacks (and bitcoin) transaction data to the bitcoin blockchain. So when there is a reorg of the bitcoin blockchain, we are supposed to know which Stacks transactions have been invalidated. The problem is we haven't yet explicitly linked Stacks transactions to the bitcoin blockchain.

This issue is about completing the final step of linking Stacks blocks to Bitcoin blocks, and thus the canoncial bitcoin blockchain.

1.1 Context & Purpose

Knowing which Stacks transactions are invalid is needed for figuring out a number of important things, such as:

  1. Whether a withdrawal request has actually occurred.
  2. Whether we still need to mint sBTC for an accepted deposit request.
  3. Whether the last step of the withdrawal request has been fulfilled.

And probably other stuff too.

2. Technical Details:

The signer already listens for new Stacks blocks via the stacks-core event observer. These stacks-core new block webhooks include the chain tip of the bitcoin blockchain in the message, so storing that would get us a long way there for linking Stacks blocks to bitcoin blocks.

The remaining work is in ensuring that we can still link Stacks blocks with bitcoin blocks if a signer misses these webhooks for any reason. This can be done by using one of the newly added endpoints to stacks-core for fetching "sortition" info, which includes the associated bitcoin block for a consensus hash.

2.1 Acceptance Criteria:

  • For each Stacks block, store the associated bitcoin block as part of processing POST /new_block webhooks.
  • We add functionality for fetching the latest sortition information from stacks-core, which returns the bitcoin block that is tied to a consensus hash (and consensus hashes are included in Nakamoto block headers).
  • We fetch and store the associated bitcoin block when doing any backfilling of the stacks block chain.

3. Related Issues and Pull Requests (optional):

The stacks-core event observer was added in #474.

Solving this ticket would help solve these issues:

@djordon djordon added the sbtc bootstrap signer The sBTC Bootstrap Signer. label Sep 24, 2024
@djordon djordon added this to the sBTC MVP Code Complete milestone Sep 24, 2024
@djordon djordon changed the title [Feature]: Link Stacks blocks with Bitcoin blocks [Feature]: Link stacks blocks with bitcoin blocks Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sbtc bootstrap signer The sBTC Bootstrap Signer.
Projects
None yet
Development

No branches or pull requests

1 participant