Bitcoin Forum

Bitcoin => Bitcoin Discussion => Topic started by: Bert on August 18, 2011, 01:18:27 PM



Title: How does a transfer work ?
Post by: Bert on August 18, 2011, 01:18:27 PM
Ok, I know I could read through the source code and bang my head against the wall for a bit. But I though that I would ask here, because someone already knows the answer to this simple question.

Let's say that my bitcoin client has 100 bitcoins addresses and each of them received 0.5 BTC (50BTC in total, ignoring transfer fees)

Now If I send 25 BTC from my bitcoin client to someone else's address, do they receive 25 BTC or 50 x 0.5 BTC I know that their client will show 25BTC but under the hood how does it work.
Are my 50 x 0.5 BTC marked as negative on the double entry ledger and replaced with 1 x 25 BTC
Or is it something else ?

Thanks for reading the post, probably a dumb question, but it is puzzling me.


Title: Re: How does a transfer work ?
Post by: Jack of Diamonds on August 18, 2011, 01:37:17 PM
Sending fresh funds worth 25 BTC that you recieved by 50 different 0.5btc transactions will be slower than sending 25 BTC you recieved as a lump sum 30 days ago, unless you use a fee.

Quote
I know that their client will show 25BTC but under the hood how does it work.

The network (i.e. miners) verify you have a right to spend the coins (legitimate sources) & that they have not been spent before.
Then it transfers them as a whole 25 BTC to an address you specify (owned by a wallet).


Title: Re: How does a transfer work ?
Post by: BookLover on August 18, 2011, 01:50:22 PM
I'm fairly sure this is incorrect, your addresses are not linked together in an "account" in the eyes of the network.  It is true the addresses don't actually contain the coins but that's getting more technical than necessary.

I'm not positive, but I believe you would send the coins as a 25 coin clump made up from the coins in 50 of the addresses.

Hope this answers your question,
BookLover


Title: Re: How does a transfer work ?
Post by: Gavin Andresen on August 18, 2011, 02:09:22 PM
Transactions have multiple inputs and outputs.

If you have 0.5BTC inputs, then 50 of them will be bundled together and a transaction with 50 inputs and one output will be created.

... but that's not what will actually happen. A 50-input-transaction will be over the "small enough to be free" transaction size limit, so 51 will be bundled together and a transaction with 51 inputs and two outputs (one to the destination, one back to you for any change leftover after paying the transaction fee) will be created.

There is no ledger, there are just transactions with inputs and outputs.  Your bitcoin balance is the sum of all the outputs to addresses that you own that haven't yet been used as input to another transaction.


Title: Re: How does a transfer work ?
Post by: Bert on August 18, 2011, 02:14:21 PM
Thank you. Question fully answered. Was not expecting an answer from you Gavin or Jack of Diamonds. And thanks BookLover.

This one line helps me to understand how Bitcoins work.
Quote
There is no ledger, there are just transactions with inputs and outputs.  Your bitcoin balance is the sum of all the outputs to addresses that you own that haven't yet been used as input to another transaction.


Title: Re: How does a transfer work ?
Post by: julz on August 18, 2011, 02:43:00 PM
There is no ledger, there are just transactions with inputs and outputs.  Your bitcoin balance is the sum of all the outputs to addresses that you own that haven't yet been used as input to another transaction.

I think a comma is helpful to disambiguate that last sentence. (though It's still potentially confusing)
"Your bitcoin balance is the sum of all the outputs to addresses that you own, that haven't yet been used as input to another transaction."


I wouldn't know how to phrase it any better.. but for someone trying to get to grips with the concepts it could read as either:

Your bitcoin balance is the sum of all the outputs to:  "addresses that you own that haven't yet been used as input to another transaction"   (wrong interp)
vs
Your bitcoin balance is the sum of all the outputs (to addresses that you own) that haven't yet been used as input to another transaction  (correct interp)



Title: Re: How does a transfer work ?
Post by: jackjack on August 18, 2011, 02:54:22 PM
Then it transfers them as a whole 25 BTC to an address you specify (owned by a wallet).
Maybe I don't understand what you meant but why talking about one wallet?
The address can be in 100000, 1 or even 0 wallet


Title: Re: How does a transfer work ?
Post by: koin on August 18, 2011, 08:35:47 PM
fastest and easiest way to understand it?  use the client to receive and then send a transaction (different amounts) and see the results in the blockchain: http://www.blockexplorer.com


Title: Re: How does a transfer work ?
Post by: Jack of Diamonds on August 18, 2011, 10:29:55 PM
Then it transfers them as a whole 25 BTC to an address you specify (owned by a wallet).
Maybe I don't understand what you meant but why talking about one wallet?
The address can be in 100000, 1 or even 0 wallet

Gavin has written a simple explanation.

Quote from: Gavin Andresen
There is no ledger, there are just transactions with inputs and outputs.  
Your bitcoin balance is the sum of all the outputs to addresses that you own

A wallet is just a collection of your addresses.
The addresses themself do not 'contain' anything, you only have a balance which is the total of all inputs you have received into addresses you own
(which someone else has output from their balance)