Dust Collection

Back to Integration Guide

A dust set is a large group of ERG outputs worth tiny amounts. A node signs a transaction by loading every input box from disk. When the wallet owns thousands of dust boxes the process slows down. The node may hit limits or time out. Exchange and mining‑pool wallets reach that state first.

Automatic Collection in the Node

Turn the wallet into “self‑cleaning” mode before dust appears. The node merges dust during every withdrawal when the wallet owns enough surplus inputs.

Add the block below to your ergo.conf. Full syntax is in conf‑wallet.md.

ergo {
  wallet {
    # larger Bloom filters and caches
    profile        = "exchange"       

    # hard cap per transaction (default 50)
    maxInputs      = 300

    # extra sweep when withdrawal needs <100 inputs             
    optimalInputs  = 100

    # ignore deposits ≤ 0.001 ERG              
    dustLimit      = 1000000

    # burn every token that is not on this list
    tokensWhitelist = [         
      
      # SigUSD      
      "03faf2cb329f2e90d6d23b58d91bbb6c046aa143261cc21f52fbe2824bfcbf04",
      # SigRSV 
      "003bd19d0187117f130b62e1bcab0939929ff5c7709f843c5c4dd158949285d0"  
    ]
  }
}
KeyValue / UnitPurpose
profile"exchange"Bloom filters and caches suit high‑load wallets.
maxInputs300Raises the hard cap for inputs in one transaction.
optimalInputs100A sweep runs whenever a withdrawal uses fewer than this number.
dustLimit1000000The wallet ignores payments at or below 0.001 ERG.
tokensWhitelistlist of IDsThe wallet keeps the listed tokens and burns every other asset.

Restart the node after saving the file. The wallet merges dust in the background from the first block it scans.

Fast clean‑up for an existing dusty wallet

  1. Send 0.001 ERG from the wallet to its own change address.
  2. Wait 60 seconds for confirmation.
  3. Repeat until the UTXO count drops below 500.

Each self‑payment pulls about optimalInputs dust boxes into one output, so the backlog shrinks quickly.

Manual Collection (fallback)

Choose this path when every automatic sweep fails because the node exhausts limits before it can pay the fee.

StepCallResult / Note
1GET /wallet/boxes/unspent?limit=100Record every boxId.
2GET /utxo/byIdBinary/{boxId} for each idRecord the bytes field. Plain even‑length hex only.
3Sum every valueKeep at least 1 000 000 nanoERG for the fee.
4Assemble JSONSee the example below.
5POST /wallet/transaction/send (api_key header)The node broadcasts the sweep.
6Repeat with fresh inputsStop when UTXO count is small.

Query minConfirmations, minInclusionHeight, or both if you want mature inputs only. Example:

curl "http://127.0.0.1:9053/wallet/boxes/unspent?minConfirmations=10&limit=100"   -H "accept: application/json" -H "api_key: hello"

Example request body:

{
  "inputsRaw": [
    "8e7a…00",
    "d1f5…42"
  ],
  "fee": 1000000,
  "requests": [
    {
      "address": "9hChangeAddressHere",
      "value": 25123456789
    }
  ]
}

Make sure the fee plus the output value equals the sum of your inputs.

Troubleshooting

Symptom or Log EntryProbable CauseFix
MaxInputsExceededError(…100)maxInputs still at defaultSet maxInputs = 300, restart the node.
Server was not able to produce a timely response …Too many inputs or node overloadSweep dust; verify profile = "exchange"; lower optimalInputs if needed.
Sweep transaction shows few inputsNode did not load the new configCheck startup log for config path; confirm wallet { … } sits inside ergo { … }.
invalid length XXX of Hex dataAn inputsRaw entry has odd lengthRemove wrappers and whitespace; every hex string must have even length.
NotEnoughErgsErrorOutput + fee exceeds input totalLower the output amount, add inputs, or choose higher‑value boxes.
Wallet fills again right after clean‑upConstant tiny depositsKeep the self‑payment cron job running or raise the minimum deposit limit.

Native Assets (tokens)

Users sometimes send random tokens to exchange addresses. A future node version will offer auto‑burn (see Issue #1604). Until that release, destroy unwanted tokens with one step:

Send them to the burn address 4MQyMKvMbnCJG3aJ in a zero‑ERG transaction.

Community lists such as the ergotipper token list help you recognise unknown assets.