Difference between revisions of "Change"

Line 2: Line 2:
 
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.
 
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.
  
===Typical example===
+
===Example 1===
 
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.
 
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.
  
Line 11: Line 11:
 
The difference of 226 Satoshis was paid as [[Transaction fees]] to the miner who found block 605,046.
 
The difference of 226 Satoshis was paid as [[Transaction fees]] to the miner who found block 605,046.
  
 
+
===Example 2===
[https://whatsonchain.com/tx/defaaec6d8687a27da68d2bd445dac9c1333c4460246309070a5a3cf40f3d6f0 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.
+
In [https://whatsonchain.com/tx/defaaec6d8687a27da68d2bd445dac9c1333c4460246309070a5a3cf40f3d6f0 this example], we can see more clearly that the difference between the input and output is the mining fee.
 +
since a message is being written to the blockchain.
  
 
=== Consolidating UTXOs ===
 
=== Consolidating UTXOs ===

Revision as of 06:47, 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.

Example 1

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.

In this example, we can see that address 197vdcD73wQF5FviYXXgv6cXJBibc9phdq held a UTXO containing 47,097 Satoshis.

They paid 10,000 Satoshis to 1C7UVhVnspkxot82j6ooMxUUFEWy4Pj1tc and received 36,871 Satoshis as change into address 1LNq2ZePCj2mycctrvQqBVnTLeaJeyDeR4.

The difference of 226 Satoshis was paid as Transaction fees to the miner who found block 605,046.

Example 2

In this example, we can see more clearly that the difference between the input and output is 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.