0

I understand that an internal keychain is used to receive a change of payment when I pay someone.

For example, I pay $20, but it costs $17, so I get $3.

But what I don't understand is how can there be a change? When I send 1 BTC to someone, how does the receiving end determine that I overpaid by 0.9 BTC and send that back to me?

1

Bitcoin does not have the concept of account balance. It works on consuming the bitcoins that you have earnt in prior transactions. However, you cannot consume partial amounts. So according to your example, when you are creating a new transaction, in the inputs you will reference the transaction where you earnt the 1 BTC (it may be a single transaction where you got your 1 BTC, or you might reference multiple transactions whose values all add up to 1 BTC) and consume it entirely. Now in the outputs, you will send 0.1 BTC to address A and say 0.895 BTC to your change address. The difference of 0.005 BTC will go as mining fees.

  • so every time I'm sending a bitcoin, I'm sending my entire balance and receiving balance - payment - mining fee back to my change address? What if I don't have a whole bitcoin? What if I only have 0.001 BTC? – Carol Ward Apr 17 at 19:39
  • @CarolWard you have to reference multiple transactions in the inputs where you earned your BTCs and the values from those transaction should that add up to an amount that is more that want to intend to pay to a person. the difference (after removing mining fees) is what would go to your change address. – Ugam Kamat Apr 17 at 19:48
  • ok. I think I'm starting to understand. So when I send 0.001 BTC, the wallet references enough transactions together that equals 0.001 BTC or greater. If it's exactly 0.001 BTC, then no change needed. If it's 0.0017 BTC, then it pays 0.001 BTC to the recipient, pays mining fee (let's say 0.0003 BTC), and send the change of 0.0004 back to my change address. Is that right? – Carol Ward Apr 17 at 20:05
  • @CarolWard that is correct – chytrik Apr 17 at 20:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.