-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
draft: support merklized credential #1
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add description to the VC templates. Move it to separate folder.
- Instructions how to generate templates and how it works, so developers will understand the algorithm
- Move Merklization to separate Template.
- Move ClaimRootBuilder to separate file
include "./helpers/signature.circom"; | ||
include "./helpers/extractor.circom"; | ||
include "./helpers/nullifier.circom"; | ||
|
||
|
||
template ClaimRootBuilder(nLevels) { | ||
signal input templateRoot; | ||
signal input siblings[10][nLevels]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create a template param with number of smt changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
smt[i].isOld0 <== 0; | ||
smt[i].newKey <== keys[i]; | ||
smt[i].newValue <== values[i]; | ||
smt[i].fnc <== [0, 1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function value you pass doesn't look correct here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pass the update flag as here in the example: https://github.com/iden3/circomlib/blob/master/test/smtprocessor.js#L73
} | ||
const templateRoot = tree.F.toObject(tree.root); | ||
|
||
const constLefasUpdate = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -79,6 +79,54 @@ function prepareTestData() { | |||
), | |||
) | |||
|
|||
const tree = await newMemEmptyTrie(); | |||
const leafs = [ | |||
"4809579517396073186705705159186899409599314609122482090560534255195823961763", "2038038677412689124034084719683107814279606773706261227437666149072023632255", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add comments here too? What are the first & second values on each line and how have you calculated them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
revealState: 0, | ||
|
||
revocationNonce: 954548273, | ||
credentialStatusID: "1018201307016207665766251269200564043201648522038849723333336008159229499355", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add comments on how you got these values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to create notion page with instructions how to calculate all key-value pairs.
assert(Number(witness[6]) === 0) | ||
assert(Number(witness[7]) === 0) | ||
await circuit.checkConstraints(witness); | ||
assert(witness[3] === BigInt("4230341195722595158824846810955105073061381863438730322129274755644729517884")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are you checking here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
// Pin code | ||
assert(Number(witness[5]) === 110051) | ||
|
||
// State | ||
assert(bigIntsToString([witness[4]]) === 'Delhi') | ||
// Data of birth on integer format |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Date, not data.
In integer format, not on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -98,4 +122,25 @@ template AadhaarQRVerifier(n, k, maxDataLength) { | |||
|
|||
// Dummy square to prevent signal tampering (in rare cases where non-constrained inputs are ignored) | |||
signal signalHashSquare <== signalHash * signalHash; | |||
|
|||
// The value was calculated using the go-iden3-core library | |||
var i0 = 11838043422440293315007254764009275008602; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add set of attributes for the library
Internal documentation how to calculate the template: https://www.notion.so/privado-id/AnonAadhaar-1314f86a875180448bc9e7bdfef90b01?pvs=4#1744f86a875180a280f6dcaf36bbf8a0