Bitcoin Forum
October 23, 2017, 05:21:31 PM *
News: Latest stable version of Bitcoin Core: 0.15.0.1  [Torrent]. (New!)
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: What does "difficulty" mean?  (Read 10120 times)
bitcoin_builder
Newbie
*
Offline Offline

Activity: 23


View Profile
November 02, 2013, 03:10:46 PM
 #1

What exactly does "difficulty" mean?
I know the higher the difficulty the difficult it becomes to mine coins but what exactly does it mean? For e.g. if difficulty is 545898 so that means it will take this number of days or may be minutes to find the next block?
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1508779291
Hero Member
*
Offline Offline

Posts: 1508779291

View Profile Personal Message (Offline)

Ignore
1508779291
Reply with quote  #2

1508779291
Report to moderator
1508779291
Hero Member
*
Offline Offline

Posts: 1508779291

View Profile Personal Message (Offline)

Ignore
1508779291
Reply with quote  #2

1508779291
Report to moderator
Rluner
Full Member
***
Offline Offline

Activity: 126



View Profile
November 02, 2013, 04:06:00 PM
 #2

I think this covers what you require.

https://en.bitcoin.it/wiki/Difficulty
augustocroppo
VIP
Hero Member
*
Offline Offline

Activity: 756


View Profile
November 02, 2013, 10:11:01 PM
 #3

What exactly does "difficulty" mean?

Difficulty is an indicator of how much difficult is to find a block in accordance with the current target. To understand what difficulty means, you need to learn what targets means.

https://en.bitcoin.it/wiki/Target

Target is a 256-bit number which is shared by all Bitcoin clients. This number is compared to another 256-bit number in every block header. However  the number is not stored in a plain format, but in hash format. That means, the number is encrypted with SHA-256 algorithm.

When the number in the block header is equal or lower than the target, the block is accepted by the network and the process to create a new block begins.

E.g.

This is 256 bit number (in plain format) generated by the WolframAlpha:

8393997369393596769785934437998533438869467733663864887985488578597765357899637 6963755689359767757995645635365976764834883553347856773996359755847675437989674 7685754754588889348944777763666355343496447368956469469785645675565858334876759 7376735687578643494

So, as you can see, it is quite difficult to generate a random number which is exactly equal or lower than the above number. That is why the speed of a given Bitcoin "mining" device is what defines the chances to meet this criteria. As more random numbers per second is generated by the device, more chances to meet the target in less time as possible.

So if a person have a device which generates 1 Gigahash per second, that means the device generates the equivalent amount of 1 billion hash (256 bit number) per second.

 Shocked

Amazing, right?

Now let's understand what difficulty really means.

Quote
I know the higher the difficulty the difficult it becomes to mine coins but what exactly does it mean? For e.g. if difficulty is 545898 so that means it will take this number of days or may be minutes to find the next block?

Difficulty is the maximum target divided by the current target. So if difficulty is 545898, that means:

545898 = maximum target / current target

Quote
The maximum difficulty is roughly: maximum_target / 1 (since 0 would result in infinity), which is a ridiculously huge number (about 2^224).

The current target changes in accordance with how fast or how slow the blocks are accepted by the network during a time frame of 2 weeks. If the network is accepting more or less than 1 block each 10 minutes, the Bitcoin protocol will adjust the current target to keep that rate stable. So from this continuous adjustment is where the speed of the Bitcoin network comes from:

Network Hash Rate = Difficulty * 2**32 / 600

E.g.

Network Hash Rate = 545898 * 2**32 / 600

Network Hash Rate = 3907690094919 17/25

That means, if the difficulty is 545898, than the average number of hash per second required to a block being accepted by the network each 10 minutes is approximately 3907690094918, or approximately 3907 Terahash per second.
bitcoin_builder
Newbie
*
Offline Offline

Activity: 23


View Profile
November 03, 2013, 06:01:28 AM
 #4

Great explanation Augusto!
Need to clarify one thing regarding target.

1. Network takes some random number and it generates its hash
2. Then it distributes this hash as new target
3. Then miners try to find a number whose hash is equal to or less than target

Have I understood it right?
cassimares
Sr. Member
****
Offline Offline

Activity: 240


View Profile WWW
November 03, 2013, 10:12:25 AM
 #5

In short: The higher the difficulty, the less BTC you would get for the same hash rate...

Puppet
Legendary
*
Offline Offline

Activity: 966


View Profile
November 03, 2013, 11:07:35 AM
 #6

difficulty is bitcoins equivalent of Einsteins cosmological constant Cheesy
augustocroppo
VIP
Hero Member
*
Offline Offline

Activity: 756


View Profile
November 03, 2013, 03:35:37 PM
 #7

Great explanation Augusto!
Need to clarify one thing regarding target.

1. Network takes some random number and it generates its hash

No, the target is not exactly a random number. The target is defined in accordance with the rate of blocks being accepted by the network each 10 minutes. So there is a defined formula to generate the target.

Let's examine a real case, the first block generated by Satoshi Nakamoto when he started the Bitcoin protocol. The Internet page blockexplorer.com provide a history of the blockchain in CSV format:

http://blockexplorer.com/q/nethash

Quote
blockNumber,time,target,avgTargetSinceLast,difficulty,hashesToWin,avgIntervalSinceLast,netHashPerSecond
START DATA
144,1231693144,26959535291011309493156476344723991336010898738574164086137773096960,26959535291011309493156476344723991336010898738574164086137773096960,1.00,4295032833,1563,2747941

There is a field "time" followed by a field "target". The number in the field "time", 1231693144, is given in Unix format. So let's convert this number to the traditional Gregorian calendar format:

http://www.wolframalpha.com/input/?i=1231693144+unix+time

