SJ
  • NEW!
    NEW!  Connect Ideas Across Notes
    Save time and share insights. With Paragraph Citation, you can quote others’ work with source info built in. If someone cites your note, you’ll see a card showing where it’s used—bringing notes closer together.
    Got it
      • 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
    # 零知識證明(Zero-Knowledge Proof, ZKP) 零知識證明是一種密碼學協議,允許證明者(Prover, $P$)向驗證者(Verifier, $V$)證明某個陳述(Statement)為真,除了「該陳述為真」這個事實之外,不洩露任何關於該陳述的額外資訊(如證明所需的秘密證據 Witness)。 ZKP想解決的問題:如何在不信任的環境下建立信任,既是在不告訴對方對應資訊的前提下,表達我知道該資訊 ## ZKP的核心模型 ZKP的場景通常定義在一個關係 $R$ 上: * 公開輸入(Public Input, $x$):雙方都知道的資訊(如公鑰、問題描述) * 私有證據(Private Witness, $w$):只有 $P$ 知道的秘密(如私鑰、密碼) * 目標:$P$ 向 $V$ 證明他擁有 $w$,使得 $(x, w) \in R$ 成立 標準的 ZKP 系統通常由以下算法組成(以非互動式 NIZK 為例) 1. 設置 $Setup(1^\lambda) \to (pp, vp)$:生成公共參數 $pp$ 和驗證參數 $vp$(有時包含 Trusted Setup) 3. 證明 $Prove(pp, x, w) \to \pi$:輸入參數、公開輸入和秘密證據,輸出證明 $\pi$ 4. 驗證 $Verify(vp, x, \pi) \to \{0, 1\}$:驗證者輸入參數、公開輸入和證明,輸出接受或拒絕 ## ZKP的運作機制:Sigma 協議 ($\Sigma$-Protocol) 大多數 ZKP 的基礎是互動式的提交-挑戰-回應三步機制(以 Schnorr 協議證明知道離散對數 $y = g^x$ 為例): **承諾(Commitment)**: 證明者 $P$ 選擇一個隨機數 $k$,計算承諾 $t = g^k$,發送 $t$ 給 $V$。目的是鎖定隨機性,防止 $P$ 事後作弊 **挑戰(Challenge)**: 驗證者 $V$ 隨機選擇一個挑戰數 $c$,發送 $c$ 給 $P$。目的是引入不可預測性,讓 $P$ 無法提前偽造 **回應(Response)**: 證明者 $P$ 計算 $z = k + c \cdot x$,發送 $z$ 給 $V$。驗證者 $V$ 檢查等式 $g^z \stackrel{?}{=} t \cdot y^c$ 是否成立 **從互動到非互動(Fiat-Shamir Heuristic)**: 為了實用性,通常使用 Fiat-Shamir 變換將上述交互過程轉為非交互式(Non-Interactive ZKP, eg. NIZK) * 方法:用一個加密雜湊函數 $H$ 代替驗證者 $V$ * 挑戰 $c$ 不再由 $V$ 給出,而是計算 $c \leftarrow H(x, t)$ ## ZKP的性質 **完備性(Completeness)** 如果陳述為真,且證明者 $P$ 和驗證者 $V$ 誠實執行協議,則 $V$ 必定會接受證明。即 $Verify(Prove(x, w)) = 1$ 恆成立 **可靠性(Soundness)** 如果陳述為假(即 $P$ 不知道 $w$),則惡意證明者 $P^*$ 無法欺騙誠實的 $V$(除極小機率外)。即 $Prob(Verify(FakeProof) = 1) \approx 0$ **零知識性(Zero-Knowledge)** 如果陳述為真,驗證者 $V$ 在交互過程中除了「陳述為真」之外,無法獲得關於 $w$ 的任何資訊 定義方式:存在一個模擬器(Simulator),僅需輸入 $x$(不需要 $w$)就能生成一個與真實證明 $\pi$ 在分佈上不可區分的模擬證明 ## ZKP在MPC與FHE中的角色 ZKP 是構建高階安全協議的關鍵模塊,用於强制參與者的誠實: **在 MPC 中:從半誠實到惡意(Semi-Honest to Malicious)** * MPC 協議(如 GMW)通常會預設為 Semi-Honest * 為了達到惡意模型安全,要求每個參與者對其發出的每一條消息附加一個 ZK 證明 * 證明內容:「我剛剛發送的訊息是嚴格按照協議執行的,且我的輸入符合一致性」,強制惡意攻擊者必須像半誠實者一樣行為。 在 Verifiable FHE 中伺服器雖然看不到數據,但可能執行錯誤的計算。因此伺服器可以生成一個 ZK 證明,證明「輸出的密文 $c_{out}$ 確實是由輸入密文 $c_{in}$ 經過函數 $f$ 正確運算得來的」,防止伺服器欺詐。 ## ZKP的限制 ZKP 雖然能實現隱私保護,計算資源的消耗與系統設置的複雜性上存在不少限制: **計算不對稱性(Computational Asymmetry)** ZKP 存在極大的證明開銷(Prover Overhead)。證明者生成證明所需的時間通常遠大於直接執行原始計算的時間。因此若是要應用在高頻或低延遲的實時計算場景(如實時遊戲渲染)下頗有難度。 **可信設置風險(Trusted Setup / Toxic Waste)** 許多高效的 ZKP 方案(如 Groth16)依賴於一個初始的生成階段來產生公共參考串(CRS)。 風險:這個過程會產生中間秘密或被稱為「有毒廢料」。如果這些秘密被洩露或未銷毀,攻擊者就可以偽造假證明,破壞系統的可靠性(Soundness)。 解決:雖然 STARKs 或 Bulletproofs 不需要此設置(Transparent),但通常會犧牲證明大小或驗證速度。 **內存消耗(Memory Consumption)** 生成證明通常涉及大規模的快速傅立葉變換(FFT)和多標量乘法(MSM)。這些運算需要將龐大的電路結構載入記憶體,導致證明者需要較多的 RAM 才可以正確執行,限制了在移動設備或 IoT 設備上生成證明的可行性。 **電路表達的侷限(Circuit Complexity)** ZKP 要求將所有計算邏輯轉換為特定的算術電路(如 R1CS 或 QAP)。 困難點:傳統程式中的條件跳轉(If-Else)、不定長循環(Dynamic Loops)很難直接轉換為電路,所以現有的code轉到 ZKP 環境的開發成本較高,且電路規模往往會因為展開循環而變得龐大。 ## 主流ZKP實現方案分類 | 方案類型 | 代表算法 | 可信設置 | 證明大小 | 特點 | 適用場景 | | -------- | -------- | -------- | -------- | -------- | -------- | | zk-SNARKs | Groth16 | 需要 | 小 (~200 Bytes) | 驗證快 (ms級),但需要針對特定電路 Trusted Setup | Zcash, 隱私支付 | | Universal SNARKs | Plonk | 需要 (通用) | 小 (~400 Bytes) | 只需一次 Setup 即可支援所有電路,目前業界標準 | zk-Rollups (zkSync, Scroll) | | zk-STARKs | Fri-based | 不需要 | 大 (數十 KB) | 抗量子攻擊,證明生成速度快,但證明體積大導致 Gas Fee 高 | 高吞吐量計算, dYdX, StarkNet | | Bulletproofs | Bulletproofs | 不需要 | 中等 (log N) | 無需 Setup,驗證較慢,適合範圍證明 | Monero (Range Proof) | ## 參考資料 1. [The knowledge complexity of interactive proof systems](https://people.csail.mit.edu/silvio/Selected%20Scientific%20Papers/Proof%20Systems/The_Knowledge_Complexity_Of_Interactive_Proof_Systems.pdf) 2. [On the size of pairing-based non-interactive arguments](https://eprint.iacr.org/2016/260.pdf) 3. [零知識證明原理?特性與類型介紹/常見應用/儲備證明查詢範例](https://rich01.com/zero-knowledge-proof-zkp/) > 隨手筆記,有錯誤或需要補充的部分歡迎討論,~~還請鞭小力一點~~

    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 Google 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