Closed AshtonStephens closed 7 months ago
I've ported the design from the discussion. I added a "Design motivation" to accommodate the third item in the closing checklist, but would like to know if anyone would like to see anything else in particular to be discussed or clarified before I check that box.
The current design is not defining the mechanism which is used to ensure that the signers are collectively calling withdrawal-reject
and withdrawal-accept
. A proposal is to add a signature to these contract calls, to ensure these functions can only be called if they have a collective signature. This requires schnorr signature verification in Clarity contract calls. We need to research if that is possible.
I will open a research discussion for that.
The current design is not defining the mechanism which is used to ensure that the signers are collectively calling
withdrawal-reject
andwithdrawal-accept
. A proposal is to add a signature to these contract calls, to ensure these functions can only be called if they have a collective signature. This requires schnorr signature verification in Clarity contract calls. We need to research if that is possible.I will open a research discussion for that.
Research issue opened: https://github.com/Trust-Machines/sbtc-v1/issues/33
Blocked on #36
I've updated the ticket with the conclusion in #36 I think we are getting close to being able to close this.
Do we need fee information to be provided in withdrawal-accept
? I'm thinking "no", as all of their sBTC is burnt anyways, but want to double check.
Secondly, in withdrawal accept, is the bitmap necessary? If we have a list of signatures, which can be optional
, which can be a de-facto bitmap.
The flow is constant and there may be low level details on the contract side to figure out, though we did decide the following on a call:
We also saying all arguments should be signed by the signers.
We should make a diagram of the communication between Signers once they find withdrawals / deposits to batch.
@netrome can you update the diagram to include the fact that the signers need to wait 6 valid sortitions before making the transaction on Bitcoin.
In fact, I think the Signers will need to:
I think this warrants a brief re-open, and we can quickly close after. This above bit is the part we want agreement on.
In fact, I think the Signers will need to:
- call withdrawal accept
- wait 6 valid sortitions
- make the Bitcoin withdrawal
@AshtonStephens , my assumption was that the withdrawal-accept
transaction would happen after the BTC withdrawal was made and confirmed. One reason is that the signers don't know what the BTC fee rate will be 6 blocks ahead of time, and so it could turn out that the signers will need to reject because of too low of a max fee.
Yeah, withdrawal accept
should not be called until the bitcoin transaction is sufficiently confirmed. Previously I had the whole RBF flow as part of the above chart but I felt like it is all part of the "Signers broadcast a withdraw accept transaction on Bitcoin" step. Success here would entail that the transaction is confirmed on the bitcoin blockchain. But I can re-expand that part again.
I just added "six confirmations on Bitcoin" for now to keep it specific and lean. @AshtonStephens let me know if you'd like to have more details here with the whole "not confirmed" -> "can fee be increased" -> "increase fee" -> "confirmed" etc. flow. I'd personally like to leave that for the LLD tickets which are already expanding these details.
Oh wait, I made a conceptual mistake. There is no need to wait for calling withdraw-accept
instead we must wait for the withdraw-request
transaction to have sufficient confirmations before accepting it. I'll update this in the chart.
Added this very high level diagram to the sBTC-v1 HLD.
Design - sBTC Withdrawal
This ticket holds the design of sBTC Withdrawal and how it fits into sBTC-v1.
Details here: https://github.com/Trust-Machines/sbtc-v1/discussions/9
Proposed Design
Ported from discussion #9
Overview
Breakdown
The main steps of this withdrawal flow are as follows.
withdraw-request
function in the.sbtc
contract..sbtc
contract..sbtc
contract. 2.3. Finally, the signers demonstrate to the chain that they have fulfilled their duty by calling thewithdraw-accept
function in the.sbtc
contract.withdraw-reject
function in the.sbtc
smart contract. This function does the following: 3.1. Returns the sBTC to the holder. 3.2. Records the signer votes.Finally, here is a summary of the necessary contract functions.
withdraw-request
(recipient_address, amount, max_fee, signatures)
amount
of sBTC into the.sbtc
contract and records the request to withdraw returning a uniquerequest_id
. Also records the maximum fee that the user may accept to pay for the withdrawal.withdraw-accept
(request_id, bitcoin_txid, output_index, signer_bitmap, signatures)
request_id
identifies the request,bitcoin_txid
andoutput_index
together identify the Bitcoin UTXO returning the requested amount of BTC to the user.signer_bitmap
records what each signer voted if this information is not already provided in the Bitcoin transactionwithdraw-reject
(request_id, signer_bitmap, signatures)
All functions takes a list of signer signatures as decided in https://github.com/Trust-Machines/sbtc-v1/issues/36
Design motivation
.sbtc
contract calls?withdraw-accept
?withdraw-reject
?Secondly, for visibility on-chain and to record who voted on the transaction.
Closing Checklist