How to get value of nbits from Bitcoin mining pool stratum response

61 views Asked by At

I'm looking at the stratum protocol and I'm having a problem with the nbits value of the mining.notify method. I am having problem with calculating the leading zeros value. So I am using below job

{
    "id": "None",
    "method": "mining.notify",
    "params": [
        "1699124683_1302771",
        "ee660a3e315357a42aec582931e4f34ba34f036300002ffd0000000000000000",
        "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff5803d4700c1b4d696e656420627920416e74506f6f6c393037e7011403d450e402fabe6d6d6c647bfdf35ceb9cb31fc901909bb0ddc3606eb3c759c913e9e6911bf1e8db200200000000000000",
        "ffffffff04744067290000000017a9144b09d828dfc8baaba5d04ee77397e04b1050cc73870000000000000000266a24aa21a9ed594ccb04beb39e38815daf25c37cb2d079d3bad05a51503bbde3ce5a8e471f6300000000000000002f6a2d434f52450164db24a662e20bbdf72d1cc6e973dbb2d12897d55997be5a09d05bb9bac27ec60419d0b373f32b2000000000000000002b6a2952534b424c4f434b3a05132c25672f671084924566f64aaa2b1926fa6e31ecd96555220a2d005839d600000000",
        [
            "b9010d426ed693832149456aa442a4cbb7e2d282b07f4f76d5086fc84638afbb",
            "90f71b47ceb606f0b38d7a82665742a983776e08ae2718dc4fb116db53480b92",
            "5a4a665be6ee63d059bda0a83d263adcca48344f7e5a64c1ebbfce604eda6f74",
            "e33225e435e3cfb370c27111c7db196eaad3863763f5146ccc1f7c780eb6bcac",
            "6581f12b1f60767dcdc571159fd75e2504e7eea7f052cb35e7664bf61c234fe8",
            "834fe4b0bdb10673c2b317d848cb93cf2b7b3a8af7a5051f0887163a1f829ecb",
            "695e04507d0f3b0bcd1466e7edb39dc6cf7ba940557df25d65d116251685ba29",
            "cd10e9a17b67de88e5f792908000024269f247486c3b2b8ee7ee4c3564209838",
            "cc858f4d2cc6ce86cc0ee532ee5d65ccb3ccd5684499be004ee6e4f662b3a4ef",
            "43f0be9cf3e65de59662316bab91419d098906715a2ce109a16f7aacd4ef81f0",
            "cf0e82af3926d6dd0d3be1822e1c3806614130e4a0bf95403b39d524bc7e465d",
            "c686bb9cb5b284ccd7d42fd5d1e55a5d78e8c6bb2585d0d89e6b084db2f73ef8"
        ],
        "20000000",
        "17048194",
        "654695cb",
        false
    ]
}

I have tried this so far, but it gives 2 as return value, is the 2 valid for that job, maybe the difficulty is lower for starter?

nbits = 17048194
target = ( nbits[2:] + '00' * ( int( nbits[:2], 16 ) ) ).zfill( 64 )

print( target ) // prints 0000000000000481940000000000000000000000000000000000000000000000

is this value correct?

0

There are 0 answers