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).
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".
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.
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.
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
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).
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