I'm trying to understand the hashlock contract: https://gitlab.com/ligolangh/ligo/-/blob/e2672829484927b268c8ab0755247403e1f90675/src/test/examples/jsligo/hashlock.jsligo

For me, in a hashlock contract, you commit a hash, and then in a second transaction, you reveal the data behind the hash.

There is 2 functions in the hashlock contract : commit and reveal, which seem to do this job but I don't understand the hashed parameter in the storage. There is already a commits parameter, which is used to store the commits, and the hashed parameter is never initialized in the code. I don't understand why we would want to store the hashed data in the initialization of the contract.

Does someone have an explanation ? Thanks


Your Answer

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

Browse other questions tagged or ask your own question.