Bitcoin Forum
May 12, 2024, 04:01:17 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How is target and difficulty related?  (Read 539 times)
wingding (OP)
Hero Member
*****
Offline Offline

Activity: 770
Merit: 504



View Profile
April 17, 2014, 05:49:15 PM
 #1

As I understand, the difficulty is the number of hashes, divided by 2^32, required (in average) in order to get a SHA-256 below a target value T. And further, that the target value is actually what is adjusted in the algorithm. Is it then correct that D*(2^32)=(2^256)/T ? Or have I got it wrong here?
1715486477
Hero Member
*
Offline Offline

Posts: 1715486477

View Profile Personal Message (Offline)

Ignore
1715486477
Reply with quote  #2

1715486477
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
Shogen
Legendary
*
Offline Offline

Activity: 966
Merit: 1001



View Profile
April 19, 2014, 12:48:11 PM
 #2

You can find the info in details in the wiki.
For your reference: https://en.bitcoin.it/wiki/Difficulty#What_is_the_formula_for_difficulty.3F

Remember remember the 5th of November
Legendary
*
Offline Offline

Activity: 1862
Merit: 1011

Reverse engineer from time to time


View Profile
April 19, 2014, 08:24:09 PM
 #3

The difficulty is a human-readable representation of the target, just for us to be more comfortable with it.

BTC:1AiCRMxgf1ptVQwx6hDuKMu4f7F27QmJC2
Nicolas Dorier
Hero Member
*****
Offline Offline

Activity: 714
Merit: 621


View Profile
April 20, 2014, 12:33:13 AM
 #4

I implemented that code yestersday.
https://github.com/NicolasDorier/NBitcoin/blob/master/NBitcoin/Target.cs

You will find some test sample at
https://github.com/NicolasDorier/NBitcoin/blob/master/NBitcoin.Tests/util_tests.cs
In the test CanReadConvertTargetToDifficulty

This take Target from differelsnt form (packed and unpacked) and calculate difficulty from it.

Bitcoin address 15sYbVpRh6dyWycZMwPdxJWD4xbfxReeHe
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!