馬廣辰
    • 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 No publishing access yet

      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.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      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 New
    • Engagement control
    • Make a copy
    • 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 Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy 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 No publishing access yet

    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.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    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
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Why and How zk-SNARK Works ###### tags: `NCKU` Public Date: March, 2020 Author: Maksym Petkus Jornal: arxiv e-print archive, cornell university Speaker: Kuang Chen, Ma --- ## Outline - ### Abstract - Zero Knowledge Proof - ZK-SNARKS and the medium of proof - ### Introduction (Next time) - Non-Interactive Zero-Knowledge of a Polynomial - Obscure Evaluation - ### Conclusion (Next time) --- ## Zero Knowledge Proof Usage 1. Evidence of Statement Regarding Privacy Data * Match DNA without exposing all DNA data * User can do KYC without exposing data 2. Anonymous authentication * Proof that user's has access to restricted areas without revealing identity 3. Anonymous payment * Pay taxes without disclosing income 4. Outsourced computing * Outsource expensive computation and verify that the result is correct without re-executing it --- # ZKP Definition In any "zero-knowledge proof" system, has two parties * prover: wants to convince the verifier that some statement is true without revealing data * verifier: Verify prover knows data The agreement should satisfy the following three properties: 1. Completeness 1. Reliability 1. Zero knowledge --- # ZK-SNARKS and the medium of proof * zk-snarks definition: * Zero knowledge * Succinctness * Non-interactivity * Arguments * of knowledge * The medium of proof * ![](https://secbit.io/blog/2019/12/25/learn-zk-snark-from-zero-part-one/img/1_7JGXnnMDoEr4Rbn7-WOSQw.png) f(x) = x³ – 6x² +11x– 6 d(x) = x³ – 6x² + 10x– 5 If we let f(x) = d(x) x³ – 6x² + 11x – 6 =x³ – 6x² + 10x – 5 x - 1 = 0 Only x = 1 can fill above equation --- * The medium of proof That's why if a prover claims to know some polynomial that the verifier also knows (regardless of the degree of the polynomial) Then they can follow a simple protocol to verify: ```sequence Note right of Bob: E(x) Bob->Alice: gives the x value to the prover Note left of Alice: P(x) Alice->Bob: gives the calculation result Note right of Bob: E(x)/P(x) = 0 (mod x) ``` ``` Bob: verifier Alice: prover E(x): chooses a random value x and computes the polynomial result locally E(x)%P(x) = 0 : checks whether the local calculation result and the prover's calculation result are equal ``` --- If we set x in 1 to 10⁷⁷ * number of points with different calculation results = 10⁷⁷ – d (d: degree) * hit rate = $\frac{d}{10^{77}}$ (could be considered almost impossible) **This is why polynomials are a relatively central part of zk-SNARKs even though other proof media may exist.** --- # Non-Interactive Zero-Knowledge of a Polynomial ## Proving Knowledge of a Polynomial A polynomial can be expressed in the form (where n is the degree of the polynomial): $c_nx^n + ... ... + c_1x^1 + c_0x^0$ If one stated that he knows a polynomial of degree 1 (i.e., $c_1x^1 + c_0 = 0$), that means that what one really knows is the coefficients $c_0, c_1$. ($c_n$ can have any value, including 0) Let us say that the prover claims to know a degree 3 polynomial, such that x = 1 and x = 2 are two of all possible solutions. One of such valid polynomials is $x^3 - 3x^2 + 2x = 0$. For x = 1: 1−3+2=0. For x=2: 8−12+4=0. > This means that the "knowledge" of the polynomial is the coefficients of the polynomial. The so-called "know" polynomial means "know" the coefficients of the polynomial. --- ## Factorization Any valid polynomial can be as the product of its factors: $(x - a_0)(x - a_1)...(x - a_n) = 0$ Any $a_s$ are all polynomial solutions. e.g. x for 0, 1, 2 $x^3 - 3x^2 + 2x = (x-0)(x-1)(x-2)$ Prover wants to prove that he knows a certain polynomial without revealing the polynomial, he can use this form to prove $p(x) = t(x) \times h(x)$ ``` p(x) : Prover's polynomial t(x) : (x- 1)(x- 2) (also called the target polynomial) h(x) : Arbitrary polynomial (that is, x - 0 in our example) ``` $h(x) = \frac{p(x)}{t(x)}$ If a prover cannot find such a h(x) which means that p(x) does not contain the factor t(x), then the polynomial division will have a remainder E.g. $p(x) = x^3 - 3x^2 + 2x$ $t(x) = (x-1)(x-2)=x^2-3x+2$ ![](https://secbit.io/blog/2019/12/25/learn-zk-snark-from-zero-part-one/img/1_iT3kRk3C-DJdvQgi1b2uOA.png) Then we can see that the result h(x) = x, there is no remainder. Using our polynomial identity check protocol we can compare polynomials $p(x)$ and $t(x)·h(x)$: ```sequence Note right of Bob: t = t(r) Bob->Alice: gives r to the prover Note left of Alice: h(x) = p(x)/t(x) Note left of Alice: evaluates p(r) and h(r) Alice->Bob: provide p,h to the verifier Note right of Bob: check p = t · h ``` ``` Bob: verifier Alice: prover t = t(r): samples a random value r, calculates t = t(r) p: p(r) h: h(r) check p = t * h, if so those polynomials are equal, meaning that p(x) has t(x) as a cofactor. ``` ![](https://i.imgur.com/L3pCCV4.png) ![](https://i.imgur.com/7DKsa6j.png) We will get $2x+3$ with the remainder $7x−6$, i.e.: $p(x) = t(x)×(2x+3)+7x−6$. This means that the prover will have to divide the remainder by the $t(r)$ in order to evaluate $h(x) = 2x + 3 + \frac{7x-6}{t(x)}$ However, since x is randomly chosen by the verifier, there is an extremely low probability that the remainder 7x – 6 will eventually be divisible by t(x). Now we can verify polynomials based on certain properties without knowing the polynomial, which has given us some properties of zero knowledge and simplicity. However, there are still many problems in this structure: * The prover may not know the $p(x)$ he claims * guest $t = t(r)$ * choosing a random value $h$ * $p = t⋅h$ * Because the equation is established, it can also pass the verification of the verifier * Because the prover knows the random point $x = r$ he can construct an arbitrary polynomial that has something in common with $t(r) ⋅ h(r)$ at $r$ * In the original statement, prover claims to know a polynomial of a particular degree, in the current protocol there is no enforcement of degree. Hence prover can cheat by using a polynomial of higher degree which also satisfies the cofactors check.

    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
    Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    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