2. Unbond and Withdraw
Depending of the status of your stake, the flow to withdraw your funds can vary.

Wait the end of the lock time
When your stakes reach the end of the locking time, you can just withdraw and you will receive all your funds back to your BTC wallet. (see Withdraw)
Early Unbonding
If you want to get your funds back before your funds are unlocked, you have to Unbond them first. You will have to pay a slashing fee which is a percentage of the total amount staked.
Two step are needed to Unbond:
- Craft the Unbond Tx then sign it
- Call Prepare Signed Unbond endpoint to enrich the transaction to broadcast with covenant signatures (without doing this the transaction is invalid)
POST /btc/baby/transaction/btc-unbond
{
"stake_tx_hash": "fe5...",
}
{
"unsigned_unbonding_psbt_hex": "73..."
}
Inputs required
- stake_tx_hash: The BTC stake transaction hash
Output:
- unsigned_unbonding_psbt_hex: The unsigned unbonding Psbt
POST /btc/baby/transaction/btc-prepare-signed-unbond
{
"stake_tx_hash": "fe5...",
}
{
"unsigned_unbonding_psbt_hex": "73..."
}
Inputs required
- stake_tx_hash: The BTC stake transaction hash
- signed_unbonding_psbt_hex: The signed unbonding Psbt
Output:
- serialized_unbonding_tx_hex: The unsigned unbonding Psbt
After broadcasting the serialized_unbonding_tx_hex. Your funds will be locked for a certain amount of blocks. You can get the unbonding lock time in the params available at this endpoint (params) (unbonding_time_blocks). Please check for the params version corresponding to your delegation.
When the unbonding lock time is passed, just call the withdraw endpoint (see withdraw)
Withdraw
POST /btc/baby/transaction/btc-withdraw
{
"stake_tx_hash": "fe5...",
"fee_rate": 8
}
{
"unsigned_tx_withdraw_psbt": "73..."
}
Inputs required
- stake_tx_hash: The BTC stake transaction hash
- fee_rate: The transaction fee rate in satoshis per byte.
Output:
- unsigned_tx_withdraw_psbt: Psbt to sign to withdraw funds.
Sign the Psbt and broadcast the transaction, your funds should be back to your initial wallet.
Updated 22 days ago