Author

Topic: [LTC] Checking if block hash is valid for given difficulty (Read 3075 times)

legendary
Activity: 3108
Merit: 1359
It's because TBX, FBX, BBQ, LTC and other similar clones actually don't use scrypt as blockhash function. Scrypt hash isn't used in blockchain directly, getpowhash() function generates this.
legendary
Activity: 1862
Merit: 1011
Reverse engineer from time to time
Quote
I checked sources:
https://github.com/litecoin-project/litecoin/blob/master/src/main.cpp

I found function to check it. It is exacly same as in bitcoin so hashes should be similiar unless ... binary clients are from different source and LTC users are in BIG trouble or I am just missing something here.
Code:
bool CheckProofOfWork(uint256 hash, unsigned int nBits)
{
    CBigNum bnTarget;
    bnTarget.SetCompact(nBits);

    // Check range
    if (bnTarget <= 0 || bnTarget > bnProofOfWorkLimit)
        return error("CheckProofOfWork() : nBits below minimum work");

    // Check proof of work matches claimed amount
    if (hash > bnTarget.getuint256())
        return error("CheckProofOfWork() : hash doesn't match nBits");

    return true;
}
That sentence doesn't even make sense.
legendary
Activity: 1862
Merit: 1011
Reverse engineer from time to time
+1, I'd like to know how and why too.
sr. member
Activity: 359
Merit: 250
Hi,

How litecoin checks if block hash matches difficulty?
I understand how it works for bitcoin. Bitcoin hashes have leading zeroes for example 000000002c05cc2e78923c34df87fd108b22221ac6076c18f3ade378a4d915e9 is valid hash for difficulty 1. When difficulty icreases more leading zeroes are needed.

Litecoin hashes don't have leading zeroes and hash a4ef2ee56356014853936c6c5f50baeeaa74c0db90e973e2ae5bc9d0d840cdf1 was accepted for difficulty 1.065.
Later on with difficulty 364.365 even greater hash d55ad6397da22574b63ae03d54dee8b58e0777cdc531252808371fc25bd296b3 was accepted.

So how do I check if block hash is valid for litecoin?
Jump to: