<p>If all the 1BTC was in one Unspent Transaction Output (UTXO) then you'd indeed send all of the 1BTC as an input in a transaction and assign this to two new outputs: 0.5BTC to make your payment and 0.5BTC to return your change to yourself.</p>

<p>If the 1BTC was split up into several Unspent Transaction Outputs, then you may have a combination that amounts exactly to 0.5BTC, e.g. you could use 0.1BTC+0.2BTC+0.2BTC. Then no change output would be created.</p>

<p>Whether you send change to the same address as before, or to a new address is up to the creator of the transaction. Most wallets avoid reusing the same address by default though, so the change output is sent to a new address.</p>

CC BY-SA 3.0
2017-02-04T16:09:40.303Z
related: [How does change work in a bitcoin transaction?](http://bitcoin.stackexchange.com/q/736/5406)
Murch
CC BY-SA 3.0
2017-02-04T17:45:57.320Z
Ok thank you! But either way, everything is done automatically by the wallet right? I don't need to care about wether or not the BTC was in one Unspent Transaction Output (UTXO) ? However, when is it truly useful to know that?
user45541
CC BY-SA 3.0
2017-02-04T17:57:18.203Z
Yes, this sort of managing is exactly the purpose of wallet software. It may be interesting for you to know about your UTXO if you're micromanaging your privacy.
Murch
CC BY-SA 3.0
2017-02-04T16:09:23.817Z
2017-02-04T16:09:23.817Z
Murch
<p>Every private key has exactly one corresponding public key, and every public key has one address. Whenever a new address is generated, internally that means a new private key and public key are generated. Note that with BIP32 and BIP44, private keys can be generated deterministically from a master key or a seed, in which case these new private keys do not necessary need to be saved - they can just be regenerated from the seed or master whenever needed.</p>

<p>A new keypair is used for each change in most wallets, but that's done internally - it won't show you the address for those, as there is no need for anyone else to send you money to that.</p>

<p>Creating addresses is very cheap. A modern CPU can generate 1000s per second. It also does not require any interaction with the network. All that is needed is generating 32 bytes of random data, and computing its corresponding elliptic curve point.</p>

CC BY-SA 3.0
2017-01-29T20:55:49.500Z
Ok thank you but it means that I still keep my FIRST (same) private key of my wallet with the change I received? (internally they should've sent it back to my first adress) right?
user45541
CC BY-SA 3.0
2017-01-29T22:50:37.800Z
I don't understand your comment.
Pieter Wuille
CC BY-SA 3.0
2017-01-30T08:59:08.263Z
"A new key is used for each change in most wallets, but that's done internally" which key? a new private one? or public?
user45541
CC BY-SA 3.0
2017-01-30T15:52:42.360Z
Edited to keypair. Every private key has one public key (ignoring encoding), and the other way around.
Pieter Wuille
CC BY-SA 3.0
2017-01-29T19:09:08.780Z
2017-01-30T20:58:45.950Z
2017-01-30T20:58:45.950Z
Pieter Wuille
<p>So, imagine I bought 1 BTC, so I have my private key generated by my online wallet and also my public key that I can give to people/friends.
My question is, if I spend 0.5 to buy Apples on a website? </p>

<p>How does that work? </p>

<p>1) Only 0.5 BTC is sent to the website, I still have 0.5 BTC on private key A</p>

<p>2) 1 BTC total is sent through the protocol, thus the change is sent back to me.
On which key?
Key A where I had 1 BTC ? Or a new one generated? (Key B) </p>

<p>Thank you :)</p>

CC BY-SA 3.0
2017-01-30T08:46:39.350Z
Since you're using blockchain.info as your wallet provider, it is probably best if you ask them how are your keys managed or read their FAQ
rny
CC BY-SA 3.0
2017-02-04T14:19:24.063Z
I'm really not sure what this question is supposed to be about. 1) Are you asking whether blockchain.info reuses addresses for change outputs? 2) Are you asking whether there can be more than one address per private key? 3) Are you generally asking about wallets managing multiple addresses?
Murch
CC BY-SA 3.0
2017-02-04T15:08:48.690Z
Hi, I am asking: I have 1 BTC I buy something at 0.5 BTC. Where is the 0.5 change going to go on my wallet?
user45541
CC BY-SA 3.0
2017-02-04T15:09:45.437Z
Someone else told me there is no change, so if you have 1 BTC on address A you want to spend 0.5, well you spend it and you still have 0.5 BTC on address A.
user45541
<transactions><wallet><private-key>
Does a new private key is generated at each transaction?
user45541
# Does a new private key is generated at each transaction?

