How does mining work?

Mining is the process of verifying and adding transaction records to a public ledger (blockchain). Each time a new block is added to the blockchain, miners compete to be the first to solve a complex cryptographic puzzle involving the collection of transaction data within the block. The miner that verifies the transactions and solves the puzzle adds the new block to the blockchain, receives a reward for their work (usually in the form of cryptocurrency coins), and earns a newly-generated block reward.