blockchain – What is the meaning of difficulty in Bitcoin mining?

[ad_1]

I’m a beginner in Bitcoin

Therefore this answer will be a broad overview and simplified.

What does difficulty actually mean?

To understand the difficulty number in Bitcoin, you have to understand it’s purpose and not just the mathematics of it.

To understand the purpose of the difficulty number, you first need to understand the role of mining and timestamping.

Bitcoin is digital cash and it has no tangible coins. Bitcoin money is kept track of by keeping a record of the transactions. A transaction is a transfer of control over some amounts of money. For example if you give someone 10000 BTC for two Pizzas, the Bitcoin part of that exchange is a Bitcoin transaction.

It is obviously important that the person who already spent the money isn’t allowed spend it again. To prevent that, everyone has to know what transactions already occurred and in what order.

The order is important so that you can decide which of two spends are valid.

For example Joe has 10 BTC

Monday,  Joe gives Sue the 10 BTC 
Tuesday, Joe gives Bob the 10 BTC

Is different from

Monday,  Joe gives Bob the 10 BTC
Tuesday, Joe gives Sue the 10 BTC 

We need to know which transaction is accepted and which is fraudulent and should be rejected. This is important to Sue and Bob. Those timestamps (Monday, Tuesday) enable us to do that. This has to work at a global scale so that nodes in Atlanta and Auckland agree.

In Bitcoin it is miners who add transactions to blocks and add blocks to the blockchain. The blockchain is like an accounting journal of transactions and blocks are like pages in that journal.

So miners are ordering the transactions by timestamping the blocks (and by effectively numbering the pages).

Adding a new block is also the way that new amounts of Bitcoin money are created. You can think if it as new Bitcoin “coins” being created. This money is created as a reward for the miners.

Bitcoin’s designers wanted a new page to be written every ten minutes. The rate is important because it affects inflation in the currency. The rate must also be fast enough that recipients can quickly see they have been paid. The rate must be slow enough that every node can keep up with receiving and checking new pages (new blocks).

However producing a new block could be a trivial amount of work, so greedy people might mine 1000000 blocks a second to scoop up all the mining rewards. They would quickly run away with vast amounts of money. Therefore the mining is made difficult.

How difficult it needs to be depends on how much computing power all the miners have at any moment. If there are more miners with better computers, we need to increase the difficulty of mining so that they can’t produce more than a block every 10 minutes on average.

The difficulty number is the inverse of a target number, higher difficulties correspond to smaller targets.

Miners construct a block (a page in the transaction journal) and then calculate a hash of that block. This hash is a very large number that has to be less than the current target number.

About every two weeks, all Bitcoin nodes (wallets, miners, etc) recalculate the difficulty based on the average time between blocks in the last two weeks. If the average is less than 10 minutes, the difficulty is increased proportionately; if more, decreased. From then on nodes reject any blocks from miners that don’t have a hash less than the new target.

This prevents double spending and ensures a wealthy miner can’t take over mining and commit fraud.

When the difficulty is 6, then what I can know from that number?

You could calculate the target. You could see that new blocks have a hash smaller than that target.

[ad_2]

Source link

Leave a Comment