0

I am trying to work on Zokrates in Remix IDE

I am trying this code :

import "hashes/sha3/512bit" as sha256packed

def main(private field value, private field before, field valueHash, field beforeHash, field afterHash) -> (field):
    priBefore = sha256packed([0, 0, 0, before])
    priAfter = sha256packed([0, 0, 0, before-value])
    field result = if(\
        value <= before &&\
        priBefore[0] == beforeHash &&\
        priAfter[0] == afterHash \
    ) then 1 else 0 fi
    return result

The code is from AwesomeHuang's Github repository

However, i am getting the following error in the Zokrates compiler :

Error Message in REMIX IDE

Can anyone help me resolve this error ?

I am new to Zero Knowledge Proofs and to Zokrates itself, hence i am quite confused

I would be grateful for the help !

1 Answer 1

0

This is a late reply but you need to add the type when declaring a new variable with the current syntax.

field[2] priBefore = sha256packed([0,0,0,before]);

Your Answer

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

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