diff --git a/README.md b/README.md index 71f43a7c..12ceddfc 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,12 @@ This is a simplified flow, but underneath we use many parameters to ensure secur ## ☞ Directory structure This is a mono-repo that contains the circom circuits, smart contracts, the relayer and a prover server. +### Circuits and Constraints: +*Total Constraints Across All Circuits*: **3,999,432** + + +
+ - `packages/circuits` contains the circom circuits, tests, scripts to generate zkeys, vkeys, and helper functions to generate circuit inputs. - `packages/contracts` contains the solidity contracts, tests, and scripts to deploy the wallet. - `packages/relayer` contains the relayer code - relayer listens to IMAP server, generate proof using prover server, and call the contract. @@ -124,13 +130,15 @@ saved here. ├ ├── /subgraph # indexing and querying events generated by circuits. - ``` +
## ☞ Building and Running +The total number of constraints across all circuits is **3,999,432**. + - Refer to the [circuit docs](./packages/circuits/README.md) for more details on building and testing circuits. - Refer to the [contract docs](./packages/contracts/README.md) for more details on building and testing contracts. - Refer to the [relayer docs](./packages/relayer/README.md) for more details on building and running relayer. @@ -148,7 +156,6 @@ And to serve the website: mdbook serve ``` - ## References 1. S. Suegami and K. Shibano, "Contract Wallet Using Emails," 2023 IEEE International Conference on Blockchain and Cryptocurrency (ICBC), Dubai, United Arab Emirates, 2023, pp. 1-2, doi: 10.1109/ICBC56567.2023.10174932. @@ -156,4 +163,4 @@ mdbook serve

-☆ Built using [zk-email](https://github.com/zkemail/zk-email-verify) ☆ +☆ Built using [zk-email](https://github.com/zkemail/zk-email-verify) ☆ \ No newline at end of file diff --git a/packages/circuits/src/email_sender.circom b/packages/circuits/src/email_sender.circom index 502c0f71..d5c57c75 100644 --- a/packages/circuits/src/email_sender.circom +++ b/packages/circuits/src/email_sender.circom @@ -57,7 +57,7 @@ template EmailSender(n, k, max_header_bytes, max_subject_bytes) { signal output has_email_recipient; signal output recipient_email_addr_commit; - // Verify Email Signature + // VERIFY EMAIL SIGNATURE : 669650 constraints component email_verifier = EmailVerifier(max_header_bytes, 0, n, k, 1); email_verifier.in_padded <== in_padded; email_verifier.pubkey <== pubkey; @@ -66,19 +66,21 @@ template EmailSender(n, k, max_header_bytes, max_subject_bytes) { signal header_hash[256] <== email_verifier.sha; pubkey_hash <== email_verifier.pubkey_hash; - // FROM HEADER REGEX + // FROM HEADER REGEX : 643296 constraints signal from_regex_out, from_regex_reveal[max_header_bytes]; (from_regex_out, from_regex_reveal) <== FromAddrRegex(max_header_bytes)(in_padded); from_regex_out === 1; signal sender_email_addr[email_max_bytes]; sender_email_addr <== VarShiftMaskedStr(max_header_bytes, email_max_bytes)(from_regex_reveal, sender_email_idx); - // SUBJECT HEADER REGEX + // SUBJECT HEADER REGEX : 99208 constraints signal subject_regex_out, subject_regex_reveal[max_header_bytes]; (subject_regex_out, subject_regex_reveal) <== SubjectAllRegex(max_header_bytes)(in_padded); subject_regex_out === 1; signal subject_all[max_subject_bytes]; subject_all <== VarShiftMaskedStr(max_header_bytes, max_subject_bytes)(subject_regex_reveal, subject_idx); + + // EMAIL ADDRESS REGEX : 92037 constraints signal recipient_email_regex_out, recipient_email_regex_reveal[max_subject_bytes]; (recipient_email_regex_out, recipient_email_regex_reveal) <== EmailAddrRegex(max_subject_bytes)(subject_all); has_email_recipient <== IsZero()(recipient_email_regex_out-1); @@ -97,6 +99,7 @@ template EmailSender(n, k, max_header_bytes, max_subject_bytes) { recipient_email_addr[i] <== shifted_email_addr[i] * has_email_recipient; } + // INVITATION CODE REGEX WITH PREFIX : 43494 constraints signal code_regex_out, code_regex_reveal[max_subject_bytes]; (code_regex_out, code_regex_reveal) <== InvitationCodeWithPrefixRegex(max_subject_bytes)(subject_all); signal has_code <== IsZero()(code_regex_out-1); @@ -113,7 +116,7 @@ template EmailSender(n, k, max_header_bytes, max_subject_bytes) { } masked_subject_str <== Bytes2Ints(max_subject_bytes)(masked_subject_bytes); - // DOMAIN NAME HEADER REGEX + // DOMAIN NAME HEADER REGEX : 38219 constraints signal domain_regex_out, domain_regex_reveal[email_max_bytes]; (domain_regex_out, domain_regex_reveal) <== EmailDomainRegex(email_max_bytes)(sender_email_addr); domain_regex_out === 1; @@ -129,7 +132,7 @@ template EmailSender(n, k, max_header_bytes, max_subject_bytes) { email_nullifier <== EmailNullifier()(sign_hash); - // Timestamp regex + convert to decimal format + // Timestamp regex + convert to decimal format : 233872 constraints signal timestamp_regex_out, timestamp_regex_reveal[max_header_bytes]; (timestamp_regex_out, timestamp_regex_reveal) <== TimestampRegex(max_header_bytes)(in_padded); // timestamp_regex_out === 1;