I hear a lot about double spending of bitcoin. Can a single bitcoin be spend twice, as a dollar can. For example, I give dollars to 7 eleven for gas, they then use that money to pay their suppliers. Can bitcoin be used in the same way?
I think the confusion is around the phrase "a single bitcoin". A dollar bill is a thing, you can move it around and it changes ownership, but it is still the same dollar bill.
You might be imagining a bitcoin as a "virtual thing", like a computer file, which you can also move around. Sending the file to someone is analogous to giving them the dollar bill.
The problem is, computer files don't move; they are copied. Even when you tell a computer to move a file from one disk to another, it is simply making a copy and then deleting the original. When you give someone a dollar bill, you don't have it any more. You can't really give someone a computer file, because you simply both have copies.
If a digital currency were implemented this way, you could simply keep giving copies of the same computer file to everyone you paid, and you would basically have an infinite supply of money. That is what people are talking about when they refer to double-spending. The idea of using the same money twice.
So, bitcoin can't be a simple as a computer file. How does spending work?
Imagine a world where there are no dollar bills and coins. Instead, all transactions are performed by credit and debit cards and similar things. In that case, when you spend $1 at a 7-Eleven, you theoretically give them a dollar, except there is no physical thing to move. In reality, your bank and 7-Eleven's bank simply agree to add a transaction to each of their ledgers, saying you transferred $1 from your account to theirs.
In other words, what's actually being passed around isn't "virtual money", but records of transactions instead.
Spending a bitcoin is very much like this: you create a transaction that says you are transferring X BTC from your account to someone else's. That is published to the network and becomes part of the transaction record and then "everyone" knows your wallet has X fewer BTC and the other person as X more BTC.
There is a lot of complexity in how that publishing process works, how it guards against fraudulent transactions, how it works in a decentralized fashion, etc. There are a lot of places to read about how it all works, including this site.
So, if you have 10 BTC and receive 1 BTC, then you turn around and spend 1 BTC, did you spend the BTC you just received? Or one of the other ten? That's a question for philosophers, to be honest.
Actually, double spending is a class of attacks against bitcoin.
Double-spending is a failure mode of digital cash schemes, when it is possible to spend a single digital token twice. Since, unlike physical token money such as coins, electronic files can be duplicated, and hence the act of spending a digital coin does not remove its data from the ownership of the original holder, some other means is needed to prevent double-spending.
Bitcoin's mechanism is the block-chain.
Double-spending as an attack is different than spending coins you receive.
The attack is when you try to spend the same coins twice. For example, you have 1 BTC in your wallet, spend it to buy a coffee, then spend it to buy a soda. Assuming both the coffee and soda cost 1 BTC, you shouldn't have enough coins to pay for both. But the (very complicated) attack would allow you to do just that.
Contrast this to me paying you 1 BTC for a slice of pizza. You can then turn around and spend that 1 BTC on a coffee, just like if I had given you a dollar, euro, or anything else.
Bitcoins are never really "sent" anywhere. That is the simplest method for the Bitcoin client to emulate the way we use cash today. When I pay you, I give you cash and after that I no longer have it and you now have it.
With bitcoin, spend transactions are broadcast to peer nodes, and from there each node relays the transactions to other peer nodes. Within seconds the transaction is known by nodes around the world.
Each node is like a ledger that holds a history of transactions. So each node can know if the funds have already been spent.
And that's all that a valid transaction consists of -- an assignment of previously unspent funds.
The Bitcoin-Qt/bitcoind client and E-wallet services just make it seem familar by making it look like bitcoins are magically transferring from one person to another.
But in reality, each transaction is simply an entry in a ledger, replicated tens of thousands of times on nodes located around the world.