The first block of the Bitcoin network was accepted on Sunday, January 11, 2009, 4:59:04 pm UTC. The target to accept the block was:

26959535291011309493156476344723991336010898738574164086137773096960

This is a number with only 68 decimal digits. Now let's compare with the last computed target:

68962778243821519216393853205209897734463141354237780295680

It is a 59 decimal digit number. In other words, the last target is a number lower than the first target. That means that as lower the target becomes, greater is the difficulty to find a random hash which number is equal or lower than the target.

Now, to understand how the target is defined, let's examine the first block was accepted once the difficulty increase above 1:

Quote
32256,1262153464,22791060871177364286867400663010583169263383106957897897309909286912,24875298081094336890011938503867287252637140922766030991723841191936,1.18,5080592338,502,9272714

So, on Wednesday, December 30, 2009, 6:11:04 am UTC, the first block with difficulty above 1 was accepted by the network. At that time, difficulty was 1.18 and the target was:

22791060871177364286867400663010583169263383106957897897309909286912

Quote
2. Then it distributes this hash as new target

Correct, all clients distribute to each other the same target once it is recalculated.

Quote
3. Then miners try to find a number whose hash is equal to or less than target

Correct, the "miners" use their SHA-256 hash generators device to find the current target.
augustocroppo
VIP
Hero Member
*
Offline Offline

Activity: 756


View Profile
November 03, 2013, 03:45:39 PM
 #8

In short: The higher the difficulty, the less BTC you would get for the same hash rate...

A high difficulty means a low chance to find a random hash to accept the block and obtain the reward of 25 BTC + fees. Therefore is necessary an increase of the hash rate generated in seconds to increase the chance to find a random hash which satisfy the required criteria.

The Bitcoin network do not reward in accordance with the hash rate spent to find the target in the block header. The Bitcoin network change the difficulty to lower the chances to generate a new block and thus lower the chance to pay the reward.

So, it would be something like that: The higher the difficulty, lower is the chance you would have to find the target for the same hash rate.

However, the chance is still there and anyone generating any rate of hash per second has a chance to find a number which is equal or lower than the current target.
bitcoin_builder
Newbie
*
Offline Offline

Activity: 23


View Profile
November 03, 2013, 04:57:39 PM
 #9

Great explanation Augusto!
Need to clarify one thing regarding target.

1. Network takes some random number and it generates its hash

No, the target is not exactly a random number. The target is defined in accordance with the rate of blocks being accepted by the network each 10 minutes. So there is a defined formula to generate the target.

Let's examine a real case, the first block generated by Satoshi Nakamoto when he started the Bitcoin protocol. The Internet page blockexplorer.com provide a history of the blockchain in CSV format:

http://blockexplorer.com/q/nethash

Quote
blockNumber,time,target,avgTargetSinceLast,difficulty,hashesToWin,avgIntervalSinceLast,netHashPerSecond
START DATA
144,1231693144,26959535291011309493156476344723991336010898738574164086137773096960,26959535291011309493156476344723991336010898738574164086137773096960,1.00,4295032833,1563,2747941

There is a field "time" followed by a field "target". The number in the field "time", 1231693144, is given in Unix format. So let's convert this number to the traditional Gregorian calendar format:

http://www.wolframalpha.com/input/?i=1231693144+unix+time

The first block of the Bitcoin network was accepted on Sunday, January 11, 2009, 4:59:04 pm UTC. The target to accept the block was:

26959535291011309493156476344723991336010898738574164086137773096960

This is a number with only 68 decimal digits. Now let's compare with the last computed target:

68962778243821519216393853205209897734463141354237780295680

It is a 59 decimal digit number. In other words, the last target is a number lower than the first target. That means that as lower the target becomes, greater is the difficulty to find a random hash which number is equal or lower than the target.

Now, to understand how the target is defined, let's examine the first block was accepted once the difficulty increase above 1:

Quote
32256,1262153464,22791060871177364286867400663010583169263383106957897897309909286912,24875298081094336890011938503867287252637140922766030991723841191936,1.18,5080592338,502,9272714

So, on Wednesday, December 30, 2009, 6:11:04 am UTC, the first block with difficulty above 1 was accepted by the network. At that time, difficulty was 1.18 and the target was:

22791060871177364286867400663010583169263383106957897897309909286912

Quote
2. Then it distributes this hash as new target

Correct, all clients distribute to each other the same target once it is recalculated.

Quote
3. Then miners try to find a number whose hash is equal to or less than target

Correct, the "miners" use their SHA-256 hash generators device to find the current target.

Never saw such clear explanation of bitcoin before. Beautiful!
augustocroppo
VIP
Hero Member
*
Offline Offline

Activity: 756


View Profile
November 07, 2013, 12:31:02 AM
 #10

Great explanation.  Just a minor nitpick,  "the number is encrypted with SHA-256 algorithm" should say "hashed" instead of "encrypted" since there is no way to decrypt a hash.

OK, thanks for the tip, that is something new for me.
FogInTheNoggin
Newbie
*
Offline Offline

Activity: 2


View Profile
April 07, 2014, 01:10:22 AM
 #11

The definition definitely helps to understand difficulty.  My question is why would I want to have the option to increase or decrease difficulty? For example, if I start up my mining software, I have the option to increase or decrease the difficulty number. Would I want to make this number as low as possible or are there benefits to increasing the number? Basically, how does the option to adjust the number benefit a user?
Najska
Full Member
***
Offline Offline

Activity: 152


View Profile
June 15, 2014, 11:57:09 PM
 #12

Miners issue new coins in the new blocks as well as they confirm transactions. When difficulty rises, creating a block gets harder, which means that issuing new coins gets harder, but does it mean that confirming a transaction, too, gets harder?

Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!