Difference between revisions of "Change"

Line 18: Line 18:
  
 
An example can be found [https://whatsonchain.com/tx/682e4ee70f5ba2a174e5427e4bdd645ee229ed64d2b9ca55d315035de6d85668 here].
 
An example can be found [https://whatsonchain.com/tx/682e4ee70f5ba2a174e5427e4bdd645ee229ed64d2b9ca55d315035de6d85668 here].
 
==See Also==
 
 
* [[Coin analogy]]
 
 
[[Category:Technical]]
 
[[Category:Vocabulary]]
 

Revision as of 04:44, 21 January 2020

Introduction

When a UTXO is spent, it must be consumed entirely. If the value of the UTXO is greater than the amount being spent, then the difference in the amount must be allocated to a new address that the spender owns; this is a change address.

Bitcoin transactions are analogous to a real-life cash transactions. If a customer would like to purchase a video game for $50 but only has a $100 bill, the customer must give the entire $100 bill to the merchant; they cannot cut the bill in half and hand it over. Bitcoin operates in the same manner.

Typical example

In a standard payment scenario, the sender consumes a single UTXO, paying the spending amount to the receiver's address, then receiving the change into a new address that they control to take advantage of privacy.

An example of this type of transaction can be viewed here.

Change back to spending address

In a naive implementation, the sender consumes a single UTXO as in the previous example, with the only difference being to receive the change into the same spending address. This means of transacting is not recommended as it does not take advantage of Bitcoin's privacy model.

This example also demonstrates where the difference between the input and output is only the mining fee since a message is being written to the blockchain.

Consolidating UTXOs

In some cases, the spender may have many UTXOs that they would like to consolidate. This has the added benefit of reducing the network's total UTXO set, shrinking the database that all nodes maintain. Consequently, the computation for processing these inputs could be expensive. Miners could potentially process these types of transactions at a lower fee.

An example can be found here.