3
Isn't it enough to just have the Input Address, Output Address, Amount and Signature for each transaction?
3
Isn't it enough to just have the Input Address, Output Address, Amount and Signature for each transaction?
1
We don't refer to previous transactions, but rather to specific outputs of previous transactions. When transactions sign over money to a recipient, they create a uniquely identifiable "Unspent Transaction Output" or UTXO. Transaction inputs in turn spend these "UTXO" to fuel transactions. Since addresses can be reused, addresses alone are insufficient to precisely identify the bitcoins that are being spent.
If you only had "Input Address, Output Address, Amount and Signature for each transaction". This would be trivially broken:
Let's say Alice keeps all her funds in address A1, and pays Bob 0.1BTC in rent to address B1.
Bob pays Mallet to fix Alice's heater from B1, using the funds that he received from Alice.
When Alice pays Bob next month again from address A1 to address B1, Mallet can replay Bob's transaction to himself in order to get paid again.
0
Bitcoin doesn't track account balances like traditional accounting, it only keeps a record of where BTC came from and which address it is sent to. So, your receiving address doesn't technically have a recorded balance, only a calculated balance for all the transactions received on that address. Once you send Bitcoin, the unspent transaction output you reference when sending becomes spent and the calculated balance for that address you originally received on becomes zero.
You may find this video of assistance:
How Bitcoin Works Under the Hood
1I suppose the question then becomes, why do you need to precisely identify the bitcoins being spent? Why isn't it sufficient to ensure only that an address doesn't spend more than it has received? – B T – 2017-12-23T23:40:54.587
1@BT: Because precisely identifying what money you spend makes it much simpler to prevent doublespending. – Murch – 2017-12-23T23:45:18.710
1Could you explain that further? I don't quite see why that's the case. – B T – 2017-12-24T08:06:14.817
@Murch So you are saying that it isn't possible to prevent double spending without having previous transaction outputs as a reference? – Keyvan Kambakhsh – 2017-12-24T17:18:48.353
1It is possible, e.g. Ethereum with its account-based design doesn't have UTXOs. However, then the order of transactions needs to be tracked and you need sequence ids. While the UTXO-based design is a bit harder to grok, it's much simpler to implement and more versatile for transaction creation. – Murch – 2017-12-24T23:14:37.300
@Murch Re versatility: what's an example of something you can do with a UTXO design that you can't do with an account-based design? – B T – 2017-12-25T10:37:30.910
1@BT: Send a high priority transaction with a high fee while a low priority transaction is still unconfirmed. – Murch – 2017-12-25T15:47:51.813