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]: Get signers' UTXO #538

Closed
1 task
djordon opened this issue Sep 17, 2024 · 0 comments · Fixed by #567 or #584
Closed
1 task

[Feature]: Get signers' UTXO #538

djordon opened this issue Sep 17, 2024 · 0 comments · Fixed by #567 or #584
Assignees
Labels
sbtc bootstrap signer The sBTC Bootstrap Signer.

Comments

@djordon
Copy link
Contributor

djordon commented Sep 17, 2024

Feature - Get signers' UTXO

1. Description

Before the signers can construct a bitcoin transaction, they need to locate the sole UTXO under their control. This UTXO is used as an input into all transactions that sweep in or out BTC for deposit or withdrawal requests. The goal is to implement functionality for the signers to retrieve the relevant information for this UTXO.

1.1 Context & Purpose

We need to implement the BitcoinInteract::get_signer_utxo function to get the signers' UTXO. There will always be exactly one such UTXO in our database. This function returns a UTXO where the following holds:

  1. The transaction is in a block on the canonical bitcoin blockchain.
  2. The output is the first output in the transaction.
  3. The output's scriptPubKey matches one in the stored values in the dkg_shares.script_pubkey column.
  4. The output is unspent. It is possible for more than one transaction within the same block to satisfy points 1-3, but if the signers have one or more transactions within a block, exactly one output satisfying points 1-3 will be unspent.
  5. The block that includes the transaction that satisfies points 1-4 has the greatest height of all such blocks.

2. Technical Details:

The transactions in the transactions table with tx_type set to 'sbtc_transaction' are all bitcoin transactions where one of the outputs are spendable by the signers. This makes it possible to find a set of transactions that will satisfy the above criteria.

2.1 Acceptance Criteria:

  • The BitcoinInteract::get_signer_utxo returns the signers’ UTXO.

3. Related Issues and Pull Requests (optional):

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
Archived in project
2 participants