Blockchain: The mystery of mining difficulty and block time.

Author:Jimi S. Sep 25, 2018 

Mining difficulty is the degree that determines how hard it is for miners in terms of hashing power (and thus also time) to find an eligible hash aka signature for their block (a block of transactions needs an eligible hash to be verified and added to the blockchain). On the Bitcoin blockchain, miners try to find an eligible hash by hashing random numbers. Let’s briefly zoom in on this process.

Blockchain: The mystery of mining difficulty and block time.

Mining aka Hashing — a quick refreshment

Let’s quickly go over this again. If you read my article “how mining works and transactions are processed”, you know that a block of transactions will only be accepted by the rest of the network if it has a signature (hash) that meets certain requirements (in example of Bitcoin, the signature needs to start with a certain number of zeroes). In order to find this signature, miners are spending computational power (hashing power) to perform a set of pre-determined operations on random numbers untill they find a number that leads to an output number that meets the requirements. Finding an output that starts with only one zero is much easier (generally more common) than finding an output number that starts with five consecutive zeroes (this is pretty rare so it would take much more time to find a number that leads to such output).

Eligible signature (hash) — aka mining difficulty

So the amount of zeroes that a signature requires to start with consecutively determines how hard it is for miners (how much hashing power or time it takes on average) to find it. This is the mining difficulty. The more zeroes required, the harder it is to find an eligible signature (= higher difficulty). But what determines the mining difficulty?

What determines the mining difficulty?

The mining difficulty is adjusted automatically on the network every two weeks based on the block production rate. When more miners join the network to mine Bitcoin, the total hashing power increases and therefore it can be assumed that the network altogether will find eligible signatures faster, meaning they will add blocks to the blockchain faster. Here is an example:

  • Assume that all miners in this example have the same computational power (hash rate). On average, it takes a miner 1 hour to find an eligible hash. One miner finds 1 eligible hash per hour, but ten miners find 10 eligible hashes per hour. The block production rate for 1 miner is 1 block per hour, but for ten miners it is 10 blocks per hour, which is much faster!

The mining difficulty on the Bitcoin blockchain is adjusted every two weeks so that the total hashing power on the network on average produces 1 block per 10 minutes. If a lot of miners join the Bitcoin blockchain and the cumulative hashing power goes up, then the block production rate could increase from 1 block per 10 minutes to 1 block per 9 minutes. After a while, this would trigger the mining difficulty to go up as well, so that even with this extra hashing power, the block production rate will maintain a steady pace of 1 block per 10 minutes. The same applies to the opposite, when miners stop mining on a blockchain and the cumulative hashing rate goes down, the mining difficulty would also go down. The big question is: why 1 block per 10 minutes?

But why only one block per ten minutes?!

You may not instantly realise it, but this really is a very good question. I personally had to spent a lot of time to figure this out, and apparently I was not the only one.

Blockchain: The mystery of mining difficulty and block time.

But why should the mining difficulty increase at all? This requires more electricity to process the same amount of transactions. Why not just lower the mining difficulty and speed up the block production rate? This would also mean that Bitcoin transactions are processed much faster.

Blockchain: The mystery of mining difficulty and block time.

For a long time I couldn’t exactly wrap my head around this question, but after some time someone on Reddit finally came up with the answer. Satoshi Nakamoto (inventor of Bitcoin) himself decided that the block production rate should maintain a steady average pace of 1 block per 10 minutes, because: a blockchain will estimately need 10 minutes to propagate the latest block(s) to all nodes globally, in order for the blockchain to stay properly synchronized. If blocks are produced at a faster pace, some nodes on the other side of the globe might not be able to catch up fast enough with the lates transaction data, and this may cause nodes to be no longer correctly aligned, leading to “uncle blocks” (chain splits), which is basically something a blockchain must avoid as much as possible in order to stay secure. A rather simple answer indeed, but it makes sense.

So — block difficulty

So, to summarize; the block difficulty is based on the total hashing power of the network, and is adjusted every two weeks to maintain a steady block production rate of 1 block per 10 minutes. This gives the network time to synchronize and update the blockchain ledger globally, and is crucial to maintain security on the ledger (uncle blocks reduce the security rate of the network because they can become invalid even after they are validated).

The more miners join the network, the more cumulative computational power is being spent to find eligible signatures, and the faster blocks are added to the blockchain if the difficulty does not change. The difficulty therefore goes up when the hashing power goes up, and the difficulty goes down when the hashing power goes down. As you can see below, the cumulative hashing power (hash rate) is currently at 51 billion GH/s. The higher the hash rate, the higher the block difficulty.

Blockchain: The mystery of mining difficulty and block time.

As you can see below, block 100 (back in 2009) only required a signature that started with eight consecutive zeroes, whereas the last block today (block 542865) needed a signature that started with at least 18 consecutive zeroes. The amount of zeroes is what reflects the difficulty level. Finding an output with so many consecutive zeroes requires either much more time or much more hashing power, and it is so much higher today because there is so much more hashing power (more miners) being spent on the Bitcoin blockchain.

Blockchain: The mystery of mining difficulty and block time.
Block 100 had a difficulty of 8 consecutive zeroes.
Blockchain: The mystery of mining difficulty and block time.
Block 542864 had a difficulty of 18 consecutive zeroes.

As you can see, the cumulative hashing power on the Bitcoin blockchain in 2018 is many, many times more than it used to be back in 2009. A little sidenote: the graph below shows an only ever increasing Bitcoin mining difficulty up until March 2018, but it has been dropping since October 2018 as miners were forced to stop mining because their operational costs were starting to exceed mining profits as Bitcoin prices were dropping fast.

Blockchain: The mystery of mining difficulty and block time.
Bitcoin’s mining difficulty has increased significantly ever since its birth because more miners (hashing power) have joined the network ever since.

OK — So what if we increase the blocksize?

Yes, this has been a widely discussed topic. If the block size increases, regardless of the difficulty, more transactions will fit into a block, meaning more transactions are processed in a given timeframe. Although this sounds like a solution, it really isn’t. There are several arguments in opposition of increasing the blocksize, one of them being that a longer propagation time between nodes would lead to a higher uncle rate. Basically, it is a tradeoff between scalability and security, and it would only be a temporary fix at the cost of network integrity.

Where can I find realtime reporting of incoming blocks on the Bitcoin and Ethereum blockchain?

You can find a realtime scanner, including live block time, block difficulty, hash rate, et cetera, for the Bitcoin blockchain here and for Ethereum here.

This article is reproduced from https://blog.goodaudience.com/blockchain-the-mystery-of-mining-difficulty-and-block-time-f07f0ee64fd0

(0)
PlatONWorld-Mr.Dou的头像PlatONWorld-Mr.DouOfficial
上一篇 30 4 月, 2021 11:00
下一篇 30 4 月, 2021 12:40

相关推荐

发表回复

登录后才能评论