Bitcoin Forum
September 27, 2018, 10:41:41 PM *
News: ♦♦ New info! Bitcoin Core users absolutely must upgrade to previously-announced 0.16.3 [Torrent]. All Bitcoin users should temporarily trust confirmations slightly less. More info.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: How is target and difficulty related?  (Read 454 times)
wingding
Hero Member
*****
Offline Offline

Activity: 770
Merit: 500



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?
Make a difference with your Ether.
Donate Ether for the greater good.
SPRING.WETRUST.IO
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1538088101
Hero Member
*
Offline Offline

Posts: 1538088101

View Profile Personal Message (Offline)

Ignore
1538088101
Reply with quote  #2

1538088101
Report to moderator
Shogen
Legendary
*
Offline Offline

Activity: 966
Merit: 1000



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: 1750
Merit: 1001

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: 700
Merit: 501


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:  

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!