Fan Out Unspents
Split a single UTXO into multiple smaller unspents for high-volume transactions. See the Guide.
-
Take a single unspent and split it into multiple smaller unspents. This is useful for creating unspents for multiple smaller transactions, especially if you have a high volume of transactions at once. Fanning out unspents can also help protect privacy by making it more difficult for external observers to link transactions together.
Fan-out transactions follow the normal transaction flow, requiring signatures, approvals, and sending. All fan-out transactions for bitcoin automatically opt-in to acceleration using Replace-By-Fee (RBF).
Prerequisites: Complete Get Started, Create Wallets, and Create Addresses.
// 1. Fan Out Unspents
export COIN="<ASSET_ID>"
export WALLET_ID="<YOUR_WALLET_ID>"
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"
curl -X POST \
http://$BITGO_EXPRESS_HOST/api/v2/$COIN/wallet/$WALLET_ID/fanoutunspents \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d '{
"walletPassphrase": "string",
"xprv": "string",
"feeRate": 10000,
"maxFeeRate": 20000,
"maxFeePercentage": 0,
"feeTxConfirmTarget": 0,
"minValue": null,
"maxValue": null,
"minHeight": 0,
"minConfirms": 0,
"enforceMinConfirmsForChange": true,
"maxNumInputsToUse": 0,
"numUnspentsToMake": 0,
"targetAddress": "string",
"txFormat": "legacy"
}'
// 1. Fan Out Unspents
let params = {
maxNumInputsToUse: 20,
numUnspentsToMake: 200,
minValue: 100000,
maxValue: 47000000,
minHeight: 1,
minConfirms: 2,
walletPassphrase: 'secretpassphrase1a5df8380e0e30',
};
wallet.fanoutUnspents(params).then(function (transactionInfo) {
// print transaction info
console.dir(transactionInfo);
});
// 1. Fan Out Unspents Response
{
"transfer": {
"coin": "btc",
"id": "59cd72485007a239fb00282ed480da1f",
"wallet": "59cd72485007a239fb00282ed480da1f",
"enterprise": "59cd72485007a239fb00282ed480da1f",
"txid": "b8a828b98dbf32d9fd1875cbace9640ceb8c82626716b4a64203fdc79bb46d26",
"height": 0,
"heightId": "string",
"date": "2019-08-24T14:15:22Z",
"type": "send",
"value": 0,
"valueString": "string",
"baseValue": 0,
"baseValueString": "string",
"feeString": "string",
"payGoFee": 0,
"payGoFeeString": "string",
"usd": 0,
"usdRate": 0,
"state": "confirmed",
"tags": [
"59cd72485007a239fb00282ed480da1f"
],
"history": [
{
"date": "2019-08-24T14:15:22Z",
"user": "59cd72485007a239fb00282ed480da1f",
"action": "created",
"comment": "string"
}
],
"comment": "string",
"vSize": 0,
"nSegwitInputs": 0,
"coinSpecific": {},
"sequenceId": "string",
"entries": [
{
"address": "2NAUwNgXaoFj2VVnSEvNLGuez8CfdU2UCMZ",
"wallet": "string",
"value": 0
}
],
"usersNotified": true
},
"txid": "string",
"tx": "string",
"status": "signed"
}