Episode 21 - Proof of Work
Blockchains are updated by adding new blocks at the end of the chain. In a permission-less and decentralized network, it is hard to find out who (which node) gets to add the next block. This is like selecting something from a collection of things.
One way of selecting one thing from a group of things is to get them to race against each other. Whoever wins gets selected. This is also how proof of work is used for selecting a miner node from the network of multiple nodes to produce the next block.
Proof of work is basically about producing some data that can be verified easily, but it is hard to produce. In the Bitcoin blockchain, this data is a hash with a predefined number of zeroes as its prefix. As hashing is a completely random process, the only way to produce such a prefixed hash is by trial and error.
All the miner nodes race against each other to find our such a prefixed hash by repeatedly hashing the block data (with different nonce each time). Whoever wins the race and produces a block hash that satisfies the conditions, gets to add the next block and take the rewards.
Because all the nodes constantly hash so much data, they use a lot of computing power too. All this compute power needs a lot of electricity as well. This is why the Bitcoin blockchain consumes so much energy.