Bitcoin’s proof of work consensus mechanism secures the network while generating new blocks and coins as rewards. Here’s how it works.