Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: uchegod-21 on November 25, 2021, 06:07:55 PM



Title: why there is change address.
Post by: uchegod-21 on November 25, 2021, 06:07:55 PM
I read that when you sent bitcoin to someone the output you are sending is the balance of the input you receive last. So you will not use the balance in your wallet until the transaction is confirm and your balance is send back to you through change address.
Quote from:  Elyse Jupiter
Consider the example of taking a $20 bill out of your wallet to pay for a $5 cup of coffee. You would give the $20 to the cashier, and the cashier would give you back the $15. While the $15 belongs to you, it is not available for the time it takes the cashier to give you back your change
But if am using my ordinary fiat wallet and I use $20 to pay bill and I still have other dollars in my wallet I can use them to buy other things before my change will come. Why is  bitcoin spending different.


Title: Re: why there is change address.
Post by: OmegaStarScream on November 25, 2021, 06:28:50 PM
It's good for your privacy, here's a pretty good (and simple) explanation by Exodus: https://support.exodus.com/article/109-what-are-change-addresses#receive

Also, I don't see the problem? since even though the funds are being sent to another address, they would remain in the same software wallet, so it really doesn't affect the UX at all.


Title: Re: why there is change address.
Post by: jackg on November 25, 2021, 06:30:10 PM
I read that when you sent bitcoin to someone the output you are sending is the balance of the input you receive last. So you will not use the balance in your wallet until the transaction is confirm and your balance is send back to you through change address.
Quote from:  Elyse Jupiter
Consider the example of taking a $20 bill out of your wallet to pay for a $5 cup of coffee. You would give the $20 to the cashier, and the cashier would give you back the $15. While the $15 belongs to you, it is not available for the time it takes the cashier to give you back your change
But if am using my ordinary fiat wallet and I use $20 to pay bill and I still have other dollars in my wallet I can use them to buy other things before my change will come. Why is  bitcoin spending different.


What your bank does is store a number for your balance and they keep changing this number based on the transactions you do.

With bitcoin you send funds to someone and the change back to yourself (often to your change address).

As to why this is actually done, I'm not sure - it might allow for privacy to be improved or security in some ways.


Title: Re: why there is change address.
Post by: BitMaxz on November 25, 2021, 06:31:49 PM
It depends on what wallet you use because there are some wallets that doesn't have a change address or you can disable it manually like Electrum you can disable that function.

Change address was generated for privacy purposes and it is an address where the remainder is being sent to your other address after you send a specified amount to the receiver.

Actually, it's no different there is also a coin control feature where you can choose any UTXO to spend. It is likely you have other dollars in your wallet sample you have $20 and $5 in your pocket since the coffee price is $5 you can pay it with your $5.


Title: Re: why there is change address.
Post by: LoyceV on November 25, 2021, 06:31:56 PM
Quote from:  Elyse Jupiter
Consider the example of taking a $20 bill out of your wallet to pay for a $5 cup of coffee. You would give the $20 to the cashier, and the cashier would give you back the $15. While the $15 belongs to you, it is not available for the time it takes the cashier to give you back your change
Bitcoin change is instant: it's available at the exact same moment you make your transaction (but it might depend on wallet settings, in Bitcoin Core I've ticked "Spend unconfirmed change").

Quote
But if am using my ordinary fiat wallet and I use $20 to pay bill and I still have other dollars in my wallet I can use them to buy other things before my change will come. Why is  bitcoin spending different.
If you have multiple inputs in your wallet, you can use them separately. Or all at once. "Coin control" is the keyword you're looking for.



