“The lessons of competition are lessons for life.” ~ RK
The fifteenth operation is OP_DATATOHASH. The operation takes five arguments, [optional/default 0] threshold numeral, [optional/default 0] hashing algorithm, an address string, partial solution string, and a complete solution hashed with the given hashing algorithm.
In short OP_DATATOHASH creates a communal competition for the discovery of the solution to a particular hash. There are two modes of the operation’s execution…
MODE 1: Threshold.
If the threshold is given the distance between the sum of the hash of the hashing algorithm, address string, and partial solution is compared to the string given as the hex sum. If this is below the threshold and the partial solution hashed is equivalent to hex summed string the operation returns the address string. Otherwise the operation returns false.
MODE 2: Challenge.
If the BLAKE2 hashing algorithm, sum of the address, and the partial solution is equal to the provided sum hash the operation the address string is returns. If not it returns a false.
How to use it?
The operation draws inspiration from Bitcoin’s pay to hash where if a solution is provided which equates to the given hash the Bitcoin is unlocked. In practice however, this allows the miner to steal the solution reward sending it to the miner’s address. OP_DATATOHASH on the other hand allows miners to organize to discover the hash of solution. When a discovery is made the miners can also mine for with the solution to achieve a threshold which makes stealing the transaction irrelevant or untimely. The given owner address can also be a Schnorr public key which when combined with a set of addresses incentivizing pools of miners to seek the solution to the hash.