Let say Alice wants to send Bob 10 XMR and she has 15, so assume the outputs are divided like this -

transaction - {

  output #1 - {7, Bob's stealth address}

  output #2 - {3, Bob's stealth address}

  output #3 - {5, Alice's stealth address}


Am I right or am I far off?

If it's liked I said above, I would like a reference to the code that handles the change (calculates a stealth address for it, puts it in the outputs, etc).

Thanks a million for any answers!


A transaction has inputs and outputs. All inputs must be spent.

So in your example of Alice wanting to send Bob 10 of her 15 XMR, assuming Alice has all her 15 XMR in 1 UTXO, she would have 1 input and 2 outputs. The 2 outputs would be a stealth address for Bob with a value of 10 XMR and a stealth address for Alice with a value of 5 (minus the tx fee) XMR.

Search for create_transaction in https://github.com/monero-project/monero/blob/master/src/wallet/wallet2.cpp to see code for how transactions are constructed.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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