The point of consolidating unspents is to combine small unspents into larger ones. Larger unspents are cheaper to spend, providing savings when the network later experiences increased fee rates. BitGo has consolidation tools in our SDK. 

Some basic guidelines to creating consolidation transactions are as follows:

  • The first step is to ensure that your non-consolidation transactions enforce confirmations so that  these transactions do not use outputs from a consolidation transaction. To do so, please add the following to your regular transaction call :

{ minConfirms: 1, enforceMinConfirmsForChange: true }

This ensures that if the consolidation transactions take longer than expected due to a fee hike, the regular transactions cannot use the outputs created by the consolidations. 

  • Begin consolidations by creating consolidation transactions that consume the smallest unspents first, as these are only economical to consolidate during periods of low fee rates. 

  • Note that the fee recommendations below might need to be adapted to the current network fee situation.

Let's begin building a consolidation transaction for small unspents: 

We’re not interested in consolidating the big unspents. They’re already useful at the value they have and you will only waste money by aggregating them.

On the other hand, unspents that are too small should perhaps be consolidated at an even lower fee rate than the current. Think about the maximum percentage of the total value of the unspents that you are willing to pay in fees to recover these funds. *see example below

Fee Rate

minSize at 1/2

minSize at 1/3

minSize at 1/4

5,000 sats/kB

2950 satoshis

4425 satoshis

5900 satoshis

10,000 sats/kB

5900 satoshis

8850 satoshis

11800 satoshis

20,000 sats/kB

11800 satoshis

17700 satoshis

23600 satoshis

To begin, we want to make sure that we avoid spending bigger unspents in the first round of consolidations. To achieve this, we suggest that you set a maxSize of 100,000 (1mBTC).

Next, you will want to set a specific fee rate for the consolidations. Depending on the current fee rate of the network, you will want to select a fee rate that is economical to recover the value of the unspents, but not so low as to risk being unconfirmed for a long period of time. 

E.g.: at the time of this writing, transactions on the BTC network are confirming around 8-10 satoshi; as such, we would recommend using a 10 satoshi / vbyte fee rate for consolidations. This parameter is set in satoshi per kB so you would enter a value of 10000. In this example we are not allowing the fees to exceed ¼ of the value of the unspents. This results in a minSize of 11800 satoshi. 

To ensure that you make the outputs as large as possible, you will want to set maxInputCountPerConsolidation to 200

This means that your transaction call will look like this :


 minSize: 11800,

 maxSize: 100000,

 maxInputCountPerconsolidation: 200,

 feeRate: 10000,

<other parameters>


This explains how to build transactions for consolidations of most unspents in the wallet

Consolidation of even smaller unspents:

Due to the nature of the unspents being consolidated in these transactions, you may want to create another set of transactions with a lower fee rate so as to remain as economical as possible. This means that the transactions will not be at the top of the mempool and might take a while to confirm. These unspents often do not represent a large amount of funds, and as such, are seemingly not as important to get immediate confirmation. 

Please note that even during periods of low fee rates on the network, and a fee rate of only 5000 satoshi / kB, you’d still be paying 1,475 satoshi per non-segwit input.

This leaves you with a transaction call that looks like this:


 minSize: 3000,

 maxSize: 10000,

 maxInputCountPerConsolidation: 200,

 feeRate: 5000,

<other parameters>


After you have finished the above consolidations, you may still have a high count of unspents left. 

In that case, you might want to consolidate your medium sized unspents as well. As these can encompass a large portion of your wallets balance, we recommend against consolidating these in one go, and instead recommend that you spread the transaction out a little.

The following call will only create 10 consolidation transactions at once, collecting about 2,000 unspents every time into larger chunks. This call will collect unspents between 1mBTC and 100mBTC. It will not create further consolidation transactions when your wallet has been reduced to 2000 unspents. 

 minSize: 100000,
 maxSize: 10000000,
 maxInputCountPerConsolidation: 200,
 feeRate: 10000,
 maxIterationCount: 10,

 target: 2000,
 <other parameters>

We recommend that you simply call this several times per day as the mempool allows, until you have consolidated the the remaining medium value unspents in the wallet. Please remember that you will need to set your fee rates accordingly and that you can modify the minSize and maxSize to suite your individual needs. 

Please also note that the examples above may differ from your actual situation and as such should only be used as a guideline for creating useful consolidation transactions. 

We treat change outputs of transactions slightly different than normal UTXO's and as such, you may want to pass the parameter enforceMinConfirmsForChange with the value true. This will enforce the minConfirms value on all unspents including Change Outputs and prevents the selection of a change output that is used in a transaction currently awaiting confirmation