7

How to compute block difficulty from a hash of that block? In Bitcoin, I can see that block hash starts with a lot of zeros, but in Monero I don't understand how uniqueness of new block in represented in the hash value.

I've read the specification for Cryptonote: https://cryptonote.org/cns/cns003.txt and it doesn't seem to be in 'varint' representation.

I wasn't able to find anything on this. I've been through all the questions on this stackexchange and all articles on monerobase.com.

Thanks a lot!

6

You cannot compute a block's difficulty from its hash. The hash is a Keccak hash.

A different hash using Cryptonight is used for PoW purposes, but this isn't the block hash. It is often called the PoW hash, or just PoW. It uses a similar system to Bitcoin where the hash as an integer must be below some treshold based on difficulty. This hash is run on the "hashing blob" of the block, which is basically the header plus the merkle root of the transactions. So in order to compute the difficulty, you have to have the block hashing blob itself.

This PoW hash is visible to casual users when a reorg happens. You see messages such as:

2017-08-25 04:28:11.472 [P2P6] INFO global src/cryptonote_core/blockchain.cpp:1411 ###### REORGANIZE on height: 1384066 of 1384066 with cum_difficulty 3031277306080642 alternative blockchain size: 2 with cum_difficulty 3031295878143490 2017-08-25 04:28:11.846 [P2P6] INFO global src/cryptonote_core/blockchain.cpp:1422 ----- BLOCK ADDED AS ALTERNATIVE ON HEIGHT 1384066 id: <6df10afb911800584d13c9016280737eb9cac5b0fa7dc72ab4aa7919153af4ec> PoW: <24b75b4f1b6e61341e294efb25da9bd427667ac555f24b040457100b00000000> difficulty: 18661398539

Note how the PoW above is a small number (all the zeroes at the end).

  • I would like to see extended explanation of hashing and steps before certain difficulty requirement is meet for certain block. – Dragutin Nov 5 '17 at 0:27

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.