How to calculate nBits from difficulty?

0

I've created some code for generate target from difficulty.

var maxTarget = (double)Diff1; // Diff1 is BigInteger
var target = new BigInteger(maxTarget / difficulty);
return target.ToString("X");

But, I cannot figure out how I can get nBits (target bits) from difficulty and target?

Nedim Hozić

Posted 2019-11-19T11:42:20.347

Reputation: 101

No answers