-
Notifications
You must be signed in to change notification settings - Fork 2
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
[Design]: Bootstrap signer components #44
Comments
We want to include how the signers are chosen and "stored". |
Can you add state regarding how we can fetch current BTC market fees and fees paid to specific BTC transactions? |
Sure, I'm thinking that is something we'll fetch directly from the nodes - for example with ElectrumApi::estimate_fee. |
I'll add some more elaborate component diagrams, and given how large and detailed the state model is I think it makes sense to break it out to it's own LLD design doc. |
I have slimmed this down now. Dumping some of the sections that I have removed which could be useful input for LLD documents: Signer set managementFor sBTC to be operational, we must have a set of active signers and an aggregate key. These signers are governed through the following clarity functions.
The set of sBTC signers is stored in the Coordinating DKGTo have an aggregate key, the signers must run DKG. DKG is triggered through the signer set manager, which act as the DKG coordinator. Once triggered the coordinator will do the following.
Coordinating signer set updateIf a signer wants to rotate keys, the signer set must be updated. This is also managed by the signer set manager. In this scenario, the signer set manager does the following.
Signer reaction to sBTC requestsEach signer must observe Bitcoin, Stacks and the sBTC Deposit API. On every new Bitcoin block a Signer will:
Coordinating signing roundsFor every bitcoin block, a coordinator is selected to coordinate signing rounds for that particular block. The coordinator will
|
TODO: Add another version of the component interaction chart which illustrates in which order the interactions happen for a deposit or withdrawal request. |
I have added a walkthrough section after the component interaction chart, which goes over the pieces of the chart one by one. Let me know if this is helpful or if you'd like me to elaborate more on any aspect. |
Closing now as the team is beginning to shift focus from design to implementation. |
Completing the issue description and arriving at a conclusion is the deliverable of this issue.
Design - Bootstrap signer components
This ticket defines the main components which constitute the sBTC bootstrap signer and how they interact to fulfill deposits and withdrawals in sBTC v1.
1. Summary
We have broken down the sBTC bootstrap signer into the following main components
building on top of these supporting modules
2. Context & Purpose
The sBTC bootstrap signer should be able to coordinate the creation of transactions, maintain shared custody of a bitcoin wallet, and make smart contract calls in the
.sbtc
contract. To manage the complexity of this system, we want to break it down into multiple loosely coupled components of separate functionality.Relevant Research Discussions
External Resources
3. Design
3.1 Proposed Component Design
The bootstrap signer is responsible for:
To fulfill these duties, we have identified the following sub-components of functionality in the Signer.
Block observer
The block observer is the component responsible for populating the bitcoin and stacks blocks in the state. In addition, the observer should parse any requests, responses or other transactions it observes and populate the corresponding pieces of the state.
Signer set manager
The signer set manager is the component orchestrating signer bootstrapping, key rotation and DKG.
Decision engine
The decision engine exposes an extendible interface for deciding whether to accept or reject a sBTC request.
Transaction signer
The transaction signer is responsible for participating in WSTS signing rounds for any approved transactions.
Transaction coordinator
The transaction coordinator is responsible for orchestrating WSTS signing rounds, and submitting the resulting transactions to the blockchain.
Request sequencer
The request sequencer is responsible for creating the next sBTC transaction for the coordinator to handle in a signing round given the signer state.
Bitcoin interface
Support module that helps the signer interact with the Bitcoin blockchain.
Stacks interface
Support module that helps the signer interact with the Stacks blockchain.
Deposit API interface
Support module that allows the signer to communicate with the Deposit API.
Signer network
Module that provides an interface to allow signers to talk to each other.
sBTC transactions
Library that helps the signer create and validate sBTC specific transactions.
3.1.1 Design diagram
The following picture contains the main components for the signers. Lower components are more fundamental and have less dependencies, whereas the higher components typically depend on the pieces below them. They are color coded according to:
Furthermore, this picture illustrates their main interactions with each other and the signer state.
![Bootstrap signer component interactions - Full bg](https://private-user-images.githubusercontent.com/22524681/326421648-339bc5bd-a619-40a9-9308-ae850a1bdbed.svg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk0MjQ4NjEsIm5iZiI6MTcxOTQyNDU2MSwicGF0aCI6Ii8yMjUyNDY4MS8zMjY0MjE2NDgtMzM5YmM1YmQtYTYxOS00MGE5LTkzMDgtYWU4NTBhMWJkYmVkLnN2Zz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI2VDE3NTYwMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTBmYTIyMDg2YTZiOGQxOThiMWJjZDZlMjRhZDRmZWU1Njk0ODQ5NzAxYmFjNTk4YzU5ZWVkMjk5OGU2MjA1ZWImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.GWfeWjLcVkYac8y-LkSphtGJR67_mhLYy2KWciGn1XM)
Component interaction walkthrough
The above chart can be a mouthful at first glance, so let's walk through what happens in the signer.
1. The block observer populates the signer with chain state data
The block observer is responsible for constructing the signer's view of the state of Bitcoin and Stacks. In practice, this means that the block observer populates all tables outlined in #44 except for
deposit_signers
,withdraw_signers
anddkg_shares
.It uses the Stacks and Bitcoin interface to get block data from the respective chains. The relevant data is extracted and stored in the appropriate tables. The block observer interacts with the Deposit API interface to know of pending deposit requests, and it communicates status updates back to the Deposit API.
2. The signers start listening and reacting to DKG and Signing round messages
The signers listen to inbound messages for DKG and signing rounds, and participate in these processes.
3. The Signer set manager coordinates DKG
The signer set manager can observe the current signer set in the database. Using this information, the signer set manager is able to coordinate a DKG round and set the aggregate key in the
.sbtc
contract.4. The signers observe requests and communicate their decisions.
The signers observes all pending requests that they have not yet made a decision for. For these requests, the signer calls the decision engine to decide whether to accept or reject the request. These decisions are stored in the database and communicated to the other signers over the signer network.
The signer listens to all decisions coming in from other signers and stores these decisions in its own database as well.
5. The transaction coordinator constructs and coordinates signing for transaction responses
The transaction coordinator observes the signer state and fetches all pending requests, along with the signer decisions. This information is passed to the request sequencer which constructs the next sBTC transaction to be signed and broadcasted. The coordinator coordinates a signing round for this transaction and broadcasts the signed transaction to either the Stacks or Bitcoin blockchain depending on which transaction it is.
3.1.2 Considerations & Alternatives
3.2 Areas of Ambiguity
This is a very high level overview of the signer operations and leaves room for further low-level design for the individual components.
Closing Checklist
The text was updated successfully, but these errors were encountered: