2

I want to create a block that fulfill the Proof of Work requirement. After reading sparse documentation my understanding on how to do it is:

1- Serialize the block(message) excluding the 8-byte Nonce and compute the BLAKE2b-256 hash of this. Convert the hash into its 192-trit b1t6 encoding

2- Propose a random 8-byte Nonce and convert it into its 48-trit b1t6 encoding and append it to the hash trits.

3- Add a padding of three zero trits to create a 243-trit string.

4- Compute the Curl-P-81 hash of the 243-trit string.

5- Count the number of trailing zero trits in the hash.

6- Then, the PoW score equals 3#zeros / size(message).

7- If the PoW score is smaller than the minPowScore of the node info repeat the process from step 2, else the proposed nonce is sufficient to fulfill Proof of work.

My question is: is this procedure the correct one to fulfill Proof of work on the client. If it is the correct one, where can i get Curl-P-81 function or do step 4. I have followed this tip, but i can not find the Curl-P hashing function.

Thank you for your time.

1 Answer 1

0

I am surprised that Curl-P is still used here (with all the move to binary and the new ternary Troika hash), but presumably Curl-P proof of work has been implemented on many devices (e.g. GPU accelerated versions) and they did not want to see that time wasted.

The reference implementation of Curl-P (now used on the nodes) is written in Rust. There is also an implementation of the hash function in Java, which was used by the Android app before they switched to Trinity app.

There are also optimized Curl-P PoW implementations (which are optimized to finding a hash and not to hashing a single value), known under the name PearlDiver (links to the Java reference implementation by Sergey Ivangelo also known as Come-From-Beyond). A WebGL implementation of PearlDiver is in the repo of the old curl.js library

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.