Skip to main content

Bitcoin & UTXO Chains

Bitcoin and UTXO-based chains (Litecoin, Dogecoin, Bitcoin Cash, Dash) use a fundamentally different transaction model than account-based chains. Each transaction consumes previous unspent outputs (UTXOs) and creates new ones.

Address Types

Bitcoin supports multiple address formats. Specify the type when creating an address:

curl -X POST \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"accountId": "eFjwUQXB8CMnrTHSgYzaL6",
"network": "bitcoin-mainnet",
"name": "BTC Deposits",
"type": "p2wpkh"
}' \
https://api.carabaas.com/api/v1/addresses
TypeFormatDescriptionRecommended
p2wpkhbc1q...Native SegWitYes
p2pkh1...LegacyNo
tip

Use p2wpkh (Native SegWit) for lower transaction fees and better compatibility with modern wallets.

Multiple Deposit Addresses

Unlike account-based chains, Bitcoin addresses are designed for single use. Generate a unique address per customer or per transaction for better privacy and deposit attribution:

curl -X POST \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"accountId": "pQ3rS5tU7vW9xY1zAbCdEf",
"network": "bitcoin-mainnet",
"name": "customer-12345"
}' \
https://api.carabaas.com/api/v1/addresses

Sending BTC

curl -X POST \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"orderId": "c9d0e1f2-a3b4-4c5d-6e7f-8a9b0c1d2e3f",
"vaultId": "kR7mNpX2wQvL9sYhBjD4eT",
"destination": "bc1qRecipient...",
"network": "bitcoin-mainnet",
"asset": "c0",
"amount": "0.01",
"feePriority": "medium"
}' \
https://api.carabaas.com/api/v1/transactions

Source Selection

For UTXO chains, the source field determines where the platform collects unspent outputs (UTXOs) from:

SourceUTXOs collected fromChange address
addressIdSingle address onlySame address (default) — or specify changeAddress in options
accountIdAll addresses in the accountRequired — specify changeAddress in options
vaultIdAll addresses in the vaultRequired — specify changeAddress in options

Change Address

When sending from accountId or vaultId, you must specify where the change (remaining UTXOs) should go:

curl -X POST \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"orderId": "d1e2f3a4-b5c6-4d7e-8f9a-0b1c2d3e4f5a",
"accountId": "eFjwUQXB8CMnrTHSgYzaL6",
"destination": "bc1qRecipient...",
"network": "bitcoin-mainnet",
"asset": "c0",
"amount": "0.5",
"feePriority": "medium",
"options": {
"changeAddress": "gMP71sR5sNUnGdKFTsNzp6"
}
}' \
https://api.carabaas.com/api/v1/transactions

When sending from a single addressId, the change goes back to the same address by default — no changeAddress needed.

Fee Management

Bitcoin fees are based on transaction size (in vbytes), not a fixed gas price.

PriorityBehavior
lowLower fee rate, may take several blocks
mediumTargets confirmation within ~3 blocks
highTargets next-block confirmation

Replace-By-Fee (RBF)

If a Bitcoin transaction is stuck in the mempool due to low fees, replace it:

curl -X PATCH \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ "feePriority": "high" }' \
https://api.carabaas.com/api/v1/transactions/{txId}/replace

Confirmation Tracking

Bitcoin requires more confirmations than account-based chains for security. Configure confirmation thresholds per vault:

curl -X PUT \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ "bitcoin-mainnet": 6 }' \
https://api.carabaas.com/api/v1/subscriptions/{vaultId}/confirmations
ThresholdUse Case
1Low-value, speed-sensitive
3Standard operations
6Maximum (highest security)

Applicable Chains

ChainAsset IDNative AssetAddress Formats
Bitcoinc0BTCp2wpkh, p2pkh
Bitcoin Cashc145BCH
Litecoinc2LTCp2wpkh, p2pkh
Dogecoinc3DOGE
Dashc5DASH

See Also