From another thread:
Electronic cash accounting systems, such as those used by a bank, emulate that. Before you withdraw cash at an ATM, your bank's accounting system will check to see the balance held in your account. At the moment your withdrawal is processed, your account it debited. That happens instantly rather than overnight or the next day because the the bank doesn't want to risk that you would visit another ATM and be able to withdraw more funds than you had in your account. With that being instant, it prevents you from double spending funds from your bank balance. In that way, the banks electronic cash systems emulate physical cash.
If there is a dispute, such as if the ATM thinks it spit out cash, but a malfunction resulted in no cash actually coming out, then the bank investigates and when warranted makes a correcting entry to the customer account. The bank is the authority there. The bank asserts "the truth" as far as its customer's account balances.
Bitcoin's architecture is such that there is no bank or anyone else with the authority to adjust balances. There is no central authority. The truth is determined from the consensus of computing work performed by miners who follow a specific protocol. That computing work builds the Bitcoin blockchain.
When you first make a Bitcoin transaction and that transaction is broadcast to the network, "the truth" has not yet been established. With Bitcoin's decentralized architecture, this consensus needs to form after your transaction gets included in a block and a chain of additional blocks extend from that. At any point in time there could be two or more solved blocks at the same level in the blockchain competing to win this consensus. At the time, there is no way to know which block will eventually attain consensus as being "the truth" and which blocks will lose support and become orphaned.
Only after the chain of blocks is extended with enough additional blocks on top is it then known which of the potentially competing blocks attained consensus and became "the truth". The mathematics of the protocol show it to be safe to accept as "the truth" a block from the longest chain that occurred five or more blocks prior. A block extended with five further blocks will show a total of six confirmations.
A Bitcoin exchange, just like your bank, cannot be exposed to the risk of double spending. It will credit your account for the transfer of your funds only after it knows for sure "the truth", and thus it must ignore any blocks until they are part of the longest chain and have six or more confirmations.
Here is an interactive diagram that goes through the technical details of a Bitcoin transaction:
- http://staging.spectrum.ieee.org/static/how-a-bitcoin-transaction-works
And here's the static image from that:
- http://spectrum.ieee.org/img/06Bitcoin-1338412974774.jpg