Consolidate unspents

post/api/v2/{coin}/wallet/{walletId}/consolidateUnspents

Consolidate unspents in a wallet.

Path Parameters

  • coinstringRequired
    A cryptocurrency or token ticker symbol.
    Example: "btc"
  • walletIdstringRequired
    Example: "59cd72485007a239fb00282ed480da1f"
    Pattern: ^[0-9a-f]{32}$

Request Body

walletPassphrase string
Passphrase to decrypt the user key on the wallet
xprv string
Private key in string form, if walletPassphrase is not available
feeRateOne of
Custom minimum fee rate in a coin's base unit per kilobyte (or virtual kilobyte)--for example, satoshis per kvByte or microAlgos per kByte. If the applied "feeRate" does not meet a coin's required minimum transaction fee amount, the minimum is still applied (for example, 1000 sat/kvByte or a flat 1000 microAlgos).
Example: null
maxFeeRateOne of
Custom upper limit for fee rate in a coin's base unit per kilobyte (or virtual kilobyte)--for example, satoshis per kvByte or microAlgos per kByte. "maxFeeRate" can be used to limit a fee rate estimate generated with "numBlocks".
Example: null
Match pattern: ^-?\d+$
maxFeePercentage integer
Maximum relative portion that can be spent towards fees
feeTxConfirmTarget integer
Block target for fee estimation
bulk boolean
Build multiple transactions at the same time. This enables you to increase the maximum number of unspents on the "limit" parameter up to 2,000. If true, you must pass the "txFormat" as "psbt" and you can't pass the "targetAddress" or "numUnspentsToMake" parameters.
minValueOne of
Minimum value of unspents to use in base units (e.g. satoshis). Can be used to skip very small unspents when consolidating at higher fee rates. For doge, only string is allowed.
Example: 2000000
Match pattern: ^-?\d+$
maxValueOne of
Maximum value of unspents to use in base units (e.g. satoshis). Should be used to prevent larger unspents from being consolidated needlessly, and that some funds remain available for spending while the consolidation transactions are in flight. For doge, only string is allowed.
Example: 2000000
Match pattern: ^-?\d+$
minHeight integer
Minimum height of unspents on the block chain to use
minConfirms integer
Minimum confirmation threshold for external inputs
enforceMinConfirmsForChange boolean
Flag for enforcing minConfirms for change inputs
limit integer
Maximum number of unspents to use in the transaction
numUnspentsToMake integer
Number of new unspents to make
targetAddress string
address to use for generated outputs. Must be wallet address.
txFormat string
Format of the returned transaction hex serialization. "legacy" for serialized transaction in custom bitcoinjs-lib format. "psbt" for BIP174 serialized transaction
Allowed values: legacy psbt
Default: legacy
Example: legacy

200 Response

txHexOne of
Serialized transaction hex
Example: 01000000000101d58f82d996dd872012675adadf4606734906b25a413f6e2ee535c0c10aef96020000000000ffffffff028de888000000000017a914c91aa24f65827eecec775037d886f2952b73cbe48740420f000000000017a9149304d18497b9bfe9532778a0f06d9fff3b3befaf870500473044022023d7210ba6d8bbd7a28b8af226f40f7235caab79156f93f9c9969fc459ea7f73022050fbdca788fba3de686b66b3501853695ff9d6f375867470207d233b099576e001000069522103d4788cda52f91c1f6c82eb91491ca76108c9c5f0839bc4f02eccc55fedb3311c210391bcef9dcc89570a79ba3c7514e65cd48e766a8868eca2769fa9242fdcc796662102ef3c5ebac4b54df70dea1bb2655126368be10ca0462382fcb730e55cddd2dd6a53aec8b11400
txInfo UTXO
txInfo (UTXO)
changeAddresses array[string]
nOutputs integer
Number of outputs
Example: 2
nP2SHInputs integer
Example: 0
nSegwitInputs integer
Example: 1
unspents array[object]
walletAddressDetails object
feeInfo UTXO
feeInfo (UTXO)
size integer
Estimated size of the transaction in bytes
Example: 776
fee integer
Estimated fee in base unit for the transaction
Example: 38800
feeRateOne of
Custom minimum fee rate in a coin's base unit per kilobyte (or virtual kilobyte)--for example, satoshis per kvByte or microAlgos per kByte. If the applied "feeRate" does not meet a coin's required minimum transaction fee amount, the minimum is still applied (for example, 1000 sat/kvByte or a flat 1000 microAlgos).
Example: null
payGoFee integer
BitGo fee of the transaction (in base units)
Example: 0
payGoFeeString integer
BitGo fee of the transaction (in base units) represented as a String
Example: 0

400 Response

One of
error string required
Human-readable error message
requestId string required
Client request id
context object
Properties that apply to a specific error name
name string required
Error code