New Bitcoin is created by a competitive and decentralized process called “mining”. This process involves that individuals are rewarded by the network for their services. Bitcoin miners are processing transactions and securing the network using specialized hardware and are collecting new bitcoins in exchange.
To add a block of transactions to the chain, each person maintaining a ledger has to solve a special kind of math problem created by a cryptographic hash function. A hash function is an algorithm that takes an input of any size and turns it into an output with a fixed size. For example, let’s say you had this string of numbers (1, 2, 3, 4) as your input and our example hash function says to add all of the numbers together. So, in this case, the output would be 10. What makes hash function really good for cryptography is that when you’re given an input, it’s really easy to find the output. But it’s really hard to take an output and figure out the original input. Even in this super simple example, there are lots of strings of numbers that add up to 10
1+2+3+4 5+5 3+3+3+1 6+2+2 7+2+1 etc. The only way to figure out that the input was 1+2+3+4 is to just guess until you get it right. Now the hash function that Bitcoin uses is called SHA256, which stands for Secure Hash Algorithm 256 bit. And it was originally developed by the united states National Security Agency. Computers that were specifically designed to solve SHA256 Hash problems take, on average. About ten minutes to guess the solution to each one. That means they’re churning through billions and billions of guesses before they get it right. Whoever solves the hash first gets to add the next block of transactions to the blockchain, which then generates a new math problem that needs to be solved. If multiple people make blocks at roughly the same time, then the network picks one to keep building upon, which becomes the longest and most trusted chain. And any transactions in those alternate branches of the chain get put back into a pool to be added to later blocks. These volunteers spend thousands of dollars on special computers built to solve SHA256 problems and run their electricity bills up sky high to keep those machines running. But Why? What do they get out of maintaining the blockchain? Is it just community service? Well, Bitcoin actually has a built in system to reward them. Today, every time you win the race to add a block to the blockchain,12 and a half new bitcoins are created out of thin air and awarded to your account. In fact, you might know the Bitcoin ledger keepers by another name: miners. This whole process called Bitcoin Mining