From fea96f814e991e086a5f317e1a945f71899ee93a Mon Sep 17 00:00:00 2001 From: Deploy from CI <-> Date: Thu, 28 Sep 2023 18:14:32 +0000 Subject: [PATCH] deploy: ecee82f40a38cee60e519c222ee632d50108a2f4 --- 404.html | 2 +- applications.html | 2 +- architecture.html | 2 +- btcb.html | 2 +- clarity-contracts-reference.html | 2 +- contribute.html | 2 +- contributors.html | 2 +- deposit.html | 2 +- developer-release-signer.html | 2 +- faq.html | 2 +- how-to-deposit-and-withdraw.html | 2 +- how-to-signer.html | 2 +- how-to-stacker.html | 2 +- index.html | 2 +- introduction.html | 2 +- lbtc.html | 2 +- nakamoto-signer-developer-guide.html | 2 +- powpeg.html | 2 +- pox-contract.html | 2 +- print.html | 163 +++++----- quickstart.html | 2 +- sbtc-operations.html | 2 +- sbtc-operations/bitcoin-transactions.html | 2 +- sbtc-operations/commit-reveal-system.html | 2 +- sbtc-releases.html | 2 +- sbtc-releases/sbtc-dev-v2.html | 6 +- sbtc-releases/sbtc-dev.html | 2 +- .../sbtc-dev/get-started-on-devnet.html | 303 ++++++++++++++++++ sbtc-releases/sbtc-dev/get-started.html | 138 ++------ .../sbtc-dev/sbtc-dev-reference.html | 2 +- sbtc-releases/sbtc-nakamoto-v2.html | 2 +- sbtc-releases/sbtc-nakamoto.html | 2 +- sbtc-roadmap.html | 2 +- sbtc-sdk.html | 2 +- searchindex.js | 2 +- searchindex.json | 2 +- signer-api.html | 2 +- stacker-db.html | 2 +- stacker-responsibilities.html | 2 +- stacker-responsibilities/frost.html | 2 +- .../signing-protocol.html | 2 +- stacker-responsibilities/wsts-adaptation.html | 2 +- tbtc.html | 2 +- wbtc.html | 2 +- withdrawal.html | 2 +- 45 files changed, 468 insertions(+), 224 deletions(-) create mode 100644 sbtc-releases/sbtc-dev/get-started-on-devnet.html diff --git a/404.html b/404.html index f310d0b..1855b08 100644 --- a/404.html +++ b/404.html @@ -84,7 +84,7 @@ diff --git a/applications.html b/applications.html index 0fb2bf4..5913523 100644 --- a/applications.html +++ b/applications.html @@ -83,7 +83,7 @@ diff --git a/architecture.html b/architecture.html index 644694c..cf5b507 100644 --- a/architecture.html +++ b/architecture.html @@ -83,7 +83,7 @@ diff --git a/btcb.html b/btcb.html index f8642a7..bb7dad1 100644 --- a/btcb.html +++ b/btcb.html @@ -83,7 +83,7 @@ diff --git a/clarity-contracts-reference.html b/clarity-contracts-reference.html index da2ec25..df74744 100644 --- a/clarity-contracts-reference.html +++ b/clarity-contracts-reference.html @@ -83,7 +83,7 @@ diff --git a/contribute.html b/contribute.html index 3bddf3d..59357cb 100644 --- a/contribute.html +++ b/contribute.html @@ -83,7 +83,7 @@ diff --git a/contributors.html b/contributors.html index 45e8ee5..96f5629 100644 --- a/contributors.html +++ b/contributors.html @@ -83,7 +83,7 @@ diff --git a/deposit.html b/deposit.html index 3ba26d6..2ed8990 100644 --- a/deposit.html +++ b/deposit.html @@ -83,7 +83,7 @@ diff --git a/developer-release-signer.html b/developer-release-signer.html index 51286ae..4d2334c 100644 --- a/developer-release-signer.html +++ b/developer-release-signer.html @@ -83,7 +83,7 @@ diff --git a/faq.html b/faq.html index 20adfee..9da395c 100644 --- a/faq.html +++ b/faq.html @@ -83,7 +83,7 @@ diff --git a/how-to-deposit-and-withdraw.html b/how-to-deposit-and-withdraw.html index 81e87a2..0105bff 100644 --- a/how-to-deposit-and-withdraw.html +++ b/how-to-deposit-and-withdraw.html @@ -83,7 +83,7 @@ diff --git a/how-to-signer.html b/how-to-signer.html index d16bab6..755b4da 100644 --- a/how-to-signer.html +++ b/how-to-signer.html @@ -83,7 +83,7 @@ diff --git a/how-to-stacker.html b/how-to-stacker.html index 756902b..535cc18 100644 --- a/how-to-stacker.html +++ b/how-to-stacker.html @@ -83,7 +83,7 @@ diff --git a/index.html b/index.html index c1f5bee..a91ef84 100644 --- a/index.html +++ b/index.html @@ -83,7 +83,7 @@ diff --git a/introduction.html b/introduction.html index c1f5bee..a91ef84 100644 --- a/introduction.html +++ b/introduction.html @@ -83,7 +83,7 @@ diff --git a/lbtc.html b/lbtc.html index 45be63a..08954de 100644 --- a/lbtc.html +++ b/lbtc.html @@ -83,7 +83,7 @@ diff --git a/nakamoto-signer-developer-guide.html b/nakamoto-signer-developer-guide.html index b73687c..1339e76 100644 --- a/nakamoto-signer-developer-guide.html +++ b/nakamoto-signer-developer-guide.html @@ -83,7 +83,7 @@ diff --git a/powpeg.html b/powpeg.html index e8469f1..aefab19 100644 --- a/powpeg.html +++ b/powpeg.html @@ -83,7 +83,7 @@ diff --git a/pox-contract.html b/pox-contract.html index f029c4e..b258a66 100644 --- a/pox-contract.html +++ b/pox-contract.html @@ -83,7 +83,7 @@ diff --git a/print.html b/print.html index ebddde8..7cb3633 100644 --- a/print.html +++ b/print.html @@ -84,7 +84,7 @@ @@ -986,107 +986,118 @@

