Some background on bitcoin mining
Mining is essential to the functioning of the bitcoin network. Bitcoin mining draws many parallels with mining in real life by design. There are a limited number of bitcoins that can be mined, so supply decreases over time, and it gradually becomes more difficult to "extract" bitcoins. About every 10 minutes the bitcoin network discovers another block, which contains 12.5 bitcoins at the moment. This reward is halved every 4 years and started at 50 bitcoins per block.
Blocks contain all the transactions that occurred during the same time period. Nodes then send out these blocks to miners, who then confirm the transactions in those blocks. Miners must verify the transactions before they can be added to the general ledger, known as the blockchain. This service of verifying transactions is what the bitcoin network pays miners to do in a nutshell. Transactions normally include a small fee, and those transaction fees are then included in the reward that's given to the miners.
Miners verify transactions by changing the block into a hash. The network uses SHA-256 (Secure Hash Algorithm) that was originally developed by the NSA. This is the hashing algorithm that bitcoin miners use to complete proof-of-work to verify transactions and add them to the blockchain. Hashes are interesting because they're one way functions. This means it's nearly impossible to work out the original contents of a hash by working backwards, but it's fairly easy to create them. Changing a block even slightly would change the entire hash, which makes picking out fake blocks easy.
For more information, please check out these links: