Calculating Solutions
Overview
OP_NET miners search for SHA-1 near-collisions with the epoch's checksum root. The algorithm combines the checksum root, the miner's public key, and a random salt, then hashes using SHA-1 to find the best match.
The SHA-1 Mining Algorithm
The algorithm objective is to maximize matching_bits, which represents the number of identical bits between the computed hash and the target checksum root. The mining process iterates through salt values, retaining the solution that yields the highest bit match count.
Input Data
- Checksum Root from previous epoch's final block.
- Miner's Public Key.
- Random 32-byte Salt.
Algorithm
- Obtain checksum root from completed epoch.
- Generate random 32-byte salt.
-
Compute SHA-1 hash:
- hash = SHA1(checksum_root + public_key + salt)
-
Count matching bits against target:
- matching_bits = count_matching_bits(hash, target_pattern)
- If better than current best, save solution.
- Adjust salt and repeat.
Epochs to Blocks
Nodes use the formula below to establish the deterministic mapping between epochs and blocks. This allows all participants to independently calculate which blocks belong to each epoch:
Where N is the Bitcoin block.