Miners are responsible for validating transactions, creating blocks and adding them to the blockchain. To create valid blocks, miners must operate machinery that can produce a valid Proof-of-Work. These machines search a number space to discover a solution to a mathematical problem that meets a given difficulty level. The guesswork nature of the problem requires a certain amount of cost and energy to be expended in finding the solution.
The main costs associated with the mining process arise from investment in machines and consumption of electricity. The expenditure of electrical energy provides evidence that a certain amount of time has passed, adding objective proof to the time-ordering of the blockchain. To compensate miners for creating a valid block and adding it to the blockchain, the protocol allows them to reward themselves with freshly minted bitcoin and claim all the transaction fees offered by senders in that block.
Over time, as bitcoin has increased in value, mining has evolved from a geeky hobby into a fiercely competitive global industry in which miners compete to generate valid Proofs-of-Work most efficiently. In general, the most profitable miners are those with the most efficient machines and consuming the cheapest energy. Miners are therefore heavily incentivised to seek out the world’s cheapest sources of electricity. The real-world costs of mining, coupled with the bitcoin-denominated rewards, incentivises miners to act honestly within the network. As the purchase of mining hardware may be seen as a prepayment on future earned bitcoin, any malicious behaviour that would likely harm its exchange value would reduce the value of their hardware investments.