# Blockchain Mining Difficulty

The crypto-currency Bitcoin recorded an all-time high at USD Four,300 te Mid-August 2018. The popularity of crypto-currencies like Bitcoin and Ether (Etherium) have tremendously enlargened adaptation overheen the years. Blockchain is the underlying technology that powers thesis digital crypto-currencies.

This postbode is to explain some technical concepts behind blockchain and explain the mining difficulty adjustments that takes place te the network to keep the growth of the blockchain stable.

## Blockchain

A “blockchain” is a public database of transactions collective te a peer-to-peer network inbetween participating knots secured by cryptography. A transaction te the blockchain is permanently time-stamped and is immutable. The blockchain consists of “blocks” of gegevens, with each block containing validated transactions with a reference to the previous block. This creates a chain of blocks, thus the name “blockchain”. This chaining permits anyone to validate the transactions up to the beginning of the chain, all the way back to the very very first “genesis block”.

## Miners

Blockchain “miners” are special knots te the network that validates fresh transactions to create fresh blocks on the blockchain. To create a fresh block, miners require thick amounts of computing resources or processing power. Miners are required to create a block that sates certain criteria set by the network. They need to prove that they created a fresh block (the “proof-of-work”) by showcasing their candidate block. The fresh block gets added to the blockchain only if the majority of the network knots agree on the validity of the block.

## The Block

To explain the concepts further, wij will use the Bitcoin blockchain spil an example. A block’s main content is a list of validated transactions. The block header contains a reference to the previous block and few other meta gegevens. The header includes an significant value called the “nonce”. Nonce is a random value generated by the miners and included te the block so that the block-hash sates the hash requirement (hash target).

The SHA-256 hash algorithm generates a 64-digit hexadecimal hash value. The current Bitcoin blockchain requirement is to find a nonce that creates a block-hash with 17 leading zeros.

**Note**: The actual hash difficulty is not about the leading zeros. It is about finding a hash less than the hash target set by the network. However, this is approximately about finding a hash having a specific number of leading zeros.

## Bitcoin Mining

Miners prize themselves with the “block reward” for creating fresh blocks. The block prize commenced at 50 BTC when the blockchain began ter 2009 and halves every 210,000 blocks, harshly every Four years. Current block prize is 12.Five BTC. The block prize will ultimately reach zero and a total of 21 Million Bitcoins would be mined by the year 2140.

Up to now, miners have added around 480,000 blocks and generated 16.Five Million Bitcoins. This is the total amount of Bitcoins presently te circulation and possessed by all Bitcoin users.

## The Blockchain Supercomputer

Finding a block with 17 leading zeros is an utterly difficult resource-intensive task for any single rekentuig. However, with all the miners ter the network with their combined computing power, it takes an average of Ten minutes to construct a fresh block. Think of this spil one supercomputer generating blocks every Ten minutes.

When fresh mining knots with quicker and swifter CPUs are added to the network, the blockchain super rekentuig becomes more and more powerful. Naturally, it should produce fresh blocks quicker. However, the Bitcoin network ensures that fresh blocks are created at a onveranderlijk tempo by recalibrating the hash-difficulty so that the fresh blocks will be created at an average of Ten minutes.

For example, when the Bitcoin blockchain commenced te 2009, the initial requirement wasgoed to generate a block with a block-hash having 8 leading zeros. Today, due to the much swifter supercomputer, it needs to find a block having 17 leading zeros.

## Understanding the Blockchain Hashing Difficulty

A SHA-256 generates a 256-bit hash (64 hex-digits). The Bitcoin network defines a “hash target” every 2016 blocks. This is harshly every Two weeks when a block is created every Ten minutes.

One block every Ten mins = 6 blocks vanaf hour, 6 x 24 te a day, and 6 x 24 x 14 = 2016 blocks ter two weeks.

The miners are looking for a block hash (a binary number) that is less than or equal to this “hash target”. For example, if the hash target is 0000a1b2c3e4f5, any hash less than or equal to this number is a valid block hash. Many hashes would please this requirement and any one of those would be a valid. However, it is an enormously difficult task to find such a hash. Lesser the hash target, the more difficult it is to find a satisfying hash.

Spil an example, if wij were to find a hash less than or equal to **0FFFF**, wij have 65,536 choices. However, if wij were to find a hash less than or equal to **000FF**, wij have only 256 choices. A lower target number means fewer choices. Visually, more leading zeros wij require te our hash, much tighter it is to find a satisfying hash.

You can view the current Bitcoin blockchain information by visiting blockchain.informatie. Search for any block by providing the block number. For example, if wij look at a latest Block #456789, wij will see two significant values related to the difficulty calculation: **Onverdraagzaam** and **Difficulty**

## The Vinnig

“Bits” is a value represented te klein notation indicating the “hash target”. Vinnig is a four-byte value. The very first byte indicates the number of bytes (length) of the hash target while the following three bytes indicate the most significant bytes.

Ter our Block #456789 example,

Onvriendelijk: 402809567 (decimal) =>, Legitimate 02 62 DF (hex)

Each byte has two hex digits. The very first byte represents the length of the hash target: Eighteen (hex) =>, 24 (decimal). Which means the hash target is 24 bytes te length, with the most significant bytes specified ter the subsequent three bytes.

## Hash Target

When the three significant bytes are written spil a 24-byte value:

Hash target: 02 62 DF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

The miners are attempting to find a block hash less than or equal to this hash target.

SHA-256 hashes have 64 hex digits. When the hash target is represented spil a total 32-byte value (64 hex digits):

Visually for plainness, this can thought of spil miners attempting to find block-hashes containing 17 or more leading zeros.

## Adjusting the Hash Target

Spil mentioned before, the hash target is adjusted every 2016 blocks so that the time to generate blocks remain at an average of Ten minutes.

If it has taken less than Ten minutes average time to generate the last 2016 blocks, the formula will yield a smaller hash target, which is tighter to find.

## The Difficulty

Ter the example block above, wij see a large value called “Difficulty”. The “difficulty” gives a relative figure of the hash difficulty of mining a block compared to mining the very very first block. The difficulty is a ratio inbetween the block #0 (genesis block) hash target and the current hash target:

The genesis block Onaardig were hardcoded to 486604799 (0x 1D 00 FF FF). This results te a hash target of 8 zeros followed by **FF FF** followed by 26 zeros. This is a very large hash target. The hash target becomes smaller and smaller overheen time, there by making the difficulty becomes larger.

The difficulty of the block #0 wasgoed 1. Since the Difficulty depends on the hash target, its value switches every 2016 blocks.

The difficulty increases exponentially. Today, your typical general-purpose pc would take thousands of years to mine a fresh block on its own. The combined mining power of the Bitcoin supercomputer can do this ter Ten minutes.

## Leave a Reply