I was going through the Create Your Own CryptoCurrency documentation and got stuck at the proofOfWork section. In this, they try to do a check i.e.
require(n >= bytes(difficulty)) //Check if its under difficulty
I wanted to understand, what kind of comparison is being done here?
- Is is byte-to-byte comparison?
- Is there some conversion happening before the check?
- Or, its just a length check (which I think isn't the case, but just to be sure, I added it here).
If someone can point me to the right resource on the same.
require(n >= bytes8(difficulty))
.bytes8
is a fixed-length array of bytes that defines>=
, among other comparators. I assume it's doing a byte-to-byte comparison. The code you shared shouldn't compile.