Disclosure
Due to updates and changes still being made to the API in general (endpoints, information structure, payloads) some of the functionality can be broken, it is constantly being updated until we have the final API version. Everything is working as of this writing.
Videos to show the functionality are here:
The sBTC-Bridge is a plugin for the Electrum wallet that enables interaction with the Bitcoin sBTC bridge.
This plugin offers a range of features, including depositing BTC to obtain sBTC, reclaiming deposits, withdrawing sBTC to obtain BTC, reclaiming withdrawals, viewing transaction history, and tracking wallet balances for STX and sBTC.
Prerequisites
Before using the sBTC-Bridge plugin, make sure you have the following:
- Python 3.7 or higher
- Electrum Wallet
Recommended
Since the plugin is currently in production, all operations are performed on the Testnet. To proceed, obtain testnet BTC from https://coinfaucet.eu/en/btc-testnet/
Installation
To install the sBTC-Bridge plugin, follow these steps:
-
Clone the repository: git clone https://github.com/Patotking12/sBTC-Bridge.git
-
Install the Electrum wallet by referring to the instructions available at https://github.com/spesmilo/electrum.
-
Launch Electrum on the testnet by running the command:
python3 run_electrum --testnet
-
In the Electrum wallet, go to "Tools" > "Plugins" in the menu and enable the "sBTC Plugin".
-
Close and reopen the wallet.
Usage
- The plugin will add a new tab called "sBTC" to the Electrum wallet interface.
Use the different tabs within the "sBTC" tab to perform various operations.
Deposit
The "Deposit" tab within the "sBTC" tab provides functionalities for depositing, reclaiming, and tracking peg-in transactions.
Deposit BTC
To deposit BTC into the sBTC bridge, follow these steps:
-
Go to the "Deposit BTC" tab.
-
Enter the desired amount of BTC to deposit in the "BTC to Deposit" field.
-
Provide your STX address in the "STX Address" field.
-
The address with the highest BTC amount from withing Electrum will be displayed, since that is the one that Electrum will use to send the BTC.
-
Click the "Generate Script" button, and the plugin will automatically start fetching the information it needs with the information you inputed to create the Script you will send the BTC to.
-
This will take some time, since the plugin is fetching all the information it needs and processing it, please be patient.
-
Manually enter the recipient address in the "Recipient Address" field. (Note: This step is temporary until the API endpoint generates this automatically. For the time being, we can add any BTC address and send BTC)
-
Choose the transaction fee from the "Transaction Fee" dropdown menu, it will have 3 options: Low, Medium and High fee.
-
Click the "Deposit BTC" button.
-
Enter your wallet password when prompted.
-
The transaction will be sent, and a confirmation message will be displayed. You can also check the Electrum History tab for the transaction details. Or add your STX address to the "Tx history peg in" tab to track all transactions related to sBTC Bridge.
Tx history peg in
The "Tx history peg in" tab displays the transaction history for peg-in transactions. You can track a single address at a time.
To interact with the transaction history, follow these steps:
-
Click the "Add" button to add an STX address to the table.
-
You will be prompted to input the STX address you want to track the transactions from.
-
The Plugin will start fetching your transactions, this may take some time, so be patient.
-
All the peg in transactions will be displayed, showing:
- ID
- Originator
- BTC Address
- Amount
- To Script
- Type
- Status
- Action
-
If you have a transaction in "reclaimed" status, a "Reclaim" button will be displayed, that when clicked it will start the reclaim action for the ID you enter and your BTC will be refunded to the BTC address it was deposited from. (Waiting for the Stacks Python library to be able to sign messages)
-
Click the "Remove" button to clear the table.
-
Click the "Refresh" button to fetch and update the transaction history for the address.
Withdraw
The "Withdraw" tab within the "sBTC" tab offers functionalities for withdrawing, reclaiming, and tracking peg-out transactions.
Withdraw BTC
To withdraw sBTC and obtain BTC, follow these steps:
-
Go to the "Withdraw BTC" tab.
-
Enter the desired amount of sBTC to withdraw in the "BTC to Withdraw" field.
-
Provide your STX address in the "STX Address" field.
-
Click the "Withdraw BTC" button. (This step is awaiting the API endpoint. And the Stacks Python library to be able to sign messages)
-
The withdrawal process will be initiated.
Tx history peg out
The "Tx history peg out" tab displays the transaction history for peg-out transactions. You can track a single address at a time.
To interact with the transaction history, follow these steps:
-
Click the "Add" button to add an STX address to the table.
-
You will be prompted to input the STX address you want to track the transactions from.
-
The Plugin will start fetching your transactions, this may take some time, so be patient.
-
All the peg out transactions will be displayed, showing:
- ID
- Originator
- BTC Address
- Amount
- To Script
- Type
- Status
- Action
-
If you have a transaction in "reclaimed" status, a "Reclaim" button will be displayed, that when clicked it will start the reclaim action and your sBTC will be refunded to the STX address it was withdrawed from.
-
Click the "Remove" button to clear the table.
-
Click the "Refresh" button to fetch and update the transaction history for the address.
Summary
The "Summary" tab provides an overview of the wallet balances for Stacks and sBTC associated with your STX addresses.
To utilize the "Summary" tab, follow these steps:
-
Enter an STX address in the "Add STX Address" field.
-
Click the "Add" button to add the address to the summary table. Please note that fetching balances may take some time before they are displayed.
-
The table will present the STX address, STX balance, and sBTC balance.
-
Select a row in the table to remove an address using the "Remove" button.