Difference between revisions of "Change"
Line 5: | Line 5: | ||
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. | ||
− | In [https://whatsonchain.com/tx/d0033a539a426de7142f4b230328c84306b6ebc1c985515d522a411c397522df 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 as change into address 1LNq2ZePCj2mycctrvQqBVnTLeaJeyDeR4. [[Transaction fees]] of 226 Satoshis were take by the miner who found block 605,046 as part of their block reward. | + | In [https://whatsonchain.com/tx/d0033a539a426de7142f4b230328c84306b6ebc1c985515d522a411c397522df 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 as change into address 1LNq2ZePCj2mycctrvQqBVnTLeaJeyDeR4. | ||
+ | |||
+ | [[Transaction fees]] of 226 Satoshis were take by the miner who found block 605,046 as part of their block reward. | ||
=== Change back to spending address === | === Change back to spending address === |
Revision as of 06: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.
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.
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 as change into address 1LNq2ZePCj2mycctrvQqBVnTLeaJeyDeR4.
Transaction fees of 226 Satoshis were take by the miner who found block 605,046 as part of their block reward.
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.