So let’s head back to our example where you are attempting a double spend on the Bitcoin network. You have broadcast two valid transactions for 1 BTC each, one to Alice and one to Bob in an attempt to spend the same bitcoin twice.
Which transaction “wins” and becomes valid depends upon which miner wins the mining race! If miner Ayat received the transaction to Alice first, her mining software will then reject the transaction to Bob as an invalid double spend. She will create a block that includes the transaction to Alice, not Bob. If the miner Han receives the transaction to Bob first, his software will reject the transaction to Alice as an invalid double spend. He will create a block that includes the transaction to Bob, not Alice. Though both valid, one of these will lose as an “orphaned block.”
If Ayat, or any miner who received Alice’s transaction first, wins this round of the mining race, then Alice receives the transaction. If Han, or any miner who received Bob’s transaction first, wins this round of the mining race, then Bob receives the transaction.
Let’s assume that Han “wins” this round of the mining race by being the first to find a hash for his block of transaction data that meets with the current network standards. His block of data contains the transaction sending the funds to Bob. He quickly transmits his winning block to the rest of the network. The funds in question are transferred to Bob and the duplicate transaction going to Alice is rejected as an invalid.
While it was quite difficult for Han’s computer to find the winning hash, it is trivial for other computers on the network to verify that he has indeed won. Once other nodes have verified that Han did indeed win, they will accept Han’s block, approving of the coinbase transaction that rewards him for his work, and then carry on trying to find a valid hash for the next block.
This is how Blockchain gets it’s name. Each new block of data is cryptographically linked to the last block by including the hash of the previous block in the new block. In this way, blocks are linked together in a sort of cryptographic chain, hence the name blockchain.
The above is the way in which the Bitcoin network agrees upon data and achieves “consensus.” While this whole process is managed by the Bitcoin software, it would be incorrect to think of this system as only computer science. Open, public blockchains like Bitcoin, are entire economic systems that rely heavily on monetary theory, economics, incentive structures, and game theory to function and thrive.
What are the Implications? While outside the scope of this course, it is very interesting to consider the implications of this technology. What might be the impact of money that exists outside the nation-state? What might be the impact of a technology that changes who and how we trust?
Now that was a lot of information to absorb! While that information settles in your head, let’s cover some cryptography basics.