11

Why do transactions have multiple inputs with the same address? Is it because the amounts were obtained in the address through multiple separate transactions. Shouldn't the amounts be clubbed to a single input since the addresses are the same. An example is this one.

Shouldn't the inputs be 1LS1h8UJFgAFqRsw8WqjszBdJWDQg3hj6d with 0.01580432 BTC instead of repeating the same address with 0.00396188 BTC and 0.01184244 BTC.

4
  • 2
    While the question is different, my answer here explains why the inputs don't collapse: Can receiving money make a transaction fail?
    – Murch
    Jun 15, 2016 at 7:55
  • @Murch From your answer, UTXOs having the same address don't merge together since they are still distinct on their transaction indices.
    – Ni9elF
    Jun 16, 2016 at 6:10
  • Yeah, they are tuples of (txid, vout), where the first refers to the transaction the UTXO originated from, and the latter gives the position in the output list. The address isn't part of the UTXO identity. It only defines who will be able to spend the UTXO as it restrains what signature would be valid.
    – Murch
    Jun 16, 2016 at 6:24
  • On second thought, I made this an answer. :)
    – Murch
    Jun 16, 2016 at 6:27

3 Answers 3

6

The UTXO that are being used as inputs are tuples of (txid, vout), where the former refers to the transaction the UTXO originated from, and the latter gives the position in the output list.

The address isn't part of a UTXO's identity. It is part of the content, defining who will be able to spend the UTXO as it restrains what signature will be valid.

2
  • The transaction output list will have to be stored with an ordering in the ledger. Why not specify it as a (txid, address) tuple?
    – Ni9elF
    Jun 16, 2016 at 6:32
  • That wouldn't be guaranteed to be unique. You could have multiple outputs in one transaction to the same address. Also, there are other types of transactions that don't use an address to identify the recipient.
    – Murch
    Jun 16, 2016 at 6:59
8

Inputs do not refer to addresses, but rather unspent transaction outputs (UTXOs). If there are multiple UTXOs payable to the same address, then a transaction spending those UTXOs will have to list them individually, and cannot lump them together into a single input. The fact that all the UTXOs are payable to the same address doesn't matter; they still need to be listed as inputs separately.

2
  • 2
    This was a design decision in Bitcoin. Bitcoin makes transaction outputs primary and makes addresses essentially a convenience with no real notion of an account. Other systems make the opposite decision. For example, Ripple makes accounts primary and transactions adjust account balances. There are advantages and disadvantages to each model. Jun 15, 2016 at 18:04
  • @DavidSchwartz Interesting, could you please elaborate on the pros and cons of the two models here.
    – Ni9elF
    Jun 16, 2016 at 6:40
5

In the transaction you just listed 1LS1h8UJFgAFqRsw8WqjszBdJWDQg3hj6d is both an input and a change address.

Most of the transaction funds were sent to 187SRqCeXctTbfaqErNqUN5kDzv2PjHVeQ and the rest went back to 1LS1h8UJFgAFqRsw8WqjszBdJWDQg3hj6d

with 0.01580432 BTC, https://blockchain.info/tx/4d3ec229677ec9f6bf2a85c57c691bc648e7f4911453d3167a2e8d2fed44dc94

This is a bad practice for privacy reasons. Someone watching can tell that the sender controls 1LS1h8UJFgAFqRsw8WqjszBdJWDQg3hj6d (used as input and change address).

If no address reuse was present then someone could not tell which was the destination address and which was the change address.

Always create new addresses for change.

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.