Skip to content

Commit adad695

Browse files
authored
complete full zukyc example doc (#172)
1 parent ce26a31 commit adad695

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

book/src/examples.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ statement loan_check(receiver: PubKey):
6060
- gt(paystub.issue_date, NOW_MINUS_7D) # issue_date is less than 7d old
6161
# Annual salary is at least $20,000
6262
- gt(paystub.annual_salary, 20000)
63+
# Private key knowledge
64+
- hash(0, sk, gov_id.pk)
65+
# Nullifier
66+
- hash("ZooKyc", sk, nullifier)
6367
```
6468

6569
## ZuKYC (simplified for P1)

book/src/operations.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ The following table summarises the natively-supported operations:
2323
| 13 | `SumOf` | `s1`, `s2`, `s3` | `s1 = ValueOf(ak1, value1)`, `s2 = ValueOf(ak2, value2)`, `s3 = ValueOf(ak3, value3)`, `value1 = value2 + value3` | `SumOf(ak1, ak2, ak3)` |
2424
| 14 | `ProductOf` | `s1`, `s2`, `s3` | `s1 = ValueOf(ak1, value1)`, `s2 = ValueOf(ak2, value2)`, `s3 = ValueOf(ak3, value3)`, `value1 = value2 * value3` | `ProductOf(ak1, ak2, ak3)` |
2525
| 15 | `MaxOf` | `s1`, `s2`, `s3` | `s1 = ValueOf(ak1, value1)`, `s2 = ValueOf(ak2, value2)`, `s3 = ValueOf(ak3, value3)`, `value1 = max(value2, value3)` | `MaxOf(ak1, ak2, ak3)` |
26+
| 16 | `HashOf` | `s1`, `s2`, `s3` | `s1 = ValueOf(ak1, value1)`, `s2 = ValueOf(ak2, value2)`, `s3 = ValueOf(ak3, value3)`, `value1 = hash(value2, value3)`| `HashOf(ak1, ak2, ak3)` |
2627

2728
<!-- NOTE: should we 'uniformize' the names? eg. currently we have `EntryGt` and `GtToNEq` -->
2829

book/src/statements.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ The following table summarises the natively-supported statements, where we write
3535
| 8 | `SumOf` | `ak1`, `ak2`, `ak3` | `value_of(ak1) = value_of(ak2) + value_of(ak3)` |
3636
| 9 | `ProductOf` | `ak1`, `ak2`, `ak3` | `value_of(ak1) = value_of(ak2) * value_of(ak3)` |
3737
| 10 | `MaxOf` | `ak1`, `ak2`, `ak3` | `value_of(ak1) = max(value_of(ak2), value_of(ak3))` |
38+
| 11 | `HashOf` | `ak1`, `ak2`, `ak3` | `value_of(ak1) = hash(value_of(ak2), value_of(ak3))` |
3839

3940
### Frontend statements
4041

@@ -62,6 +63,8 @@ AnchoredKey::Integer)
6263
ProductOf(prod: AnchoredKey::Integer, arg1: AnchoredKey::Integer, arg2: AnchoredKey::Integer)
6364
6465
MaxOf(max: AnchoredKey::Integer, arg1: AnchoredKey::Integer, arg2: AnchoredKey::Integer)
66+
67+
HashOf(ak1: AnchoredKey::Raw, arg1: AnchoredKey::Raw, arg2: AnchoredKey::Raw)
6568
```
6669

6770
The following statements relate to Merkle trees and compound types; they are explained in detail on a [separate page](./merklestatements.md).
@@ -95,10 +98,6 @@ ContainsValue(root: AnchoredKey::Array, value: AnchoredKey)
9598

9699

97100
In the future, we may also reserve statement IDs for "precompiles" such as:
98-
```
99-
PoseidonHashOf(A.hash, B.preimage) // perhaps a hash_of predicate can be parametrized by an enum representing the hash scheme; rather than having a bunch of specific things like SHA256_hash_of and poseidon_hash_of etc.
100-
```
101-
102101
```
103102
EcdsaPrivToPubOf(A.pubkey, B.privkey)
104103
```

0 commit comments

Comments
 (0)