Does (for instance) Bitcoin "change" explained (https://99bitcoins.com/inputs-outputs-bitcoin-change-explained/) help?


Title: Re: why there is change address.
Post by: uchegod-21 on November 25, 2021, 07:52:48 PM
It's good for your privacy, here's a pretty good (and simple) explanation by Exodus: https://support.exodus.com/article/109-what-are-change-addresses#receive

Also, I don't see the problem? since even though the funds are being sent to another address, they would remain in the same software wallet, so it really doesn't affect the UX at all.

This link is helpful to me.


Title: Re: why there is change address.
Post by: uchegod-21 on November 25, 2021, 08:04:14 PM
It depends on what wallet you use because there are some wallets that doesn't have a change address or you can disable it manually like Electrum you can disable that function.

Change address was generated for privacy purposes and it is an address where the remainder is being sent to your other address after you send a specified amount to the receiver.

Actually, it's no different there is also a coin control feature where you can choose any UTXO to spend. It is likely you have other dollars in your wallet sample you have $20 and $5 in your pocket since the coffee price is $5 you can pay it with your $5.

I read where it is said that the change address is use to make the public not to know the amount of bitcoin someone has in his balance.
Quote from: Exodus
For Example: if a transaction for 1 BTC moves a 2 BTC UTXO from Address X to Address Y, and the 1 BTC of change is returned to Address X, it would be obvious that Address X paid Address Y. On the other hand, if the 1 BTC of change is returned to a change address, Address Z, it wouldn’t be clear if the original payment of 1 BTC was meant for Address Y or Address Z, since both received 1 BTC
Those wallet that has not change address how will they solve the problem of privacy mention by Exodus?


Title: Re: why there is change address.
Post by: TheArchaeologist on November 25, 2021, 08:15:15 PM
Those wallet that has not change address how will they solve the problem of privacy mention by Exodus?
They do not. If you choose to re-use an address for change you give that up. It's a matter of personal choice, even though it is not a very wise choice to do so. Although you should know giving up privacy in this case does not automatically mean it is clear which person/entity is connected to the address. But the other way around is true: as soon as it is clear address X belongs to person Z it means you can trace back every payment done and received to/by the re-used address of person Z because all bitcoin transactions are public.


Title: Re: why there is change address.
Post by: nc50lc on November 26, 2021, 03:28:50 AM
-snip- So you will not use the balance in your wallet until the transaction is confirm and your balance is send back to you through change address.
Actually, this isn't because of the change address but because 'Bitcoin Transaction' is "UTXO" based (more info (https://en.wikipedia.org/wiki/Unspent_transaction_output)).
Each unspent transaction output in the blockchain should be spent whole so if you need to spend one with the huge amount, you'll need to send the excess amount to another address in your wallet
which is usually sent to a 'change address' but can also be sent to a 'receiving address' depending on the wallet.
So even if you disable change address, the rest of the amount from the UTXO that you're spending should be sent to an address;
Otherwise, it will be added to the transaction fee.

Your wallet is making you wait for confirmation, it must be because it's set to wait for confirmation before spending a UTXO (the change of the unconfirmed transaction).
Some wallets have a setting to be able to spend unconfirmed unspent transaction outputs.


Title: Re: why there is change address.
Post by: Pmalek on November 26, 2021, 07:55:43 AM
I read that when you sent bitcoin to someone the output you are sending is the balance of the input you receive last.
Good non-custodial wallets such as Electrum allow you to select which inputs you want to spend from. It's a feature that was already mentioned in this thread and it's known as coin control. You control and decide which input to spend from. Therefore, you can select the first, the last, the smallest, or the biggest input in your wallet. 

Quote from:  Elyse Jupiter
Consider the example of taking a $20 bill out of your wallet to pay for a $5 cup of coffee. You would give the $20 to the cashier, and the cashier would give you back the $15. While the $15 belongs to you, it is not available for the time it takes the cashier to give you back your change
The comparison with individual bills is a good one. Each time someone sends you bitcoin to your personnel wallet (not an account on an exchange), that becomes a new bill that you have. The amounts don't matter, each transaction is a new separate unit. 

But if am using my ordinary fiat wallet and I use $20 to pay bill and I still have other dollars in my wallet I can use them to buy other things before my change will come. Why is  bitcoin spending different.
Again, it depends on how many UTXOs (bills) you have in your wallet. If you have multiple, you can spend one of those while you are waiting for your $20 UTXO to be confirmed on chain.


Title: Re: why there is change address.
Post by: uchegod-21 on November 26, 2021, 02:07:44 PM
Those wallet that has not change address how will they solve the problem of privacy mention by Exodus?
They do not. If you choose to re-use an address for change you give that up. It's a matter of personal choice, even though it is not a very wise choice to do so.
Ok. it is not good but people that don't want delay can like it too.
Quote
Good non-custodial wallets such as Electrum allow you to select which inputs you want to spend from. It's a feature that was already mentioned in this thread and it's known as coin control. You control and decide which input to spend from. Therefore, you can select the first, the last, the smallest, or the biggest input in your wallet.
Very very much good. This is what i mean. So their is a solution. Wehdone.

Quote
So even if you disable change address, the rest of the amount from the UTXO that you're spending should be sent to an address;
Otherwise, it will be added to the transaction fee.
This is bad, if I forget to send to an address all the amount from UTXO will be added to the transaction fee. Has this thing happen to somebody before?




Title: Re: why there is change address.
Post by: nc50lc on November 26, 2021, 03:07:32 PM
So even if you disable change address, the rest of the amount from the UTXO that you're spending should be sent to an address;
Otherwise, it will be added to the transaction fee.
This is bad, if I forget to send to an address all the amount from UTXO will be added to the transaction fee. Has this thing happen to somebody before?
No, a well-written client/wallet will send the remaining amount to your 'receiving address' or back to the same address if 'change address' is disabled/not available.
It will only happen if you will create the transaction by hand and forgot to specify a change address, eg. through Bitcoin Core's createrawtransaction command.
I haven't heard of a wallet that fails to do that and forgot to claim the remaining balance from the UTXO.


Title: Re: why there is change address.
Post by: The Cryptovator on November 26, 2021, 05:21:01 PM
This is bad, if I forget to send to an address all the amount from UTXO will be added to the transaction fee. Has this thing happen to somebody before?
This would happen if you are using a single address like a paper wallet. Yes, it has happened previously. You may read it here, WARNING: How I lost Bitcoins using a paper wallet  (https://steemit.com/bitcoin/@michaelmatthews/warning-how-i-lost-bitcoins-using-a-paper-wallet). The problem is paper wallet unable to indicate the change address. As a result, the change fund would transfer to a change address that isn't handled by you. It would move into the miner address who validates the transaction.

You may read Binance academy explanation about change address and paper wallet (https://academy.binance.com/en/glossary/paper-wallet), so you may realize what is the danger of using paper wallet because of change address.


Title: Re: why there is change address.
Post by: khaled0111 on November 26, 2021, 07:26:54 PM
This would happen if you are using a single address like a paper wallet. Yes, it has happened previously. You may read it here, WARNING: How I lost Bitcoins using a paper wallet  (https://steemit.com/bitcoin/@michaelmatthews/warning-how-i-lost-bitcoins-using-a-paper-wallet). The problem is paper wallet unable to indicate the change address. As a result, the change fund would transfer to a change address that isn't handled by you. It would move into the miner address who validates the transaction.
This won't happen if you import the private key from  paper wallet into one of the known biwallet apps and use it to create the transaction. Even if your wallet consists of a single address, the app will send the change amount (if any) back to it.
The problem isn't due to having a single address but due to creating the raw transaction manually and forgetting to specify a change address (or using a poorly coded app).


Title: Re: why there is change address.
Post by: uchegod-21 on November 26, 2021, 08:57:12 PM
So even if you disable change address, the rest of the amount from the UTXO that you're spending should be sent to an address;
Otherwise, it will be added to the transaction fee.
This is bad, if I forget to send to an address all the amount from UTXO will be added to the transaction fee. Has this thing happen to somebody before?
No, a well-written client/wallet will send the remaining amount to your 'receiving address' or back to the same address if 'change address' is disabled/not available.
It will only happen if you will create the transaction by hand and forgot to specify a change address, eg. through Bitcoin Core's createrawtransaction command.
I haven't heard of a wallet that fails to do that and forgot to claim the remaining balance from the UTXO.
Ok. Thank you there is so many thing to know.

You may read Binance academy explanation about change address and paper wallet (https://academy.binance.com/en/glossary/paper-wallet), so you may realize what is the danger of using paper wallet because of change address.
I click the link and it confirm that Alice can lost her bitcoin to miner if she use paper wallet to send to Bob if she did not create a change address.


Title: Re: why there is change address.
Post by: The Cryptovator on November 27, 2021, 02:58:49 AM
This would happen if you are using a single address like a paper wallet. Yes, it has happened previously. You may read it here, WARNING: How I lost Bitcoins using a paper wallet  (https://steemit.com/bitcoin/@michaelmatthews/warning-how-i-lost-bitcoins-using-a-paper-wallet). The problem is paper wallet unable to indicate the change address. As a result, the change fund would transfer to a change address that isn't handled by you. It would move into the miner address who validates the transaction.
This won't happen if you import the private key from  paper wallet into one of the known biwallet apps and use it to create the transaction. Even if your wallet consists of a single address, the app will send the change amount (if any) back to it.
The problem isn't due to having a single address but due to creating the raw transaction manually and forgetting to specify a change address (or using a poorly coded app).
Yea, you are right. But if you read the article above there is a solution as well and were suggested to use a wallet during making a transaction. So that you shouldn't lose the funds due to a change address. I just point out potential risks due to a changed address when using a paper wallet or something like that was using only a single address. It's important to know about the risk, so you can find a possible solution.

I click the link and it confirm that Alice can lost her bitcoin to miner if she use paper wallet to send to Bob if she did not create a change address.
Fine, a good practice always could help you to prevent potential loss. Always use a wallet that is non-custodial and well-reputed. So you don't need to worry about changing your address.


Title: Re: why there is change address.
Post by: larry_vw_1955 on November 27, 2021, 05:03:55 AM
Quote
This is bad, if I forget to send to an address all the amount from UTXO will be added to the transaction fee. Has this thing happen to somebody before?


Uh, yeah it's happened to someone before. most people it doesn't happen to though. that does bring up a good point though. maybe there needs to be something in bitcoin core that prevents it from happening. just reject the transaction if the transaction fee is **too much** greater than the "average transaction fee".


Title: Re: why there is change address.
Post by: nc50lc on November 27, 2021, 08:26:51 AM
Quote
-snip-
Uh, yeah it's happened to someone before. most people it doesn't happen to though. that does bring up a good point though. maybe there needs to be something in bitcoin core that prevents it from happening. just reject the transaction if the transaction fee is **too much** greater than the "average transaction fee".
The good thing is, there actually is a setting for that (start parameter or bitcoin.conf entry):
maxtxfee = sets the maximum transaction fee in BTC that your node can broadcast/relay,
The default is 0.1BTC, still too high but at least it can prevent >1BTC disasters.

Bitcoin-qt - 'Help->Command-line options', under "Debugging/Testing options:":
Quote
-maxtxfee=<amt>
Maximum total fees (in BTC) to use in a single wallet transaction; setting this too low may abort large transactions (default: 0.10)


Title: Re: why there is change address.
Post by: larry_vw_1955 on November 28, 2021, 03:09:46 AM

The good thing is, there actually is a setting for that (start parameter or bitcoin.conf entry):
maxtxfee = sets the maximum transaction fee in BTC that your node can broadcast/relay,
The default is 0.1BTC, still too high but at least it can prevent >1BTC disasters.


Yeah as if 0.1 btc isn't a large enough disaster. 0.1 btc is around $5000 so that's kind of alot to pay for a txn fee but I guess some people do that?? :o Whoever those devs are that set the default to 0.1btc must know some pretty big whales.

maybe that default setting is a carryover from something satoshi setup and they just never updated it :D




Title: Re: why there is change address.
Post by: o_e_l_e_o on November 28, 2021, 09:05:09 AM
Yeah as if 0.1 btc isn't a large enough disaster. 0.1 btc is around $5000 so that's kind of alot to pay for a txn fee but I guess some people do that?? :o Whoever those devs are that set the default to 0.1btc must know some pretty big whales.

maybe that default setting is a carryover from something satoshi setup and they just never updated it :D
It was first discussed back in 2015, when 0.1 BTC was worth around $20-30: https://github.com/bitcoin/bitcoin/pull/7084

It was originally defined as a rate of 10,000 times higher than the minimum relay transaction fee, which is 1000 sats per kB or 1 sat/byte, which worked out to 0.1 BTC per kB or 10,000 sats per byte. It was then switched to flat rate of 0.1 BTC. This is not an unreasonable amount given that there are plenty of consolidation transactions with 500+ inputs them. The limit is mostly there to stop someone emptying out their entire wallet of dozens of BTC by mistake, not to stop users overspending on fees.


Title: Re: why there is change address.
Post by: o_e_l_e_o on November 28, 2021, 09:39:24 AM
I find it's weird they changed dynamic rule to static rate since static rate cover fewer user error.
Because it's not really designed to cover user error, but rather, software error. There is more discussion about it here (https://github.com/bitcoin/bitcoin/pull/16539), particularly this comment by Greg Maxwell here (https://github.com/bitcoin/bitcoin/pull/16539#issuecomment-578432863).

In short, if I wanted to make a high priority transaction and pay, say, 200 sats/vbyte, and my wallet then tried to include 500 additional inputs because of some bug, then a flat rate limit would prevent that from happening, while a feerate limit would not.