I'm trying to understand a transaction's lifetime and haven't yet found a technical, linear "timeline" of events that occur when a P2P transaction occurs.
This is my understanding so far; please correct it as needed:
A person uses their RSA private key to sign a message saying "deduct X amount from my account and send it to YYY address(s)". In this message they also reference the current Block number.
The client application (wallet) sends this transaction to 6 nodes for "confirmation". (is the destination a miner or a wallet?)
?? What does confirmation actually do??
The mining nodes add those transactions to single message called a block (and save them in almost any order)
The mining nodes compete to find a SHA256(SHA256(x)) hash of the the block that starts with a predetermined number of zeros.
The first mining node (or node pool) to generate the winning hash collects a prize and increments the block count. (note this currently appears to take 30 minutes, and the block size is limited to 1MB)
The miners notify a wallet who then replicates the new block to anyone who requests it, and pushes the updates to a certain number of peers. Any block with a date difference greater than 120 minutes of system time is discarded.
Any in-flight transactions that reference the solved block have to be resubmitted by the original client and refer to the current block.
Conflicting transactions (double spends) are detected in the Bitcoin client and discarded.
The wallet will keep track of any forked chains and the chain with the most computational power backing it wins. This fork may occur due to netsplits or malicious activity). In addition no single wallet or central authority currently knows of all the invalid transactions, or forks that have occurred in the network.
Once 100 (or 120) confirms have been sent, the BTC generated with the block may be spent. source