What Is a Hash?

Last updated on 11/29/2018

In the context of information security, a hash is the result of a mathematical process to turn input data of any size into output data of a fixed size. This is critical for the Bitcoin network, which leverages hashing to generate verifiably random numbers during the mining process.

How Is Hashing Used in Bitcoin?

The Bitcoin network uses a hashing algorithm called “SHA-256” — so called because it creates output data that is 256 bits in length — in many different functions of its blockchain. It is used when creating a new block, hashing transaction data and searching for a nonce.

Miners are attempting to generate a hash lower than the target difficulty for the block they are trying to validate. This target is determined by the network in a way that seeks to see blocks created approximately every 10 minutes. The lower the difficulty target, the harder it is to generate a hash that satisfies it.

When a miner gets the right hash that is accepted by the rest of the network, that miner receives a bitcoin reward.

What Is a Nonce?

A nonce is an arbitrary string of data in each block. Because a hash of any input data will always provide the exact same output data, nonces are added so that miners can manipulate this data and make multiple attempts to reach the correct difficulty target with different, randomized data strings. Miners spend most of their energy looking for a correct nonce. When a nonce is found, the new block is added to the blockchain.