decompose_amount_into_digits(uint64_t amount, uint64_t dust_threshold, const chunk_handler_t& chunk_handler, const dust_handler_t& dust_handler)

Monero uses this function while constructing a new miner_tx and and also on transfer.

Caan anyone give me a clear explanation about what exactly happens and what is the role of chunk_handler and dust_handler?


1 Answer 1


That function splits a number into it decimal components, except for the lower significance ones, which are grouped. For example, the number 84938394 will be split into 80000000, 4000000, 900000, 30000, and 8394 (if the dust threshold is 10000).

This was used by the ring signature process to pick outputs from the blockchain with the same amount as the one that's being spent, since otherwise there would be too many different amounts, and thus poor selection. chunk_handler and dust_handlers are just two functions called with each of the split amounts above. Amounts below the dust threshold are called dust, and typically "complex" numbers which have few, or no, other potential ring members on the blockchain.

This is not used with RingCT anymore, since output amounts are hidden, and every rct output can be used in a ring signature with any other, doing away with the need for splitting amounts into those "canonical" ones.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.