Trying to understand nbits value from stratum protocol

0 votes

I'm looking at the stratum protocol and I'm having a problem with the nbits value of the mining.notify method. I have trouble calculating it, I assume it's the currency difficulty.

I pull a notify from a dogecoin pool and it returned 1b3cc366 and at the time the difficulty was 1078.52975077.

I'm assuming here that 1b3cc366 should give me 1078.52975077 when converted. But I can't seem to do the conversion right.

I've looked herehere and also tried the .NET function BitConverter.Int64BitsToDouble.

Can someone help me understand what the nbits value signify?

Sep 3, 2018 in Blockchain by sabby
• 4,370 points
1,173 views

1 answer to this question.

0 votes

You are right, nbits is current network difficulty.

Difficulty encoding is throughly described here.

Hexadecimal representation like 0x1b3cc366 consists of two parts:

  • 0x1b -- number of bytes in a target
  • 0x3cc366 -- target prefix

This means that valid hash should be less than 0x3cc366000000000000000000000000000000000000000000000000 (it is exactly 0x1b = 27 bytes long).

Floating point representation of difficulty shows how much current target is harder than the one used in the genesis block.

Satoshi decided to use 0x1d00ffff as a difficulty for the genesis block, so the target was0x00ffff0000000000000000000000000000000000000000000000000000.

And 1078.52975077 is how much current target is greater than the initial one:

$ echo 'ibase=16;FFFF0000000000000000000000000000000000000000000000000000 / 3CC366000000000000000000000000000000000000000000000000' | bc -l
1078.52975077482646448605
answered Sep 3, 2018 by Perry
• 17,100 points

Related Questions In Blockchain

0 votes
1 answer

How to get return value from solidity contract?

Once you call a constant function, you ...READ MORE

answered Aug 16, 2018 in Blockchain by slayer
• 29,370 points
5,080 views
0 votes
1 answer

How to get a value from SQLite to convert it?

Server side: b = BtcConverter(force_decimal=True) p1btc = b.get_latest_price('USD') p1btcr = ...READ MORE

answered Sep 6, 2018 in Blockchain by digger
• 26,740 points
767 views
0 votes
1 answer
0 votes
2 answers

Is it possible to modify a variable value from another contract?

No, you can't directly edit a variable ...READ MORE

answered Sep 24, 2018 in Blockchain by Sai
4,386 views
+1 vote
1 answer

Protocols used in a distributed/dlt system for the nodes to establish communication

yes all are over TCP/IP connections secured ...READ MORE

answered Aug 6, 2018 in Blockchain by aryya
• 7,460 points
1,461 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,947 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,472 views
+1 vote
2 answers

How to return value from a chaincode in Hyperledger Fabric?

Hyperledger Fabric supports only 2 types of ...READ MORE

answered Jun 13, 2018 in Blockchain by Perry
• 17,100 points
3,004 views
+1 vote
4 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP