Pardon for off-topic, but the arguments he makes about double-spending (the third "rule" from that linked forum post) made me realize I have some gaps in my understanding how Bitcoin handles overlapping transactions.
Suppose I have an address with 0BTC balance. (i.e. I have the private key of it on my PC. There isn't yet anything about that address in the blockchain.)
Some other person sends 100mBTC to that address. I can see that the transaction has spread through the network but it hasn't been added to a block yet.
Because I'm overly trusting and/or in a hurry, I don't wait until it's confirmed but I immediately send another transaction that sends the 100mBTC to some other account.
If a miner first picked transaction #1, added it to a block, then added transaction #2 to the following block, both transactions would be valid. However if a miner tried to process transaction #2 first, it would be invalid.
So what would happen? Would miners bring the transactions into correct order and validate both, only validate #1 and reject #2 or reject both?
Bitcoin transactions aren't as simple as "send X BTC from address A to address B". What's actually happening is that each transaction contains a number of inputs and a number of outputs, all of which have unique hashes (used to uniquely identify them in the system). Each input must either be a previous output, or the special case of no input in the generation transaction that each block miner gets to create (this assigns the bitcoin generated in each block and any fees accumulated from the other transactions).
So, if I send you 2 BTC to a single address, the transaction will probably have a single output. If you then try to send somebody 1 BTC your transaction has to use the entire 2 BTC input (which was the output from my transaction to you), but will have two outputs, 1 BTC with an output for whoever you're sending it to and another 1 BTC to an address your wallet controls.
So your transaction in the above example has to refer to the 2 BTC from my transaction by unique hash, it's not simply saying "send any 1 BTC from this address". This is all dealt with by your wallet.
Due to this, if transaction #2 was being processed first it would be using an input that didn't exist on the blockchain and would therefore be invalid.
I could be wrong but I thought miners were always in sync, miners are effectively writers to the ledger and single threaded. They all mine the same transactions in the same order. The first to find the hash with correct difficulty gets the block, which triggers the other miners to stop and verify. Once verified the new block becomes the seed for the next block. So the first transaction will always be processed before the second transaction. The second transaction would be committed as long as you had enough balance remaining after the first transaction.
Not true. Each miner may choose by whatever logic which transactions to include in the block they are mining. They are however are likely to prefer those which pay higher fee.
Suppose I have an address with 0BTC balance. (i.e. I have the private key of it on my PC. There isn't yet anything about that address in the blockchain.)
Some other person sends 100mBTC to that address. I can see that the transaction has spread through the network but it hasn't been added to a block yet.
Because I'm overly trusting and/or in a hurry, I don't wait until it's confirmed but I immediately send another transaction that sends the 100mBTC to some other account.
If a miner first picked transaction #1, added it to a block, then added transaction #2 to the following block, both transactions would be valid. However if a miner tried to process transaction #2 first, it would be invalid.
So what would happen? Would miners bring the transactions into correct order and validate both, only validate #1 and reject #2 or reject both?