Replies: 2 comments 1 reply
-
Note: Before sBTC was dropped, there seemed to be a general idea floating around that Signers would accept deposits in a consolidation transaction with an OP_RETURN to trigger sBTC mints. This design would eliminate the need for the The best historic references I have for this design are Jude's comment in the Revealer API discussion and Fernando's comment in the sBTC SIP working doc: I believe that nodes will only be able to execute a mint contract call if they have a valid signature. The node will check for this at every new Bitcoin block. However, I would be interested in knowing how we handle the situation where a valid Schnorr proof is sent for a deposit that occurred in a past block. I have tried to clarify these ideas in the Deposit and Withdrawal flows discussion, which should hopefully shed some light in how I interpret that we envision these user flows to look. |
Beta Was this translation helpful? Give feedback.
-
A higher-level question being addressed here, which may not be a requirement of v1, is whether we care about providing a fallback for a user if their BTC deposit is consumed without having minted sBTC. Once a deposit TX is confirmed, and the details are revealed, the signers can consume their deposit UTXO immediately. This discussion does introduce an ability for a deposit to mint sBTC without the UTXO being consumed by the signers. So, we have two opposing problems: Either:
Unless I'm mistaken, you can't have both. This discussion is saying "If you make a valid deposit, and you reveal that information in a short enough amount of time, then it's on the signers to consume it". |
Beta Was this translation helpful? Give feedback.
-
Note that
*
indicates that we are mentioning a separate aspect of sBTC V1, which is not defined here.tl;dr
Previous specs related to this topic include a voting mechanism for signers to verify and accept blocks. I'm proposing a "clarity-only" mechanism, which doesn't rely on signers at all. This has better guarantees against signer misbehavior, network issues, and other errors.
Intro
When users make a deposit transaction, the "normal" behavior is that their BTC transaction information is sent to a relayer*. Once the relayer picks up the peg-in details, a contract call is made in the sBTC contract*, and the user is minted sBTC. This behavior is the "happy path".
Once a BTC deposit transaction is made, we cannot guarantee that the user will end up with minted sBTC. There are many potential reasons for this, such as:
This discussion outlines the behaviors and mechanisms surrounding the scenario where the user isn't automatically minted sBTC.
Deposit Challenges
In the case that a user's deposit does not automatically mint sBTC, the .sBTC contract provides a challenge mechanism, where the user can directly provide their deposit information on-chain. By allowing direct on-chain interaction, users have improved guarantees about liveness.
To issue a challenge, the user can call the
challenge
function within sBTC. They provide the following information:The
challenge
function verifies the deposit transaction using Clarity-defined logic. If the challenge is successful, the user receives sBTC. By providing a "Clarity-only" route, any issues around signer connectivity are eliminated.challenge
functionInside of the
challenge
function, the .sBTC contract executes the following actions:amount
property of the signer-spendable tap leafamount
within this tap leafVerifying that the deposit was made within X blocks from now
Inside of every deposit output is a tap leaf containing a recovery script, which allows the user to recover their deposit in the case that their deposit was not successful. Part of this recovery script is a basic time-lock, using
$RECOVERY_BLOCKS CHECK_SEQUENCE_VERIFY
. The value$RECOVERY_BLOCKS
is a fixed value defined by the protocol.Because users are able to challenge their deposit using only on-chain data, the sBTC protocol must ensure that the challenge was made before the recovery timelock has expired. Without doing that, users can utilize an attack vector where they recover their deposit and still mint sBTC, thus "double spending".
The protocol defines a
MAX_CHALLENGE_PERIOD
constant, which is the maximum amount of blocks after a deposit that a challenge may occur.It is important that the protocol defines the constants
MAX_CHALLENGE_PERIOD
andRECOVERY_BLOCKS
to balance two factors:MAX_CHALLENGE_PERIOD
cannot be too low (such as 1 block), so that users have time to challengeMAX_CHALLENGE_PERIOD
is not too close toRECOVERY_BLOCKS
, so that signers have time to redeem challenged depositsTo be more specific on the meaning of these two constants:
RECOVERY_BLOCKS
is a constant used in conjunction withCHECK_SEQUENCE_VERIFY
to define a relative amount of blocks after confirmation that the output can be spend. For example, ifRECOVERY_BLOCKS
is100
, the script is spendable 100 blocks after confirmation.MAX_CHALLENGE_PERIOD
defines the maximum amount of blocks, relative to the confirmation of the deposit, during which the deposit can be challenged. For example, with a value of50
, the user has 50 blocks to confirm a challenge transaction on Stacks.Discussion topics
sbtc_payload
in a deposit's output needs to include anamount
, so that we can compareamount
tooutput.value
and verify fees. This is probably already considered, but I didn't see it in the docs.RECOVERY_BLOCKS
andMAX_CHALLENGE_PERIOD
. My ideas are:MAX_CHALLENGE_PERIOD
should be pretty high (perhaps up to 1-2 days), because this provides users enough time to realize and submit challenges.RECOVERY_BLOCKS
: 2 days, or 288 blocksMAX_CHALLENGE_PERIOD
: 275 blocksBeta Was this translation helpful? Give feedback.
All reactions