3

I have been playing around with a private Monero test network and I noticed that the transactions always have two or more inputs. When I inspected the true inputs of a transaction, I observed that one input has more value than the total transaction value. So it is not the case that Monero is combining multiple inputs to send a large amount of XMR.

jtgrassie
  • 19,111
  • 4
  • 14
  • 51
John G.
  • 43
  • 2

1 Answers1

1

Why does Monero create two or more inputs for transactions?

This is done to try and make more transactions look the same. An attempt is made to make the transactions a 2/2 (2 input, 2 output transaction). Therefore, even if one of your inputs has enough to fund the output(s), the wallet will attempt to add another input as well.

Source comment(s):

wallet2.cpp#L9315

// for rct, since we don't see the amounts, we will try to make all transactions
// look the same, with 1 or 2 inputs, and 2 outputs. One input is preferable, as
// this prevents linking to another by provenance analysis, but two is ok if we
// try to pick outputs not from the same block. We will get two outputs, one for
// the destination, and one for change.

Then later:

wallet2.cpp#L9361

// while:
// - we have something to send
// - or we need to gather more fee
// - or we have just one input in that tx, which is rct (to try and make all/most rct txes 2/2)

So it is not the case that Monero is combining multiple inputs to send a large amount of XMR.

This is a slightly different question/observation and is incorrect. Monero absolutely uses multiple inputs to fund a large output. For example, if you own three outputs with values 10, 50 and 100 XMR and want to spend 130 XMR, the wallet will create a transaction with two inputs (your owned outputs that have 100 and 50), and two new outputs (with 130 and 20). The 2nd output is your change.

jtgrassie
  • 19,111
  • 4
  • 14
  • 51
  • Thank you. But as for your second point, I wasn't denying that Monero uses multiple inputs to fund a large output. In my simulations it just didn't seem to be the case that Monero was creating multiple inputs to fund a large output. It seemed that even when one input is enough to fund the transaction, Monero was creating two-input transactions. I learned from your answer that Monero tries to make most RCT transactions 2/2. Then, why do so many transactions these days still have only one input? – John G. Aug 13 '19 at 02:01
  • "Then, why do so many transactions these days still have only one input?" <- presumably users who only own one output to be able to spend. You can't use 2 if you only have 1 ;) – jtgrassie Aug 13 '19 at 02:04