New answers tagged

2

I'm only answering this question because I saw Murch had tweeted Andrew Chow's answer. I researched this a bit while writing my book, Programming Bitcoin, but it didn't make it into the book, so I thought this would be a good place to put it. You can think of "bits" as a lossy compressed large base-256 number (that is, each 8-bit byte is a digit). The ...


8

TL;DR The formula comes from turning an algorithm into a mathematical formula. nBits encodes the target with the first bytes as the size of the final target, followed by the 3 most significant bytes of that target. This can be converted into that crazy formula. The formula is the mathematical representation of the actual algorithm that was used for the ...


0

I don't know which paper you got this from, but I will attempt to answer your questions. The author simply decided to write 256 as a power of 2. This is a matter of preference. I haven't looked at the code itself, but either way, there should be very little overhead doing it this way. Perhaps, since this formula is in hexadecimal, it shouldn't have base-10 ...


Top 50 recent answers are included