#77

Get Started with sBTC 0.1

+

The sBTC contract will be deployed on the Stacks testnet by an address that is still to be defined. See sbtc/#178.

+

In sBTC 0.1, the deposit and withdrawal transactions are processed by a central authority (CA). The flow is as follows:

+
sequenceDiagram
+    actor AB as Alice-BTC
+    participant CB as CA-BTC
+    participant CS as CA-STX
+    actor AS as Alice-STX
+    CS ->> CS: deploys contract
+    Note over AB, AS: BTC tx before contract deployment are ignored.
+    loop
+        AB ->> CB: sends BTC (deposit)
+        CB ->> CS: processes BTC tx
+        CS ->> AS: mints sBTC
+    end
+    loop
+        AB ->> CB: sends dust (withdrawal)
+        CB ->> CS: processes BTC tx
+        CS ->> AS: burns sBTC
+        CB ->> AB: sends BTC (fullfilment)
+    end
+
+

Web app

+

A web interface for the sBTC contract is available at https://bridge.stx.eco/?net=testnet

+

The web app allows to deposit and withdraw btc from the peg wallet. It also provides a list of recent deposit and withdrawal transactions.

+

sBTC cli

+

See (README of the sbtc repo)[https://github.com/stacks-network/sbtc/blob/main/sbtc-cli/README.md] for commands to create and broadcast deposit and withdrawal bitcoin transactions.

+

sBTC API

+

There is a public API server for the most common tasks in the context of sBTC. Developers can use this API create deposit and withdrawal request, get information about btc transactions, etc.

+

Documention is available at (bridge.sbtc.tech)[https://bridge.sbtc.tech/bridge-api/docs/].

+

sBTC SDK

+

stacks.js has added support for sBTC deposit and withdrawal requests. Current work in progress can be seen at stacks.js/feat/add-sbtc-contracts.

+

Get Started with sBTC 0.1 on devnet

Local setup

+

Devnet is a setup with a local bitcoin node running regtest, a local stacks node running testnet and connecting to the local bitcoin node. In addition, explorers and api servers are setup to provide easy access to information.

+

Developers can use docker to setup all required services.

+

The following steps have to be done

+
    +
  1. Launch devnet.
  2. +
  3. Deploy sbtc contract.
  4. +
  5. Launch sBTC binary (Alpha romeo engine).
  6. +
  7. Use sBTC web app (sBTC Bridge) or sbtc cli.
  8. +

Requirements

Configuration

+

The default values are set as follows using the same seed phase defined in romeo/asset-contract/settings/Devnet.toml:

+

|----|----|---| +| seed phrase | twice kind fence tip hidden tilt action fragile skin nothing glory cousin green tomorrow spring wrist shed math olympic multiply hip blue scout claw | main/deployer wallet | +| peg wallet | bcrt1pte5zmd7qzj4hdu45lh9mmdm0nwq3z35pwnxmzkwld6y0a8g83nnqhj6vc0| taproot address from seed phrase | +| stx deployer | ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM | |

  1. Create configuration file config.json in a new folder romeo/testing with the following content:
{
-  "network": "testnet",
+  "stacks_network": "testnet",
+  "bitcoin_network": "regtest",
   "state_directory": "./state",
-  "mnemonic": "YOUR_MNEMONIC_PHRASES",
-  "wif": "YOUR_WIF_CREDENTIALS",
+  "mnemonic": "twice kind fence tip hidden tilt action fragile skin nothing glory cousin green tomorrow spring wrist shed math olympic multiply hip blue scout claw",
   "bitcoin_node_url": "http://devnet:devnet@localhost:8001/api",
   "stacks_node_url": "http://localhost:3999",
-  "stacks_transaction_fee": 2000,
-  "bitcoin_transaction_fee": 2000,
-  "contract": "../asset-contract/contracts/asset.clar",
-  "contract_name": "sbtc-alpha-romeo-testing"
+  "electrum_node_url": "tcp://localhost:60401",
+  "contract_name": "asset"
 }
 

state_directory The folder that should contain the state of the Romeo engine binary relative to the folder testing.

When running the binary the first time, an empty file log.ndjson is created in the state directory (e.g. testing/state). The file stores the processed transaction events.

-

wif -The private key in wallet import format used by the Romeo engine binary. It is used for bitcoin and stacks transaction submitted by the binary.

-

There is a tool specifically useful for sBTC testing. It's the sbtc-cli package in the sbtc repo, sibling to romeo. You can generate a new private key by using the following command:

-
sbtc generate-from new
-
-

The output looks like below and contains the wif.

-
{
-  "credentials": {
-    "0": {
-      "bitcoin": {
-        "p2pkh": {
-          "address": "n44tpstz2NPRAz2MYhdCbwRHvj87jDW6nu",
-          "private_key": "5a323c81001951770e728372484b90af6ab467ac4a7a1f2361f7c48b4e353cfc",
-          "public_key": "0233ce5eccd746c90df6d54d33e4a5741f7703ae085df340e9da8ea1648bba066a",
-          "wif": "cQc2mfkN2jnRReLj1oAXrk4YZ1GN7i5Ne5g2tbTdH4sp7XEgpgSd"
-        },
-        "p2tr": {
-          "address": "tb1p83weqj54pkwxedwc2jctfhf2eyszuvsavad7qvk6ucffsc8u7vjsld0gxv",
-          "private_key": "f5eedc5f82f44551ece4a80e9930037485cfb8bed05ceac8faefb4dbfa4941ae",
-          "public_key": "024205c0c1cbcfe2c866d06a17735ac4bc893b02f6fb5284acccb9c55a5e6237ea",
-          "wif": "cVpmEAwBvCWhhRxsaXwwfsnyCkWZYkQA4n74oSFXq3MRvxmvcBRt"
-        },
-        "p2wpkh": {
-          "address": "tb1qrkt8ula8cr5w5rsa83cf63nvl2dhzu3wdjpxnj",
-          "private_key": "6f964b2fe3bd066e0a0b51ca72cb57405a2f87734b21fcdbb8ee90cd0681e5e1",
-          "public_key": "035b8967d295f1f6220e5dfc203fdfc78c796e1945b10f8f4ea9996c75c053873e",
-          "wif": "cRKcUCoqUWbTs4iQeHUxvuSJNtBLhVL6MHWkavM44V84un2jxqz7"
-        }
-      },
-      "stacks": {
-        "address": "ST2EAW85EB3WZQCGT1PGKG2EQDXHYHH15SJWJECEG",
-        "private_key": "dc4438704f7bc7bd6f08906ecf6e7e0ea3cac9a7fa019e2bb557ed3675863412",
-        "public_key": "02d38e1c2cd1404ee1e1b15ae833f887f969e397cebdba55ea03ba74b12c501d54",
-        "wif": "cUxsTywm1foSgpkAESPHLpdMLEmGKUFtgeA8NgBb3KymydhK5nV2"
-      }
-    }
-  },
-  "mnemonic": "tobacco box reject obtain gloom cream bean trouble clap seek remove giggle half zone neck region canoe say heart narrow segment garage wild until",
-  "private_key": "6ef44d1e9db101b2fd02a8ad7aad15eb3b4515111f8cd75efcf177501630da72",
-  "wif": "cRJP8KnNWHogXDTtCDyMSpZ9RG7xFQuHEXe9ZpM93DQizQf8PLxG"
-}
-

Node configurations -The url and the fees used for transactions the bitcoin node and the stacks node can be configured with bitcoin_node_url, stacks_node_url, bitcoin_transaction_fee (in sats), stacks_transaction_fee (in micro stacks).

-

contract -The path to the source file of the clarity contract relative to the location of the Romeo engine binary.

+The url and the fees used for transactions the bitcoin node and the stacks node can be configured with stacks_network, bitcoin_network, bitcoin_node_url, stacks_node_url.

contract_name The contract name that is used when the contract is deployed. This allows to test the bootstrapping several times on the same network.

Launch devnet

-

Open up your terminal and run the following commands. When running clarinet integrate, you will be prompted to overwrite the deployment script, press N to say no.

-
cd romeo
-cd asset-contract
-# Press N when asked to overwrite deployment script
-clarinet integrate
-
-

This will open a Clarinet dashboard that allows you to see the status of your local devnet blockchain. If you aren't familiar with Clarinet or its integrate feature, check out the Clarinet docs.

-

You can monitor this dashboard to see when your local devnet is ready.

-

clarinet dashboard

-

Fund your sBTC wallet address

-

In order to deploy the sBTC contract you must first fund your STX address listed above in the config.json file.

-

Download a wallet client:

+

See sbtc/devenv for details.

+

Check status of all services:

-

If you wish to use the desktop client, you MUST download the testnet version of the executable.

-

You can use any one of the wallet mnemonic phrases in the romeo/asset-contract/settings/Devnet.toml file for the client.

-

Now send 100 STX to your STX address you generated with the sbtc-cli above.

+

See romeo/asset-contract/settings/Devnet.toml for seed phrases for pre-filled accounts.

+

Deploy Contract

+

The local environment defines wallets that are already funded. The deployer wallet is used to deploy the contract using clarinet deployments.

+

Run the following command to deploy the Clarity contracts asset.clar and clarinet-bitcoin-mini.clar

+
./utils/deploy_contracts.sh
+

Launch sBTC DR binary

-

While waiting for clarinet integrate to finish setting up your devnet, open up a separate terminal window and start the sBTC binary from the root of the git repo.

-
cargo run -p romeo -- -c config.json
+

While waiting for the contracts to be deployed, open up a separate terminal window and start the sBTC binary from the root of the git repo.

+
cargo run -p romeo -- -c romeo/testing/config.json
 
-

Now head back to the first terminal window that has Clarinet's devnet running and press N to min a new block and see how the transaction is processed.

-

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

+

Use the sBTC cli

+

First install the sbtc cli using the following command:

+
cargo install --path sbtc-cli
+
+

There are helper scripts to create and broadcast deposit and withdrawal requests. They are contained in the utils folder of devenv:

+
    +
  1. mint_btc.sh: funds the btc addresses with BTC. Add the number of blocks to mint for the two addresses as parameter.
  2. +
  3. deposit.sh: deposits a random amount of less than 10,000 sats. sBTC will be received by the deployer stacks address.
  4. +
  5. withdrawal.sh: withdraws a random amount of less than 2,000 sats.
  6. +
+

Check the results on Stacks at the deployer address: +http://localhost:3000/address/ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM?chain=testnet&api=http://localhost:3999

+

Check the results on Bitcoin at the txs printed by the sbtc cli.

+

Use sBTC App

+

Download the wallet client:

+

sBTC 0.2

sBTC 1.0

TODO: #14

diff --git a/quickstart.html b/quickstart.html index d1ea435..bef3035 100644 --- a/quickstart.html +++ b/quickstart.html @@ -83,7 +83,7 @@ diff --git a/sbtc-operations.html b/sbtc-operations.html index f497a8a..be80ce8 100644 --- a/sbtc-operations.html +++ b/sbtc-operations.html @@ -83,7 +83,7 @@ diff --git a/sbtc-operations/bitcoin-transactions.html b/sbtc-operations/bitcoin-transactions.html index 9fe82e0..b8f9ce9 100644 --- a/sbtc-operations/bitcoin-transactions.html +++ b/sbtc-operations/bitcoin-transactions.html @@ -83,7 +83,7 @@ diff --git a/sbtc-operations/commit-reveal-system.html b/sbtc-operations/commit-reveal-system.html index 5446a41..78fdea2 100644 --- a/sbtc-operations/commit-reveal-system.html +++ b/sbtc-operations/commit-reveal-system.html @@ -83,7 +83,7 @@ diff --git a/sbtc-releases.html b/sbtc-releases.html index 9d2a28b..575a391 100644 --- a/sbtc-releases.html +++ b/sbtc-releases.html @@ -83,7 +83,7 @@ diff --git a/sbtc-releases/sbtc-dev-v2.html b/sbtc-releases/sbtc-dev-v2.html index dc9c1a7..4fc6833 100644 --- a/sbtc-releases/sbtc-dev-v2.html +++ b/sbtc-releases/sbtc-dev-v2.html @@ -83,7 +83,7 @@ @@ -172,7 +172,7 @@

sBTC 0.2