Bitcoin introduces newcomers to a lot of new concepts, but one concept in particular seems to be the hardest to grasp - you do not have any bitcoins in your “wallet”. When you buy bitcoins, nothing is sent to you, no special file or code.
That’s because - and here’s the concept to wrap your head around - there’s no such thing as a bitcoin. At least, not as some kind of individual object you can inspect in any way. Bitcoins only exist as transactions, which means that they only exist in the block chain, the record of transactions that every Bitcoin client has.
Let’s say Alice wants to buy a product from Carl that costs 100 bitcoins. Alice got bitcoins from earlier transactions. She generates a new transaction that references those earlier transactions (called the transaction inputs), which total 100 bitcoins, and sends them to Carl’s Bitcoin address (this is called the transaction output). Carl has been mining bitcoins and successfully generated an additional 50 bitcoins, so he has a total of 150 bitcoins to spend.
Now Carl purchases a product from Dave and sends him 101 bitcoins, referencing the output of the transaction from Alice, and the bitcoins he generated. Because those two transactions total 150 bitcoins, he has to send the remaining 49 bitcoins back to himself as “change”, which he can spend later. Carl’s Bitcoin client automatically sends the change to a new Bitcoin address Carl controls.
Now Dave wants to send those 101 bitcoins to Ed, so he generates a new transaction that references the output of the transaction from Carl, and the new transaction is recorded on the network.
Dave is now unable to send the bitcoins again, because the output of the transaction from Carl has already been used up and recorded on the block chain. Until Ed uses the bitcoins in a future transaction, the transaction that Dave made just sits unclaimed on the Bitcoin network.