Skip to main content

sweep_below

Consolidates ("sweeps") all spendable outputs of the wallet whose individual amount is below a given threshold into a single transaction sent to the specified address, which is the standard way to clean up accumulated dust.

Request

{
"jsonrpc": "2.0",
"id": 0,
"method": "sweep_below",
"params": {
"mixin": 10,
"address": "NiRDAcbaxXkyWRgYbeARBpngfmFat5TjDjjQA5NAbouB9eytwGWJqA5shAVYeCAHWPo254DF2o2X1td79PNvRr2Yc1b9Ep67ff",
"amount": 1000000000000,
"payment_id_hex": "",
"fee": 10000000000
}
}

Request parameters

  • mixin - unsigned int; number of decoy outputs (fake outs) to mix in for every input of the resulting transaction. 0 means no mixing. Only outputs that already have enough confirmations to be mixed at the requested level are eligible for sweeping.
  • address - string; destination address the swept coins are sent to. May be a standard NiR-prefixed address, an integrated address or a registered alias. If an integrated address is used, its embedded payment id is applied automatically and payment_id_hex must be left empty.
  • amount - unsigned int; the threshold, in atomic units. Every spendable output of the wallet with an amount strictly less than this value is included in the sweep.
  • payment_id_hex - string; optional hex-encoded payment id to attach to the transaction. Pass an empty string if no payment id is needed. Cannot be combined with an integrated address that already carries a payment id.
  • fee - unsigned int; transaction fee in atomic units. Must be at least the minimum fee currently accepted by the tx pool, otherwise the call fails with a WRONG_ARGUMENT error.

Because a sweep transaction is limited by the maximum allowed transaction size, the wallet may not be able to sweep every matching output in one call. Compare outs_swept with outs_total in the response and repeat the call until all dust has been consolidated. If no spendable output matches the criterion at all, the call fails with an error.


Response

{
"id": 0,
"jsonrpc": "2.0",
"result": {
"tx_hash": "b39c0c9a5d19e97e59f5a8ae4a5e8e21bb2a0e6f6a4d3b1ca7c8a6bd9d1a4f37",
"tx_unsigned_hex": "",
"outs_total": 184,
"amount_total": 92000000000000,
"outs_swept": 120,
"amount_swept": 60000000000000
}
}

Response information

  • tx_hash - string; hex-encoded identifier of the created and broadcast transaction. Filled in for normal (spendable) wallets. For a watch-only wallet this field is left empty, because the transaction hash is not final until the transaction has been signed.
  • tx_unsigned_hex - string; hex-encoded unsigned transaction blob. Filled in only for watch-only wallets, which cannot sign and relay transactions themselves. Pass this blob to sign_transfer on the corresponding cold (spend-capable) wallet and then relay the result with submit_transfer. Empty for normal wallets.
  • outs_total - unsigned int; total number of the wallet's spendable outputs whose amount is below the requested threshold, i.e. how many outputs are candidates for sweeping in total.
  • amount_total - unsigned int; sum of the amounts, in atomic units, of all outs_total candidate outputs.
  • outs_swept - unsigned int; number of outputs that were actually included as inputs of the created transaction. This can be less than outs_total when the candidates do not all fit into a single transaction.
  • amount_swept - unsigned int; sum of the amounts, in atomic units, of the inputs actually included in the created transaction. The recipient receives amount_swept minus fee.