Jack Gilcrest
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # ZKEmail.nr/ Z-Imburse Halfway Progress Report NRG#1 Proposal: https://github.com/orgs/noir-lang/discussions/5814 Mach 34 is excited to deliver the half-way report on our work integrating ZKEmail into the Aztec Ecosystem! Our deliverables are split into two categories: * The [ZKEmail.nr](https://github.com/zkemail/zkemail.nr) SDK for all Aztec/Noir devs to implement to easily prove any type of email in Noir * The Z-Imburse proactive reimbursement application We've mostly completed the ZKEmail.nr library already - and we look forward to delivering the Z-Imburse application by DevCon 7. Below is a recap of our progress so far: ## Zkemail.nr Mach 34 has had the privilege to work with the ZKEmail team to build the official SDK and circuit libraries in the Aztec/ Noir ecosystem. We've worked diligently to mirror the tools and experience given by ZKEmail circom while leveraging the benefits of Noir. While the [ZKEmail.nr](https://github.com/zkemail/zkemail.nr) library is still in active development, we are proud to share that it is now available in public Early Access! We've proven about a dozen different types of emails so far, and invite you to try the SDK for yourself. Issues and PRs are welcome in the github repository if a specific email is giving you trouble ([ZKEmail.nr GitHub](https://github.com/zkemail/zkemail.nr)) ### Official Library Features [ZKEmail.nr](https://github.com/zkemail/zkemail.nr) has officially been adopted by ZKEmail as the official Noir implementation of ZKEmail! We've taken the [zk-email-verify](https://github.com/zkemail/zk-email-verify) JS input generators and set up a fully featured JS library for generating ZKEmail.nr inputs. The library can be imported using `yarn add @mach-34/zkemail-nr` for NodeJS and browser environments. It is capable of parsing in emails and extracting all the information you need to verify the DKIM signature over the header and body. It aims at supporting all features provided by ZKEmail Circom. The latest list and status of TODOs is available on GitHub [here](https://github.com/zkemail/zkemail.nr?tab=readme-ov-file#todo). ### Testing ZKEmail.nr has a set of [basic test cases](https://github.com/zkemail/zkemail.nr/blob/main/js/tests/circuits.test.ts) demonstrating the use of the NPM package `@mach-34/zkemail-nr` (likely eventually moved into the ZKEmail NPM org). These tests drive a set of [example circuits](https://github.com/zkemail/zkemail.nr/tree/main/examples) that currently demonstrate the use of ZKEmail to prove: * 1024-bit DKIM keys * 2048-bit DKIM keys * Partially hashed bodies We demonstrate proving and verifying ZKEmail.nr circuits both with the Plonk and Honk backends in this test, and largely believe these unit tests are sufficient to get anyone started using the [ZKEmail.nr](https://github.com/zkemail/zkemail.nr/tree/main/js/tests) library. Find more about the tests here: https://github.com/zkemail/zkemail.nr/tree/main/js/tests ### Contracts We don't have anything in the official ZKEmail.nr repository- this is something we will certainly add in the near future, but is not an *immediate* priority. We've nonetheless successfully successfully verified various ZKEmail.nr Plonk proofs in the (Base Sepolia) EVM. Additionally, we've integrated Linode and AWS hosting receipts into Aztec smart contracts. We'll talk more about this process in the Z-Imburse section. ### On Pattern Matching We have been unenthused with [noir_string_search](https://github.com/noir-lang/noir_string_search) after attempting to use it. We don't yet have access to Regex, and in the interim have defaulted to specifying maximum lengths, expected lengths, and indexes to manually perform pattern matching. We aren't comfortable with the hygiene or security of this practice yet, and will be finalizing our implementation of non-regex searching. For context, [ZK-Regex](https://github.com/olehmisar/zk-regex) in noir is not yet complete. We intend on integrating regex into ZKEmail.nr as soon as it is available for our use. ### ZKEMail.nr Remaining Work The only missing requirement is pattern matching, which we describe above. We do intend on cleaning up the code, perhaps implementing Noir's new metaprogramming to facilitate conditional use of parts of the circuit from a single import rather than having multiple imports for various components of the ZKEmail stack. Additionally, the upstream [ZK-Email-Verify](https://github.com/zkemail/zk-email-verify/) SDK which parses emails is not capable of handling archived DKIM keys - this presents an issue for use of older emails. ZKEmail actually has a [registry](https://archive.prove.email) of countless older DKIM keys, with a mechanism to reverse engineer keys from emails if you can't find the selector already. We will PR this functionality into ZK-Email-Verify then support it in the ZKEmail.nr JS SDK as well. We potentially will include EVM and Aztec demo integrations by the delivery date. We are not committing to this, however, and may elect to do this outside of the scope of NRG#1 (but we will definitely do it!). Z-Imburse acts as a defacto demonstration of the Aztec integration anyways. ## Z-Imburse [Z-Imburse](https://github.com/Mach-34/z-imburse) is a proactive reimbursement tool for crypto-native organizations. We're starting out with cloud hosting costs and travel receipts - two types of reimbursement transactions that DAOs, foundations, and companies in the cryptospace often engage in. The flow is as follows: ![image](https://hackmd.io/_uploads/SJhKvDobkg.png) 1. The organization sets up a Z-Imburse contract instance and funds the escrow with USDC 2. The organization creates an entitlement type - for instance, up to $100/ month that can be claimed from the escrow using an AWS Receipt sent via email 3. The organization gives this entitlement to a recipient address 4. The recipient address can upload their email into the Z-Imburse web app, prove authenticity, and export the amount they paid to AWS that month 5. The Z-Imburse contract constrains the timeframe and allows the recipient to withdraw USDC, up to the max value set by the escrow manager We've got the absolute minimal PoC of this flow built out so far, and look forward to shipping the MVP in the coming month. ### Email Verifiers We started with cloud hosting receipts, for which our chosen AWS and Linode were quite small. These verifiers are fairly simple - they check the DKIM signing key is valid for the verifier type and export a date and value of the receipt. We had to temporarily abandon AWS as the DKIM selectors we had access to were out of date - but as described in the [ZKEmail.nr Remaining Work](#ZKEMailnr-Remaining-Work) section, we can resolve this once we set up the use of archived keys. Right now, we have a different entrypoint for each verifier. However, we are exploring a conditional selector from a single entrypoint that takes in some of the reusable inputs (mostly the dkim signature) and uses capsules from the PXE to handle the dynamic lengths of email headers and bodies that may be present. ### Testing We'd originally planned to do most testing in the TXE - however, with the JS input parser for emails, we found it was easier to drive inputs from the PXE. We've set up basic [unit testing](https://github.com/Mach-34/z-imburse/blob/main/tests/escrow.test.ts) to drive the process of creating a Z-Imburse contract, escrowing funds, setting up entitlements, and claiming reimbursements. This testing is pretty barebones at the moment, and while it reflects the base case, we will deliver a complete testing harness by delivery. ### UI We've created a [skeleton UI](https://github.com/mach-34/zimburse-ui) that encompasses the full UX requirements of the Z-Imburse application, both from escrow managers and grant recipients. The UI is fully representative of the final UX we will ship for this MVP, but expect it to be far prettier! Additionally, we've made some compromises on UX that would be addressed in a later version - for instance, an escrow manager must create a reimbursement template and select from this set when setting an entitlement for a user where it would be more ergonomic to do this on the fly. ### Remaining Work #### Making Entitlements Recurring We were not quite able to get the recurring entitlement flow working in time for the half-way deadline. We have written a (unoptimized) [Date parser](https://github.com/Mach-34/z-imburse/blob/main/contracts/zimburse/src/date_parser.nr), we just need to set up the logic to nullify a note by the month value rather than relying on nullification of the note itself! #### Adding Flight/ Rideshare Receipts Z-Imburse additionally should support travel receipts. These are quite a bit more complex than hosting receipts, for numerous reasons: - Hosting receipts often (not always) are quite simple, but travel receipts have a lot of styling. From our inboxes, just about every travel receipt has a large body with the important sensitive information towards the beginning. This means we need ["Post-Partial Hashing"](#Post-partial-Hashing) to have a reasonably achievable UX - Escrow managers need to set *exact* matching destinations. Without regex, we can't easily normalize street names (i.e. "Street vs street vs st. vs St."). We may use a conditional check, or we may defer this improvement to the inclusion of ZK-Regex. - Oftentimes, these emails may be one-way or two-way travel. We may or may not elect to choose to support only one-way travel. - It is possible to re-issue travel receipts via email upon request to a platform. While this generally is not an issue for spot entitlements, it means that emails could potentially be reused by multiple parties without proper framing of the email nullifier to include the right information (date, location, value, etc). #### Post-partial Hashing As mentioned in the ZKEmail.nr section, we've already shipped "partial hashing". However, many emails place the important text at the top, and have relatively static HTML/CSS at the bottom. Large email bodies with the important information, like most of the travel receipts, therefore pose a challenging problem for verification. Fortunately, the information at the end that we want to skip hashing on the client is not sensitive. While it may leak *what* we are verifying, we can safely enlist a remote prover to finish hashing the email body without revealing the start of the email. We're still in the process of determining the optimal integration for this, but this is a critical component of delivering a wide range of emails #### Devnet Integration? If possible, we'd like to deploy Z-Imburse to the actual Aztec Devnet. This will provide a full simulation of the user experience of privacy preserving reimbursements (or even just the use of ZKEmail on aztec at all)! This one is really up to the appetite of the Aztec team to support.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully