Wrapping & Unwrapping frBTC
One of the core functionalities of the SUBFROST ecosystem is the ability to create frBTC
, a synthetic asset pegged 1:1 to Bitcoin.
This is achieved through a trust-minimized process that locks BTC on the Bitcoin mainnet and mints a corresponding amount of frBTC
on the SUBFROST protocol.
This guide will walk you through the process using the subrail-cli
CLI.
Wrapping Process
Wrapping involves creating a Bitcoin transaction that performs two actions simultaneously:
- Locks BTC: Your BTC is sent to a secure, multisignature address controlled by the SUBFROST signers.
- Mints frBTC: An
OP_RETURN
output in the same transaction contains instructions for the Alkanes metaprotocol to mint an equivalent amount offrBTC
and assign it to your SUBFROST address.
1. Generate a SUBFROST Wallet
If you haven't already, you need a SUBFROST wallet to receive your frBTC
.
subrail-cli wallet create
This command will generate a new wallet and display your address. Keep your mnemonic phrase safe and private.
2. Initiate the Wrap
To wrap BTC, you will use the subrail-cli alkanes execute
command. This command gives you fine-grained control over the transaction construction.
Example: Wrap 0.1 BTC
subrail-cli alkanes execute \
--to "[self:p2tr:0],<SUBFROST_ADDRESS>" \
--inputs "B:10000000" \
--change "[self:p2tr:1]" \
"[4,TBD,77]:v0:v0:[B:10000000:v1]"
Breakdown of the Command:
--to "[self:p2tr:0],<SUBFROST_ADDRESS>"
: This specifies the outputs of the transaction.[self:p2tr:0]
: This is your own address (the first Taproot address in your wallet) which will receive the newly mintedfrBTC
. This isv0
.<SUBFROST_ADDRESS>
: This is the placeholder for the SUBFROST multisig address where the BTC will be locked. This isv1
.
--inputs "B:10000000"
: This specifies that you want to use 0.1 BTC (10,000,000 sats) from your wallet as input for this transaction.--change "[self:p2tr:1]"
: Any change from the transaction will be sent to the second Taproot address in your wallet."[4,TBD,77]:v0:v0:[B:10000000:v1]"
: This is the protostone, which contains the instructions for the Alkanes metaprotocol.[4,TBD,77]
: This is the instruction to mintfrBTC
.4
is the block number of thefrBTC
alkane,TBD
is the transaction index (as it's not yet deployed), and77
is the opcode for minting.:v0:v0
: This targets the first output (v0
, your address) and points to it.:[B:10000000:v1]
: This is an "edict" that specifies that 0.1 BTC (B:10000000
) should be sent to the second output (v1
, the SUBFROST multisig address).
subrail-cli
will then guide you through the process, which will involve signing the transaction.
3. Confirm Your frBTC
Balance
After the Bitcoin transaction is confirmed, the frBTC
will be minted on the SUBFROST protocol. You can check your balance using subrail-cli
.
subrail-cli balance --address <your-subfrost-address>
Unwrapping Process
Unwrapping is the reverse process: frBTC
is burned and the equivalent amount of BTC is released from the multisig address back to a Bitcoin address you specify.
1. Initiate the Unwrap
To unwrap frBTC
, you will again use the subrail-cli alkanes execute
command.
Example: Unwrap 0.1 frBTC
subrail-cli alkanes execute \
--to "<YOUR_BITCOIN_ADDRESS>" \
--inputs "<frBTC_alkane_id>:<output_index>:10000000" \
--change "[self:p2tr:1]" \
"[<frBTC_alkane_id>,10000000,88]:v0:v0"
Breakdown of the Command:
--to "<YOUR_BITCOIN_ADDRESS>"
: The destination Bitcoin address that will receive the unlocked BTC.--inputs "<frBTC_alkane_id>:<output_index>:10000000"
: This specifies thefrBTC
tokens you want to burn. You will need to replace<frBTC_alkane_id>
with the actual Alkane ID offrBTC
and<output_index>
with the output index of the UTXO that holds yourfrBTC
.--change "[self:p2tr:1]"
: Any change from the transaction will be sent to the second Taproot address in your wallet."[<frBTC_alkane_id>,10000000,88]:v0:v0"
: This is the protostone for burning thefrBTC
.88
is the opcode for burning.
2. Receive Your BTC
Once the SUBFROST transaction is finalized, the signers will cooperatively sign a Bitcoin transaction to release the locked BTC to your specified destination address. This process is automated and secured by the FROST Protocol.