OK, so last time I gave my impressions of how a coin transaction might be enacted in blockchain.
But now we get to the magic. How can Bob and Alice be confident that someone won’t abuse their transfer of coin?
Let’s consider the case where Bob himself wants to spend Alice’s bitcoin twice.
He might have a couple of strategies for doing so, but they all involve, in one way or another, fudging the first transaction. For example:
Erase the first transaction. Bob has everything he needs to create a “spend” of Alice’s coin: her signed transaction giving the coin to his public key, and his private key. If he can get erase transaction 1 (after his payee from tx 1 has re-transacted the bitcoin, of course) it would seem he could cover his tracks.
Blockchain makes it very hard to erase a transaction (or change it in any way) because all the transactions are hashed and linked. Hashed means that there is a unique code generated by the transaction that can’t be duplicated. And linked means that all the transactions ever are all linked together — and hashed — so that the only way you could fake a change to an old transaction would be to re-do all the transactions since.
And, hard as that might be, blockchain makes it harder by requiring a certain level of effort in the hashing. Not just any hash result will do: the hash has to be smaller than a certain fraction of the maximum hash value. Since each time you hash you get a different answer you have to keep hashing until you get an answer below the threshold. Which means you have to do a lot of computational work.
But who even checks on this stuff? In a centralized world where there’s a trusted central database, they do the checking. In a decentralized world, who’s to even notice that a bunch of transactions have been faked or re-done?
The miners, that’s who. What coin miners do is build valid blocks for the blockchain out of raw transactions. Since there’s a large number of miners mining, the chances of all of them collaborating on a fraud are low (although I guess it could happen??) And because they’re doing all this work to prop up the blockchain, they are rewarded by getting a small fee for most or all transactions that they block-ify, which is how miners end up with new coin.
I think I’ve got it, and I think I’ve explained it somewhat clearly, which probably means I’ve missed something profound and simple. Can people who know more about this tell me where I messed up?