This example program can generate a proof, that I am at least 18 years old, without revealing my actual year of birth to the verifier. It works as follows:
The government's administration approves, that the year of birth (1980) corresponds to my public key by signing pedersen_hash(my_public_key, my_year_of_birth).
By compiling and running age_check.cairo it can be verified, that the government's signature is valid for the pedersen_hash(my_public_key, my_year_of_birth) and rangecheck that I am at least 18 years old: 18 <= 2021 - my_year_of_birth.
- Run example.py, which
- generates keys for the government and me
- simulates the government signing my personal data
- simulates me preparing the input.json for cairo
- Compile and run
age_check.cairoon the preparedinput.json.
> cairo-compile age_check.cairo --output age_check_compiled.json
> cairo-run --program=age_check_compiled.json --print_output --layout=small --program_input=input.json
- TODO: let the execution generate a trace (--trace_file=age_check.json) and find a way to verify the trace.