Bitcoins contain their owner's public key. When user A transfers coins to user B, he renounces his ownership by adding B's public key (his address) to the coins in question and signing them with his own private key. He then transmits these coins in one message, the transaction, across the peer-to-peer network.
The rest of the nodes validate the cryptographic signatures and the amount of ciphers involved before accepting it. Considering that miners can autonomously decide which transactions to insert in a block, those who want to send bitcoins will have to pay a transfer fee, of variable value, to encourage the choice of their own transaction.
When a transaction is first admitted in a block, it receives a confirmation. Whenever other child blocks connected to it are created above that block, it receives another confirmation. When the block containing the transaction reaches six confirmations, six blocks are created attached to it, the Bitcoin client changes the state of the transaction from unconfirmed to confirmed.
The rationale behind this procedure is that with each confirmation of the transaction, with each new block that is created above the block with the transaction itself, it becomes increasingly difficult and expensive to cancel the transaction.
A hypothetical attacker, to cancel a transaction with a certain number of confirmations, would have to generate a parallel chain without the transaction he wishes to cancel and composed of a number of blocks equal to or greater than the confirmations received from the transaction.
Digital transactions in bitcoin: what you need to know!
Every time a transaction is made, it starts in the unconfirmed state. It will become confirmed only when verified through a collectively managed timestamp list of all known transactions, the blockchain.
Each generator node collects all unconfirmed transactions it knows into a candidate block, a file that, among other things, contains a cryptographic hash of the previous good block known to that node. It then tries to reproduce a hash of that block with certain characteristics, an effort that on average requires a definable amount of tests to be performed.
When a node finds such a solution, it announces it to the rest of the network, the peers receiving the block check its validity before accepting it and then adding it to the chain.