What is the hash function?
Where fiat currencies are issued by central banks, new Bitcoins are “issued” to miners via a block reward for solving a block. They do this by using special hardware to solve a complex computational problem, which produces a seemingly-random 64 character output.
This output is known as a ‘hash’. A hash function is a mathematical process in which data of any size is ingested and put through a series of operations in order to turn it into a ‘hash’. That data is a fixed size is critical when dealing with large volumes of transactions and data. Instead of having to remember all that data, the hash function condenses it into a fixed length to keep track of it more easily.
In Bitcoin, miners use the SHA-256 Cryptographic Hash Algorithm. The data that a miner inputs into the SHA-256 hash function include all the current transactions which fit into the block’s size limit, the previous block’s hash result, and the nonce. The nonce is a random value the miner changes with each hash attempt to get a new output. Even a tiny change in input produces a completely different output.
Bitcoin miners are looking for an output with a certain number of zeroes. Today, Bitcoin miners have to find a hash which starts with nineteen zeroes. To get this number requires many, many attempts. Once the hash is found, the block is closed and it is added to the blockchain. After successfully mining a block, miners are rewarded with newly-created Bitcoins and transaction fees.