Skip to main content
A vault account that receives many small deposits ends up holding many small unspent transaction outputs (UTXOs). A transaction can spend only a limited number of inputs (see the limits in Multi-input transactions), so a wallet with many small UTXOs can hold funds that it cannot send in one transaction. Consolidation spends many small UTXOs in one transaction that has a single output, to an address you own, so that later transactions need fewer inputs.

How to consolidate

  1. Change the selection strategy for the vault account and asset from Adaptive to Ascending (ASC), which uses the smallest UTXOs first. Adaptive Selection, the default, does not necessarily favor small UTXOs. You can do this in the Fireblocks Console (Settings > General > UTXO selection strategy) or with the UTXO selection configuration API (PUT /utxo_management/{vaultAccountId}/{assetId}/selection_config).
  2. Call Get max spendable amount in a transaction for the vault account and asset. With ASC, it returns the sum of the smallest available UTXOs, up to the input limit and before the network fee.
  3. Create a transaction for that amount with treatAsGrossAmount set to true, and send it to your own vault account: the permanent deposit address of a vault account you own, which can be the source vault account. The fee is deducted from the amount, so the selected inputs cover it and the transaction has one output and no change.
  4. Repeat steps 2 and 3 until the wallet has few enough UTXOs. Wait until the previous transaction reaches PENDING_SIGNATURE or a later status, such as BROADCASTING or CONFIRMING, because it has selected its inputs by then. Do not send several consolidation transactions at once, because max spendable returns the same UTXOs until the first transaction selects them.
  5. When you finish, change the strategy back to Adaptive.
The strategy applies to every transaction from that vault account and asset, so other transactions you create while consolidating also use ASC.

Fees

The network fee is paid from the funds being consolidated, so consolidate when fees are low. A native SegWit input adds about 68 vbytes, so a transaction that spends 250 inputs is about 17,000 vbytes: roughly 17,000 satoshis at 1 sat/vB and 85,000 satoshis at 5 sat/vB. The smallest UTXOs can be worth less than the fee needed to spend them. If the quoted amount is smaller than the fee, the transaction fails. In that case, wait for lower fees, or consolidate only UTXOs above a minimum amount using the filters described in Select UTXOs for a transaction. Use the same filters in both calls. Set them as query parameters on Get max spendable amount (for example, minAmount), and pass them in utxoSelectionParams.filters when you create the transaction. Selection ignores filters that the transaction request leaves out, so it would pick the smallest UTXOs and the amount would no longer match.

Code samples