3

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!

2

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.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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