(Asked by: username_0 on 2017-01-29)

So, imagine I bought 1 BTC, so I have my private key generated by my online wallet and also my public key that I can give to people/friends.
My question is, if I spend 0.5 to buy Apples on a website?

How does that work?

1) Only 0.5 BTC is sent to the website, I still have 0.5 BTC on private key A

2) 1 BTC total is sent through the protocol, thus the change is sent back to me.
On which key?
Key A where I had 1 BTC ? Or a new one generated? (Key B)

Thank you :)

**Tags:** transactions, wallet, private-key

> **Comments:**
> **username_1**: Since you're using blockchain.info as your wallet provider, it is probably best if you ask them how are your keys managed or read their FAQ  
> **username_2**: I'm really not sure what this question is supposed to be about. 1) Are you asking whether blockchain.info reuses addresses for change outputs? 2) Are you asking whether there can be more than one address per private key? 3) Are you generally asking about wallets managing multiple addresses?  
> **username_0**: Hi, I am asking: I have 1 BTC I buy something at 0.5 BTC. Where is the 0.5 change going to go on my wallet?  
> **username_0**: Someone else told me there is no change, so if you have 1 BTC on address A you want to spend 0.5, well you spend it and you still have 0.5 BTC on address A.  

---

## 2 answers

### Answer by username_3 on 2017-01-29. Score: 6 | Accepted answer

Every private key has exactly one corresponding public key, and every public key has one address. Whenever a new address is generated, internally that means a new private key and public key are generated. Note that with BIP32 and BIP44, private keys can be generated deterministically from a master key or a seed, in which case these new private keys do not necessary need to be saved - they can just be regenerated from the seed or master whenever needed.

A new keypair is used for each change in most wallets, but that's done internally - it won't show you the address for those, as there is no need for anyone else to send you money to that.

Creating addresses is very cheap. A modern CPU can generate 1000s per second. It also does not require any interaction with the network. All that is needed is generating 32 bytes of random data, and computing its corresponding elliptic curve point.

> **Comments:**
> **username_0**: Ok thank you but it means that I still keep my FIRST (same) private key of my wallet with the change I received? (internally they should've sent it back to my first adress) right?  
> **username_3**: I don't understand your comment.  
> **username_0**: "A new key is used for each change in most wallets, but that's done internally" which key? a new private one? or public?  
> **username_3**: Edited to keypair. Every private key has one public key (ignoring encoding), and the other way around.  

---

### Answer by username_2 on 2017-02-04. Score: 0

If all the 1BTC was in one Unspent Transaction Output (UTXO) then you'd indeed send all of the 1BTC as an input in a transaction and assign this to two new outputs: 0.5BTC to make your payment and 0.5BTC to return your change to yourself.

If the 1BTC was split up into several Unspent Transaction Outputs, then you may have a combination that amounts exactly to 0.5BTC, e.g. you could use 0.1BTC+0.2BTC+0.2BTC. Then no change output would be created.

Whether you send change to the same address as before, or to a new address is up to the creator of the transaction. Most wallets avoid reusing the same address by default though, so the change output is sent to a new address.

> **Comments:**
> **username_2**: related: [How does change work in a bitcoin transaction?](http://bitcoin.stackexchange.com/q/736/5406)  
> **username_0**: Ok thank you! But either way, everything is done automatically by the wallet right? I don't need to care about wether or not the BTC was in one Unspent Transaction Output (UTXO) ? However, when is it truly useful to know that?  
> **username_2**: Yes, this sort of managing is exactly the purpose of wallet software. It may be interesting for you to know about your UTXO if you're micromanaging your privacy.  

---

