<p>When a Bitcoin transaction is created, unspent transaction outputs (UTXOs) are used in the inputs of the transaction. Your wallet will use as many UTXOs (and therefore create as many inputs) as necessary to achieve the value you're trying to send in your transaction.</p>

<p>UTXOs have to be spent completely, so most likely the total value achieved by the sum of the inputs will be greater than the amount you wanted to transfer. There's where change outputs come into play (the additional outputs you're getting). In order to avoid having to send more value than you wanted to the destination address (<code>addr_dst</code>), the difference between the sum of the inputs (<code>vi</code>) and the value to be sent (<code>vo</code>) is sent to a change address (<code>addr_chng</code>), i.e:</p>

<p><code>vo - fee</code> is sent to <code>addr_dst</code></p>

<p><code>vi - vo - fee</code> is sent to <code>addr_chng</code></p>

<p>That change address is usually owned by you.</p>

CC BY-SA 4.0
2019-06-02T04:55:45.343Z
Actually I think all `vo` is sent to `addr_dst` and `fee` just reduced from our input(`vi`), so if i send A bitcoin to my friend with a specific address, he receives all A bitcoin in his wallet.
Saeed
CC BY-SA 4.0
2019-06-02T15:02:23.340Z
Well, it depends on the implementation, but sure, it's also possible.
sr_gi
CC BY-SA 4.0
2019-05-28T14:27:09.940Z
2019-05-28T14:27:09.940Z
sr_gi
<p>Bitcoin transactions do not spend from addresses, and addresses do not have balances<br>
Every transaction has one or more inputs and one or more outputs<br>
An output is an address and an amount<br>
An input is a reference pointer to the output it is spending - the reference is a unique identifier for a single output: txID and output number (eg. 0, 1, 2, 3) </p>

<p>An output which has not been spent is a coin<br>
To spend a coin, create a transaction with an input which points to the coin </p>

<p>Bitcoin does not have partial spends<br>
A coin can only be spent completely<br>
A coin can only be spent once </p>

<blockquote>
  <p>I send a specific value from one wallet to another wallet </p>
</blockquote>

<p>You spent one or more coins. The value of those coins was greater than the amount you needed to pay. You transaction has 2 outputs (new coins). One of the outputs is the address and amount you were sending. The other output is the difference between your input coins and the amount you were spending - referred to as "change". The change address is your address. The change coin belongs to you, to spend in a future transaction</p>

<p>* This explanation omits the transaction fee, for simplification. The other answer is more complete because it mentions fees</p>

CC BY-SA 4.0
2019-05-29T09:01:01.213Z
2019-05-29T09:01:01.213Z
Owen Currie
<p>Some days ago, I write a program to extract output addresses and its value in tx messages of a sample bitcoin pcap.
extracted addresses are all valid and we can find them in block explorers.</p>

<p>after that, just for testing, I send a specific value from one wallet to another wallet and capture all input/output packets during this transfer.</p>

<p>When I test my program with this sample traffic, some addresses and values are generated, one of those addresses was my own address and its value was the same value which I transferred, but some other addresses are generated which are all valid addresses and valid values but I don't know their value.</p>

<p>I guess that these values are UTXOs, but how I can sure about that?
Also, I see same value and same address which i sent in my wallet, in multiple packets with different source and destination IP addresses. for example I send A bitcoin from one wallet to another one, and beside that B bitcoin sent to </p>

CC BY-SA 4.0
2019-05-28T22:27:09.037Z
Possible duplicate of [How does change work in a bitcoin transaction?](https://bitcoin.stackexchange.com/questions/736/how-does-change-work-in-a-bitcoin-transaction)
chytrik
<transactions><address><value><bech32-address>
which is the relationship between ouput adresses and their value in a specific transaction?
Saeed
# which is the relationship between ouput adresses and their value in a specific transaction?

(Asked by: username_0 on 2019-05-28)

Some days ago, I write a program to extract output addresses and its value in tx messages of a sample bitcoin pcap.
extracted addresses are all valid and we can find them in block explorers.

after that, just for testing, I send a specific value from one wallet to another wallet and capture all input/output packets during this transfer.

When I test my program with this sample traffic, some addresses and values are generated, one of those addresses was my own address and its value was the same value which I transferred, but some other addresses are generated which are all valid addresses and valid values but I don't know their value.

I guess that these values are UTXOs, but how I can sure about that?
Also, I see same value and same address which i sent in my wallet, in multiple packets with different source and destination IP addresses. for example I send A bitcoin from one wallet to another one, and beside that B bitcoin sent to

**Tags:** transactions, address, value, bech32-address

> **Comments:**
> **username_1**: Possible duplicate of [How does change work in a bitcoin transaction?](https://bitcoin.stackexchange.com/questions/736/how-does-change-work-in-a-bitcoin-transaction)  

---

## 2 answers

### Answer by username_2 on 2019-05-28. Score: 2

When a Bitcoin transaction is created, unspent transaction outputs (UTXOs) are used in the inputs of the transaction. Your wallet will use as many UTXOs (and therefore create as many inputs) as necessary to achieve the value you're trying to send in your transaction.

UTXOs have to be spent completely, so most likely the total value achieved by the sum of the inputs will be greater than the amount you wanted to transfer. There's where change outputs come into play (the additional outputs you're getting). In order to avoid having to send more value than you wanted to the destination address (`addr_dst`), the difference between the sum of the inputs (`vi`) and the value to be sent (`vo`) is sent to a change address (`addr_chng`), i.e:

`vo - fee` is sent to `addr_dst`

`vi - vo - fee` is sent to `addr_chng`

That change address is usually owned by you.

> **Comments:**
> **username_0**: Actually I think all `vo` is sent to `addr_dst` and `fee` just reduced from our input(`vi`), so if i send A bitcoin to my friend with a specific address, he receives all A bitcoin in his wallet.  
> **username_2**: Well, it depends on the implementation, but sure, it's also possible.  

---

### Answer by username_3 on 2019-05-29. Score: 0

Bitcoin transactions do not spend from addresses, and addresses do not have balances  
Every transaction has one or more inputs and one or more outputs  
An output is an address and an amount  
An input is a reference pointer to the output it is spending - the reference is a unique identifier for a single output: txID and output number (eg. 0, 1, 2, 3)

An output which has not been spent is a coin  
To spend a coin, create a transaction with an input which points to the coin

Bitcoin does not have partial spends  
A coin can only be spent completely  
A coin can only be spent once

> I send a specific value from one wallet to another wallet

You spent one or more coins. The value of those coins was greater than the amount you needed to pay. You transaction has 2 outputs (new coins). One of the outputs is the address and amount you were sending. The other output is the difference between your input coins and the amount you were spending - referred to as "change". The change address is your address. The change coin belongs to you, to spend in a future transaction

\* This explanation omits the transaction fee, for simplification. The other answer is more complete because it mentions fees


---

