kilic
    • 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
    # ZKEVM Aggregation Circuit Prover Load In this first version of the write up we try to examine and estimate load of the verifier of a plonk gate. ## Batch KZG We follow plonk paper variant of batch KZG commitment scheme in order to avoid G2 operations in verifier side. > However we are going to implement aggregation circuit we should revisit if we get smaller aggregation circuit if we use Z(X) based batch KZG comitment scheme. ### Notation Let's first agree on notations. Apoligies for very non formal approach for the subject but the goal is to give some intuition. $A(X)$ is a polynomial such as $A(X) = a_0 + a_1X + a_2X^2 + a_3X^3 + ...$ $a$ is a scalar field element and an evaluation of $A(X)$ polynomial at some point. This point in our context is mostly obtained evaluating $A(X)$ at a random scalar challanges. $A$ is a group element i.e. an elliptic curve point. $G$ is the generator of our elliptic curve group $G_1$ $H$ is the generator of our elliptic curve group $G_2$. #### Setup In KZG setup phase we sample a random scalar $s$ and prapere the SRS available for both verifier and prover. And the SRS is calculated as $s^iG$ and $sH$ where $0 < i < N$ and available to both verifier and prover along with generators $G$ and $H$ $A = Com(A(X))$ is commitment to the polynomial $A(X)$ and it is actually $A = a_0 G + a_1 (sG) + a_2 (s^2G) + a_3 (s^3G)$ In our context we might use $X$ and $sG$ terms and $X$ and $sH$ terms interchangebly. ### Single Opening Then let's review the single KZG opening protocol. We want to prove that $A(x) = y$. So $A(X) - y$ must have root at $x$. It means that it is divisible by $(X - x)$. Then we can write: $W(X) (X - x) = A(X) - y$ where $W(X)$ will be our witness polynomial. And we can also rewrite this equation to obtain $G_2$ operation free verifier side. $XW(X) = A(X) - y - xW(X)$ * Verifier samples random $x$ and sends it to the prover * Prover evalution $A(X)$ at $x$ and finds $y$ * Prover commits to both $A(X)$ and $W(X)$ and finds $A$ and $W$. * Prover send $y$, $A$ and $W$ to the verifier. Then verifier checks the opening with following pairing equation. $e(W, sH) = e(A - yG - xW, H)$ > Notice that if we were to commit polynomial Y(X) = y it is Com(Y(x)) = yG and if we were to commit U(X) = X in $G_2$ it is Com(U(X)) = sH. These elements are available to or can be calculated by verifier. ### Batch opening We can generalize the idea above for multiple polynomials at various evaluation points and make verifiers work more efficient. #### Single eval point First let's go through multiple polynomial and single evaluation point case. Now given evaluation point $x$ we want prove that $A_0(x) = y_0$, $A_1(x) = y_1$, ... $A_{n-1}(x) = y_{n-1}$. What we need to do is to divite linear combination of $A_i(x) - y_i$ terms with $(X-x)$ $W(X) (X - x) = \prod_{i=0}^{n} \alpha^i (A_i(X) - y_i)$ And pairing equation becomes: $e(W, sH) = e(\sum_{i=0}^{n} \alpha^i (A_i -y_iG) - xW, H)$ #### Multiple eval point Here we have multiple eval points. Let's say $A_i(X)$ are evaluated at $x_a$ $B_i(X)$ are evaluated at $x_b$ and $C_i(X)$ are evaluated at $x_c$. Notice that we will group polynomials by which point the are evaluated so $A_i(X)$ can be equal to $B_j(X)$. Actually this is the case with plonk KZG verification since we evaluate same column in different rotations. So lets see equations $W_a(X) (X - x_a) = \prod_{i=0}^{n} \alpha_a^i (A_i(X) - y_{ai})$ $W_b(X) (X - x_b) = \prod_{i=0}^{n} \alpha_b^i (B_i(X) - y_{bi})$ $W_c(X) (X - x_c) = \prod_{i=0}^{n} \alpha_c^i (C_i(X) - y_{ci})$ To reduce verifiacation into single pairing equation we need to introduce another linear combination. $F_a = \beta^0(\sum_{i=0}^{n} \alpha_a^i (A_i -y_{ai}G) - x_aW_a)$ $F_b = \beta^1(\sum_{i=0}^{n} \alpha_b^i (B_i -y_{bi}G) - x_bW_b)$ $F_c = \beta^2(\sum_{i=0}^{n} \alpha_c^i (C_i -y_{ci}G) - x_cW_c)$ $W = \beta^0W_a + \beta^1W_b + \beta^2W_c$ $e(W, sH) = e(F, H)$ ## Plonk in halo2 In halo2 library linearization technique is not applied so proof and verification process a bit different than the paper. It is actually easier to reason about but obviously suboptimal for verifier. Let's define a simple gate equation as an example. > Note that example below does not cover lookup tables yet. $Q_a(X)A(X) + Q_b(X)B(X) + Q_{mul}(X)A(X)B(X) + Q_c(X)C(X) + Q_{c\_next}(X)C(wX) + Q_d(X) = 0$ Commitments to selector polinomials below are part of verification key: $Q_a$, $Q_b$, $Q_c$, $Q_d$, $Q_{mul}$, $Q_{c\_next}$. And commitments to witnesses are part of the proof: $A$, $B$, $C$. To verify the gate equation itself evaluations at some random point of these polynomials are also part of the proof. $q_{a}$, $q_{b}$, $q_{c}$, $q_{c\_next}$ and $q_{d}$ for selector evaluations and $a$, $b$, $c$ and $c\_next$ for witness evaluations. What verifier needs to do 1. Check evaluations hold the gate equation: $q_A * a + q_b * b + q_{mul} * a * b + q_c * c + q_{c\_next}* c_{next} + q_d = 0$ 2. Check evaluations are correct openings at the random points and shifted points: Here is the KZG part of the verification and we have two groups of commitments and evaluations. * First one $U^1 = [A, B, C, Q_a, Q_b, Q_c, Q_d, Q_{mul}]$ and $e^1 = [a,b,c,q_a,q_b,q_c,q_d,q_{mul}]$ against evaluation point $x$ * And the other $U^2 = [C, Q_{c\_next}]$ and $e^2 = [c_{next}, q_{c\_next}]$ against $xw$ $F_{w^0} = \beta^0(\sum_{i=0}^{n} \alpha_a^i (U_i^1 - e_i^1 G) - xW_{w^0})$, $F_{w^1} = \beta^1(\sum_{i=0}^{n} \alpha_b^i (U_i^2 - e_i^2 G) - xwW_{w^1})$, $W = \beta^0 W_{w^0} + \beta^1 W_{w^1}$, $e(W, sH) = e(F, H)$, ## Cost analysis Under $G_2$ operation free approach we followed above we can conclude with this cost estimations for verifier: 1. Each column introduced with existing evaluation point $xw^i$ contributes as: * An elliptic curve point which is the comitment to the proof size. For example $A$. * A scalar field element which is the evaluation to the proof size. For example $a_{eval}$ * A linear combination term for batch under same eval point. Equivalent to say 2 group multiplication (1 fixed base 1 variable base) and 2 group addition. For example for this term: $\alpha * (A - a_{eval} * G)$ 2. A new column with non existing evaluation point $xw^i$ contributes additional to above as: * A elliptic curve point which is a new KZG witness commitment. For exaple $W_{w^0}$ * A linear combination term for batching witness comitments. It'd take 1 group multiplication and 1 group addition. For example $\beta^i * W_{w^i}$

    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