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?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.