Skip to content

Commit

Permalink
sBTC DR/Hand-off Docs (#65)
Browse files Browse the repository at this point in the history
* First draft of sBTC DR docs, so we can start working and discussing

* Apply suggestions from code review

Co-authored-by: Mårten Blankfors <nilssonmartenx@gmail.com>

* feat: add boostrap page

* feat: add simple flow page for sbtc 0.1

* summary of hand-off process

clarified which contract call

---------

Co-authored-by: MarvinJanssen <MarvinJanssen@users.noreply.github.com>
Co-authored-by: Mårten Blankfors <nilssonmartenx@gmail.com>
Co-authored-by: friedger <mail@friedger.de>
Co-authored-by: José I. O <30682875+jo-tm@users.noreply.github.com>
  • Loading branch information
5 people authored Aug 16, 2023
1 parent 11a2e8d commit 8e5bfd2
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
- [sBTC Releases](./sbtc-releases.md)
- [sBTC 0.0.1](./sbtc-releases/sbtc-alpha.md)
- [sBTC 0.1](./sbtc-releases/sbtc-dev.md)
- [Boostrap](./sbtc-releases/sbtc-dev/bootstrap.md)
- [Simple flow](./sbtc-releases/sbtc-dev/simple-flow.md)
- [sBTC 0.2](./sbtc-releases/sbtc-dev-v2.md)
- [sBTC 1.0](./sbtc-releases/sbtc-nakamoto.md)
- [sBTC 1.1](./sbtc-releases/sbtc-nakamoto-v2.md)
Expand Down
6 changes: 5 additions & 1 deletion src/sbtc-releases/sbtc-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ TODO [#42](https://github.com/stacks-network/sbtc-docs/issues/42): Explain steps

### Pool

The sBTC Stacking pool proper that allows Stackers to participate in the sBTC PRotocol. Stackers will participate in the distributed key generation scheme and individually vote on the next Bitcoin wallet address to use. They vote by locking their STX for the next cycle.
The sBTC Stacking pool proper that allows Stackers to participate in the sBTC Protocol. Stackers will participate in the distributed key generation scheme and individually vote on the next Bitcoin wallet address to use. They vote by locking their STX for the next cycle.

TODO [#43](https://github.com/stacks-network/sbtc-docs/issues/43): Is it deserving of a sub page? Will be a lot of information here on how to use the Stacking pool and voting.

Expand Down Expand Up @@ -96,6 +96,10 @@ The sBTC Developer Release consists of the following contracts:

[Auto-generated list of errors based on latest tagged release.]

## Running sBTC Developer Release
Detailed instructions can be found on the [bootstrap](./sbtc-dev/bootstrap.md) page.

A simple flow is described on the [simple flow](./sbtc-dev/simple-flow.md) page.

## Things we need to formulate

Expand Down
30 changes: 30 additions & 0 deletions src/sbtc-releases/sbtc-dev/bootstrap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Bootstrapping sBTC 0.1

## Local setup
### Requirements
* install [clarinet](https://github.com/hirosystems/clarinet)
* checkout sbtc-mini/631-deployments branch of repository [github.com/Trust-Machines/stacks-sbtc](https://github.com/Trust-Machines/stacks-sbtc)

### Launch devnet

In a first console
```
cd sbtc-mini
# Press N when asked to overwrite deployment script
./scripts/integration-test.sh
```
See clarinet dashboard what until local devnet is ready (around block 137)

![clarinet dashboard](https://user-images.githubusercontent.com/1449049/258456703-44d219ae-3516-47a3-aa4b-d3e6dc6a8f6a.png)

In a second console run the bootstrap call

```
# Press Enter when asked to overwrite
clarinet deployments apply deployments/bootstrap.devnet-plan.yaml
```

In first console, press N to produce a block and see how the tx is processed.

See `settings/Devnet.toml` for seed phrases for pre-filled accounts.

13 changes: 13 additions & 0 deletions src/sbtc-releases/sbtc-dev/hand-off.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Hand-off process

The contract call required to confirm the hand-off process is `sbtc-hand-off::relay-hand-off-fulfillment`.

The hand-off process can start during the `start-transfer-window` window of the current cycle which is defined in the sbtc-stacking-pool contract as the `transfer` state. The length of the window is defined in the sbtc-staking-pool contract as `normal-transfer-period-len`.

The hand-off can be triggered when a Bitcoin transaction that sends the peg-balance to the shared threshold address is confirmed. This Bitcoin transaction must have all of its outputs pointing to the next treshold wallet scriptpubkey. It is not a hard requirement that all of the outputs aren't required to point to the shared treshold address, in this implementation of the contract, it is (open to other implementations). The value of all the outputs must be greater than or equal to the peg balance for the hand-off function to pass.

The transaction being confirmed must be submitted in the segwit-encoded format even if its inputs do not contain segwit inputs (open to other implementations).

# Incentives

The signers are incentivized to confirm that the hand-off process has been fulfilled or else penalties will start to be applied. We're assuming happy path in the DR so these penalties are not applied.
11 changes: 11 additions & 0 deletions src/sbtc-releases/sbtc-dev/simple-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Simple Flow

## Local environment
Signer uses wallet_1, wallet_2, wallet_3 from the settings.toml file.

sBTC User uses wallet_9.

1. In cycle N registration window (block #140), signer calls sbtc-stacking-pool.signer-pre-register with wallet_1 btc address as reward address.
2. In cycle N + 1 registration window (block #150), signer calls sbtc-stacking-pool.signer-register with wallet_2 btc address as reward address and wallet_3 public key for sBTC wallet.
3. In cycle N + 1 voting window (block #156), signer calls sbtc-stacking-pool.vote-for-threshold-wallet-candidate for the wallet_3 btc address.
4. User sends deposit tx (using sbtc-cli) from wallet_9 to ???

0 comments on commit 8e5bfd2

Please sign in to comment.