Nalin Bhardwaj
    • 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
    # Nova zkVM This is a note describing some ideas for building a VM using Nova/SuperNova (in future even with lookups/custom gates). Many of these ideas come from my prior experiments with [Nova-zkMIPS and thinking about efficient zkVMs](https://hackmd.io/@nibnalin/snark-intensity) (thanks also to Adhyyan, afkbyte, Sampriti, Ye, YT and others for discussion and brainstorms on it), and were then made concrete in collaboration with the PSE zkWASM team (Carlos, Chiro, Oskarth, Violet, others?) at the Vietnam Residency. ## High Level Innovations 1. Use SuperNova with massive proving parallelisation - SuperNova being FFT-less potentially enables us to get a lot more mileage out of parallelisation over other approaches 2. Go straight from IR to IVC steps (using compiler hot-path optimisations) - SuperNova particularly optimises at making small blocks of repetitive compute more efficient to prove, so the problem of ZKing an execution trace of a program can be made much more efficient by offloading these responsibilities to compiler pipelines. This is like making application/code-specific VMs on the fly (or more accurately, making code-specific NIVC). 3. Use efficient vector commitment based state design - We propose a new (to our knowledge) method to store and update VM state between execution steps -- while the general idea is quite classical (using vector commitments), we describe how to use KZG commitments for these in the context of Nova very efficiently. The latter two are optional and subject to failure for various reasons, whereas the first one is an idea described vaguely in the original papers (so unlikely to have issues), and is also necessary to the success of a Nova-based zkVM vs. Halo2 or other proof systems. ## Using SuperNova with massive parallelisation Here are some explanations for how to parallelise proving with Nova. For background, we first share a view of typical sequential IVC: ![](https://i.imgur.com/gkkcsxR.png) *What IVC typically looks like, and how typical SNARK recursion based proving for IVC works* IVC is the repeated application of some step function (F) on some public state ($z_i$) with some extra/unknown witness input ($W_i$) at each step. In particular, IVC defines proofs at each step ($\pi_i$) that prove the execution of the first $i$ steps by themselves (in other words, $\pi_i$ proves that $F^{i}(z_0) = z_i$). In the usual instantiation of IVC, we use SNARKs to construct these $\pi_i$ incrementally: at each step $\pi_i$ shows that 1) $F(z_{i-1}) = z_i$ and 2) $\pi_{i-1}$ verifies correctly. This strategy is described in more detail in other [talks](https://youtu.be/JgJPKwOEWSU) and [blogs](https://0xparc.org/blog/groth16-recursion). ![](https://i.imgur.com/gvabeC9.png) *How Nova replaces the typical SNARK verifier for a Folding Scheme, and the function the folding scheme serves.* ![](https://i.imgur.com/sm2Iklw.png) *Opening the folding scheme black-box a bit more* Notice that in this view, the Nova machinery provides a black box with the ability to prove IVC sequentially. In specific, it assumes proofs are made in sequence, with a running instance $U_i$ being merged with $u_i$ at each step $i$. ### Parallelising Nova ![](https://i.imgur.com/n8ByXCg.png) The rough idea for parallelizing Nova is by using a binary tree structure for computation instead. We will compute incremental proofs of single steps, double them in size, and continue until we've exhausted the entire trace. More concretely, we use our folding scheme in the internal nodes to fold together proofs of half the computation trace, and additionally maintain some book-keeping and some checks of consistency for the $z$ values flowing through the computation. Here's a closer look at the modded function F' in this case: ![](https://i.imgur.com/vMlc6Jk.png) *Read this diagram left side first, then right. The top part is about how the function F' proceeds and verifies. The bottom W (witness) notes how the prover computes the necessary values for the folding step at the level above the current one.* ### NIVC: Non-uniform IVC To get to SuperNova, we'll first define a VM-like notion of IVC: Non-uniform IVC. The only difference is that NIVC switches between the function being ran at each step (from some small set of hardcoded instructions). ![](https://i.imgur.com/kJKeNPF.png) *$OP(z_i)$ selects which opcode to run at each step* ### SuperNova Nova's folding scheme only works when merging two instances of the same circuit. SuperNova's key innovation is to provide an idea for folding many circuits in _parallel_ for IVC, virtually allowing for many opcode-IVC, defined by the authors as Non-uniform IVC. Out of the box, the simplest way to run NIVC with Nova is to just treat it as regular IVC, but with switch/case conditions: At each step, choose which opcode to run in the R1CS constraints. This yields a $O(C \cdot L)$ size circuit for each step (where $C$ = number of constraints for one opcode, $L$ = number of distinct opcodes). SuperNova optimises by removing this switch/case conditional: instead, we maintain $L$ running instances _in parallel_, one for each opcode, and fold the current step's proof to the relevant opcode (with an added check that $F'$ picked this opcode correctly). Here's a diagramatic explanation: ![](https://i.imgur.com/2NcDS72.png) Notice that we've reduced the prover work done from $O(N \cdot C \cdot L)$ to $O(N \cdot (C + L))$, a pretty significant asymptote. ### Parallelising SuperNova Much like before, we'll make a binary tree structure, but now with many folding boxes (to contain the instances for each opcode). ![](https://i.imgur.com/WbnV1kC.png) Much like before, this binary tree structure takes $O(N \cdot (C + L))$ time to compute, but with parallelisation of folding supported in a bottom-up order. ### Go straight from IR to IVC steps The key observation here is that Supernova works with any blocks of constraints, so the "opcodes" in SuperNova need not have anything to do with the real opcodes of the VM itself. While shifting around and adding opcodes does not impact the total number of constraints we have to prove for a computation trace, it can help us reduce the cost of folding at each step. To verify a folding, Nova adds some number of constraints (for hashing, checking the commitment openings etc.). While we generally ignore these overhead constraints in asymptotics, let's focus on them for practicality: let's call the number of these constraints the recursion overhead/threshold $R$ (in practice, this number is 10000). The cost of running $N$ steps of SuperNova is $O(N \cdot (C + L + R))$. Notice that SuperNova allows us to shift around these recursion overhead constraints: Note also that we assume above that $O(C) >> O(L)$. - Much like writing ZK-specific compiler opcodes - You get all the benefits of hot path optimisations compilers usually make - Turns a problem of efficient VM design to a compiler pipeline problem (arguably a better way to TinyRAM approach long term) ### Use KZG-commitment machine state repr - memory is abstracted as "state" -> transform -> "state", how to use different vector commitments to represent state?

    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