EF zkp
      • 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
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners 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
    • 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 Help
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
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners 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
    # `libkzg`: a minimum-viable KZG polynomial commitment scheme implementation [DRAFT] Existing research highlights promising use cases for Kate-Zaverucha-Goldberg ([KZG10](https://www.iacr.org/archive/asiacrypt2010/6477178/6477178.pdf)) commitments in ETH2, particularly as [a better accumulator of block data than Merkle trees](https://ethresear.ch/t/using-polynomial-commitments-to-replace-state-roots/7095). Despite strong interest from the research community, however, there are few, if any, implementations of this commitment scheme which smart contract developers can use today. In this post, I present [`libkzg`](http://github.com/weijiekoh/libkzg), an implementation written in Typescript, and which contains a Solidity verifier. I also describe in detail the choice of trusted setup, how `libkzg` uses the EIP-197 precompiled contract for pairing checks to verify a single-point KZG proof, and discuss how to perform multi-point proofs on-chain. `libkzg` currently supports the following features: 1. The ability to convert an arbitrary list of values to the coefficients of a polynomial. 2. The ability to generate a KZG commitment function to said coefficients. 3. The ability to generate a proof (or witness) that the polynomial evaluates to a particular value at at given point (or index). 4. The ability to verify said proof in Typescript and the EVM. It currently does not support proofs of evaluation at multiple points, but this feature may be built sometime after this post is published. Do note that multi-point proofs may not be feasible to implement in the EVM, and a follow-up post will discuss this. [TOC] ## Implementation details ### Function interfaces **`genCoefficients(values: BigInt[]): Coefficient[]`** Performs polynomial interpolation on the given values and returns a new polynomial, which is represented as a list of coefficients. Note that the new polynomial, not `values`, should be fed into `commit()` in order to commit to `values`. **`commit(coefficients: Coefficient[]): Commitment`** Given a list of values, this function should output their KZG commitment. **`genProof(coefficients: Coefficient[], index: number): Proof`** Generates a proof that the polynomial evaluates to `coefficients[index]` at the x-value `index`. **`verify(c: Commitment, proof: Proof, index: number, value: BigInt): boolean`** Returns true if the proof (that for the polynomial committed to, the evaluation at the given index equals the given value) is valid, and false otherwise. ### The trusted setup The KZG scheme requires a trusted setup. To abstract this away from developers, `libkzg` comes packaged with values from the 46th contribution to the [Perpetual Powers of Tau Ceremony](https://github.com/weijiekoh/perpetualpowersoftau) (PPOT). As PPOT is a multi-party trusted setup, as long as just one participant had safely discarded their toxic waste during the ceremony, nobody can generate fake proofs. The number of so-called powers of tau from this ceremony is the maximum number of coefficients this library supports. For the sake of portability, `libkzg` only supports up to 65536 coefficients. That said, anyone can choose any existing contribution to PPOT and modify `libkzg` to support up to a maximum of $2 ^ {28}$ coefficients (although this would require an unwieldly amount disk space in the range of dozens of gigabytes for off-chain use, and be limited by gas costs for deploying te verifier contract on-chain). ### Verification in the EVM `libkzg` provides a Solidity contract that can verify single-point proofs. The contract code is [here](https://github.com/weijiekoh/libkzg/blob/master/sol/KZGVerifier.sol). Each invocation consumes about 178k gas. Its function signature is: ``` function verifyKZG( uint256 _commitmentX, uint256 _commitmentY, uint256 _proofX, uint256 _proofY, uint256 _index, uint256 _value ) public view returns (bool) ``` The verifier uses the [EIP-197](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-197.md) precompiled contract to perform a pairing check. According to the KZG10 paper, this pairing check must pass in order for the proof to be valid. It states: ![](https://hackmd.io/_uploads/rJn8bFWJD.png) It is crucial that this equation is converted into a form that can be efficiently computed on-chain. On the one hand, the EIP-197 precompiled contract accepts a list of G1 and G2 group elements $(a_1, b_1 ... a_n, b_n)$, and checks if they fulfill this equation: $e(a_1, b_1) \cdot \ldots \cdot e(a_n, b_n) = 1$ On the other hand, all on-chain operations cost gas, so it is important to minimise the number of $a_n, b_n$ elements, as well as group operations on said elements, particularly curve point addition and multiplication. Furthermore, we want to avoid performing these operations on G2 group elements entirely. Unlike curve operations in G1, which can be done using [EIP-196](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-196.md) precompiled contracts, those for G2 have to be implemented in Solidity, and this increases code complexity and steepens gas costs. As such, to achieve gas-efficiency and simplicity, we have to perform some algebra on the above equations. To begin this process, here is a legend to its mathematical symbols: | Symbol | Description | |-|-| | $e$ | The pairing function. | | $w_i$ or $g^{\psi_i(\alpha)}$ | The proof, which is also associated with the `_index`. | | $g$ | The generator of either G1 or G2. In the expression $e(g, P)$, $g$ is the generator of G1. In $e(P, g)$, $g$ is the generator of G2. | | | $g^\alpha$ | The generator $g$ (either G1 or G2) raised to the first power of tau. In other words, this is the *second* value from the trusted setup's TauG1 or TauG2 outputs. (The first is simply $g^{\alpha ^ 0} = g^{1} = g$.). | | $g^{\alpha(x)}$ or $g^\alpha$ | The KZG commitment to the polynomial with coefficients `[0, 1]` which is $(1)x^1 - (0)x^0 = x$ | $g^{i}$ or $g ^{1} \cdot i$| The KZG commitment to the polynomial with coefficients `[_index]` which is $ix^0 = i$ | | $\phi(x)$ |The committed polynomial. | | $\phi(i)$ | This is `_value`, which is the evaluation of the committed polynomial at the x-value `_index`. | | $\psi_i(\alpha)$ | The polynomial $\frac{\phi(x) - \phi(i)}{x-i}$, also known as the quotient polynomial. | Next, recall some [fundamental properties of elliptic curve pairings](https://blog.statebox.org/elliptic-curve-pairings-213131769fac): **[a]**: $e(P, Q)^{x} = e(x \cdot P, Q) = e(P, x\cdot Q)$ **[b]**: $e(x \cdot P, y \cdot Q) = e(y \cdot P, x \cdot Q)$ **[c]**: $e(P + S, Q) = e(P, Q) \cdot e(S, Q)$ **[d]**: $e(P, Q + R) = e(P, Q) \cdot e(P, R)$ **Now, simplify this equation from the original paper:** $e(g^{\psi_i(\alpha)}, g^{\alpha - i}) \cdot e(g, g)^{\phi(i)} = e(C, g)$ **Subsitute $C$ with $g^{\phi(x)}$ and flip sides:** $e(g^{\phi(x)}, g) = e(g^{\psi_i(\alpha)}, g^{\alpha - i}) \cdot e(g, g)^{\phi(i)}$ **Apply [a] to shift $\phi(i)$:** $e(g^{\phi(x)}, g) = e(g^{\psi_i(\alpha)}, g^{\alpha - i}) \cdot e(\phi(i) \cdot g, g)$ **Multiply both sides by $e(\phi(i) \cdot g, g)^{-1}$:** $e(g^{\phi(x)}, g) \cdot e(\phi(i) \cdot g, g)^{-1} = e(g^{\psi_i(\alpha)}, g^{\alpha - i})$ **Apply [a] to shift $-1$:** $e(g^{\phi(x)}, g) \cdot e(-\phi(i) \cdot g, g) = e(g^{\psi_i(\alpha)}, g^{\alpha - i})$ **Apply [c] to reduce the number of pairings from 3 to 2:** $e(g^{\phi(x)}-g \cdot \phi(i), g) = e(g^{\psi_i(\alpha)}, g^{\alpha - i})$ **Substitute $g^{\alpha - i}$ with $g^\alpha \cdot g^{-i}$:** According to the original paper: $g^{\alpha - i} = \frac{g^\alpha}{g^i}$ So, $g^{\alpha - i}$ is the generator to the power of $\alpha -i$, and can also be expressed as $g^\alpha \cdot g^{-i}$. $e(g^{\phi(x)}-g \cdot \phi(i), g) = e(g^{\psi_i(\alpha)}, g^\alpha \cdot g^{-i})$ **Apply [a] to shift $\alpha - i$:** $e(g^{\phi(x)}-g \cdot \phi(i), g) = e(g^{\psi_i(\alpha)}, g)^{\alpha -i}$ $e(g^{\phi(x)}-g \cdot \phi(i), g) = e(g^{\psi_i(\alpha)}, g)^{\alpha} \cdot e(g^{\psi_i(\alpha)}, g)^{-i}$ $e(g^{\phi(x)}-g \cdot \phi(i), g) = e(\alpha \cdot g^{\psi_i(\alpha)}, g) \cdot e(-i \cdot g^{\psi_i(\alpha)}, g)$ $e(g^{\phi(x)}-g \cdot \phi(i), g) \cdot e(-i \cdot g^{\psi_i(\alpha)}, g)^{-1} = e(\alpha \cdot g^{\psi_i(\alpha)}, g)$ $e(g^{\phi(x)}-g \cdot \phi(i), g) \cdot e(i \cdot g^{\psi_i(\alpha)}, g) = e(\alpha \cdot g^{\psi_i(\alpha)}, g)$ **Apply [c] to reduce the number of pairings from 3 to 2:** $e((g^{\phi(x)}-g \cdot \phi(i)) + (i \cdot g^{\psi_i(\alpha)}), g) = e(\alpha \cdot g^{\psi_i(\alpha)}, g)$ **Divide both sides by $e(\alpha \cdot g^{\psi_i(\alpha)}, g)$ to make it EIP-197 friendly:** $e((g^{\phi(x)}-g \cdot \phi(i)) + (i \cdot g^{\psi_i(\alpha)}), g) \cdot e(\alpha \cdot g^{\psi_i(\alpha)}, g)^{-1} = 1$ **Apply [a] to shift $-1$:** $e((g^{\phi(x)}-g \cdot \phi(i)) + (i \cdot g^{\psi_i(\alpha)}), g) \cdot e(-\alpha \cdot g^{\psi_i(\alpha)}, g) = 1$ **Apply [a] to remove one G1 multiplication step:** $e((g^{\phi(x)}-g \cdot \phi(i)) + (i \cdot g^{\psi_i(\alpha)}), g) \cdot e(- g^{\psi_i(\alpha)}, \alpha \cdot g) = 1$ As a result, the verifier contract only needs to: - Perform one G1 curve point addition. - Perform one G1 curve point scalar multiplication. - Perform a pairing check with 2 pairings. The only elements from the trusted setup it must store on-chain are: - The generator of G1. - The generator of G2. - $\alpha \cdot g$ of G2, which is the generator of G2 raised to the first power of tau from the contribution file. As such, with [EIP-1108](https://eips.ethereum.org/EIPS/eip-1108) already on mainnet, the `verifyKZG()` contract function only consumes 178k gas. ## Credits Many thanks to Barry Whitehat, Kobi Gurkan, Chih-Cheng Liang, Lai Ying Tong, and Lakshman Sankar for their feedback. ## Resources [Constant-Size Commitments to Polynomials and Their Applications](https://www.iacr.org/archive/asiacrypt2010/6477178/6477178.pdf) by Kate, Zaverucha, and Goldberg. [Kate polynomial commitments](https://dankradfeist.de/ethereum/2020/06/16/kate-polynomial-commitments.html) by Dankrad Feist. [Kate-Zaverucha-Goldberg (KZG) Constant-Sized Polynomial Commitments](https://alinush.github.io/2020/05/06/kzg-polynomial-commitments.html) by Alin Tomescu. <!-- ## Problem: on-chain multi-point proof verification It is prohibitively expensive to perform multi-point proof verification on-chain because it requires multiple operations in the G2 group. To see why this is the case, we first review the steps which the original paper lays out: ![](https://hackmd.io/_uploads/ByaRR3UyP.png) In summary: 1. Given a polynomial $\phi(x)$ whose KZG commitment is $C$, and a set of indices $B$ to prove exist on $\phi(x)$, i.e. $(i_0, y_0) ... (i_{k-1}, y_{k-1})$, create an interpolation polynomial $r(x)$ such that it goes through each point. 2. Compute a zero polynomial $\prod_{i \in B}(x - i)$. 3. Compute a quotient polynomial $\psi_B(x) = \frac{\phi(x) - r(x)}{ \prod_{i \in B}(x - i)}$. 4. The multi-point proof is the KZG commitment to the quotient polynomial: $g^{\psi_B(\alpha)}$. 5. To verify the proof, perform this pairing check: $e(g^{\prod_{i \in B}(\alpha - i)}, g^{\psi_B(\alpha)}) \cdot e(g, g^{r(\alpha})) = e(C, g)$ **Alin Tomescu's method is to check that:** $e(C/g^{r(\alpha)}, g) = e(g^{\psi_B(\alpha)}, g^{\prod_{i \in B}(\alpha - i)})$ Which is equivalent to: $e(g^{\phi(\alpha)-r(\alpha)}, g) = e(g, g)^{\psi_B(\alpha) \cdot \prod_{i \in B}(\alpha - i)}$ This means that to verify a multi-point proof on-chain, we need: - $-1 \cdot g^{\phi(\alpha)-r(\alpha)}$ in G1 - $\psi_B(\alpha) \cdot \prod_{i \in B}(\alpha - i)$ in G1 Using a zk-SNARK, we can access these values on-chain and then perform the necessary pairing check. The zk-SNARK circuit would accept the following public inputs: - The indices of the values to prove - The y-values Its private inputs would be: - The coefficients to the committed polynomial $\phi(x)$. - The coefficients to the interpolation polynomial $r(x)$. - The coefficients to the quotient polynomial $\psi_B(x)$. - The coefficients to the zero polynomial $\prod_{i \in B}(\alpha - i)$. The circuit would verify that: - $\phi(x) - r(x) = \psi_B(x) \cdot \prod_{i \in B}(x - i)$ - The evaluation of $\prod_{i \in B}(\alpha - i)$ at each $i$ equals 0. Its outputs would be: - The coefficients of $g^{\phi(\alpha)-r(\alpha)}$ - $\psi_B(\alpha) \cdot \prod_{i \in B}(\alpha - i)$ in G1 It would have to perform: - One polynomial subtraction - One KZG commitment - One G1 negation - One polynomial multiplication - One polynomial comparision --- --> # Multi-point KZG proof verification in the EVM In a [previous post](https://ethresear.ch/t/a-minimum-viable-kzg-polynomial-commitment-scheme-implementation/7675), I introduced [`libkzg`](https://github.com/weijiekoh/libkzg), an implementation of the KZG polynomial commitment scheme. This library now supports multi-point proof generation, as well as on-chain verification of up to 128 points of evaluation. In this post, I will describe the new functions pertaining to multi-point proof generation and verification, discuss its implementation, and describe tradeoffs made. ## Implementation details ### Typescript functions **`genMultiProof(coefficients: Coefficient[], indices: number[] | bigint[]): MultiProof`** Generates a KZG proof to the evaluations at `indices` for the polynomial with the given coefficients. A `MultiProof` is a single G2 point. **`verifyMulti(commitment: Commitment, proof: MultiProof, indices: number[] | bigint[], values: bigint[])`** Verifies a `MultiProof` given the polynomial commitment, as well as the associated indices and evaluations. ### Solidity functions **`verifyMulti(Pairing.G1Point memory _commitment, Pairing.G2Point memory _proof, uint256[] memory _indices, uint256[] memory _values, uint256[] memory _iCoeffs, uint256[] memory _zCoeffs) ) public view returns (bool)`** The Solidity `verifyMulti` function does the same as the Typescript `verifyMulti` function, but requires two additional parameters: `_iCoeffs` and `_zCoeffs`. `_iCoeffs` should be the coefficients to a polynomial which interpolates the points denoted by `_indices` and `_values`. `_zCoeffs` is a polynomial which intersects `y=0` for each x-value in `_indices`. These polynomials are required to verify the proof. See the appendix for a more detailed explanation. The contract will ensure that `_iCoeffs` and `_zCoeffs` are valid by evaluating them at each point in `_index` and checking whether the result is a corresponding value in `_values` or 0 respectively. An alternative method is to perform polynomial interpolation in Solidity, but I have not explored that yet. Next, it will compute the KZG commitments for `_iCoeffs` and `_zCoeffs` respectively. It is able to do this as the verifier contract has 129 G1 values from the trusted setup, stored during deployment. Finally, it performs a single pairing check described in the appendix. ## Limitations The contract supports verification of up to 128 points per `verifyMulti` function call. ## Gas costs ### Deployment The contract costs about 7.3 million gas to deploy. The bulk of this comes from storing 129 G1 points (a total of 258 `uint256` values) from the trusted setup on-chain. ### Proof verification Multi-point proof verification is significantly cheaper per point than single-point proof verification as long as the number of points is greater than 1. | Points | Cost | % Savings | |-|-|-| | 1 | 193084 | -8 | | 2 | 221505 | 38 | | 3 | 250283 | 53 | | 4 | 280075 | 61 | | 5 | 310152 | 65 | | 6 | 341279 | 68 | | 7 | 372763 | 70 | | 8 | 405237 | 72 | | 9 | 438008 | 73 | | 50 | 2368081 | 73 | | 75 | 4098829 | 69 | | 100 | 6245670 | 65 | | 128 | 9145327 | 60 | ## Appendix I: the math behind multi-point proof verification The [KZG10 paper](https://www.iacr.org/archive/asiacrypt2010/6477178/6477178.pdf) describes how to evaluate a multi-point proof as such: ![](https://hackmd.io/_uploads/ByaRR3UyP.png) In summary: 1. Given a polynomial $\phi(x)$ whose KZG commitment is $C$, and a set of indices $B$ to prove exist on $\phi(x)$, i.e. $(i_0, y_0) ... (i_{k-1}, y_{k-1})$, compute an interpolation polynomial $r(x)$ such that it goes through each point. 2. Compute a zero polynomial $\prod_{i \in B}(x - i)$. 3. Compute a quotient polynomial $\psi_B(x) = \frac{\phi(x) - r(x)}{ \prod_{i \in B}(x - i)}$. 4. The multi-point proof is the KZG commitment to the quotient polynomial: $g^{\psi_B(\alpha)}$. 5. To verify the proof, perform this pairing check: $e(g^{\prod_{i \in B}(\alpha - i)}, g^{\psi_B(\alpha)}) \cdot e(g, g^{r(\alpha})) = e(C, g)$ **Multiply each side by $e(g, g^{r(\alpha}))^{-1}$ and apply [a]:** $e(g^{\prod_{i \in B}(\alpha - i)}, g^{\psi_B(\alpha)}) = e(C, g) \cdot e(g, -1 \cdot g^{r(\alpha}))$ **Apply [c]:** $e(g^{\prod_{i \in B}(\alpha - i)}, g^{\psi_B(\alpha)}) = e(C - g^{r(\alpha)}, g)$ **Make it EIP-197 friendly:** $e(g^{\prod_{i \in B}(\alpha - i)}, g^{\psi_B(\alpha)}) \cdot e(-C - g^{r(\alpha)}, g) = 1$ As such, the verifier contract function requires the following to perform a pairing check. It needs the following values: - $g^{\prod_{i \in B}(\alpha - i)}$ as a G1 point. - $g^{\psi_B(\alpha)}$ as a G2 point. - $C$ as a G1 point. - $g^{r(x)}$ as a G1 point. - The G2 generator $g$. To compute $g^{\prod_{i \in B}(\alpha - i)}$ and $g^{r(x)}$ on-chain requires: - Verification of $r(x)$ and $\prod_{i \in B}(\alpha - i)$ if they are provided as parameters; otherwise, polynomial interpolation to produce them. - Two elliptic curve multiplication operations per point. - Two elliptic curve addition operations per point. To produce $-C - g^{r(\alpha)}$, the verifier must also perform an elliptic curve addition operation in G1. ## Credits Many thanks to @barryWhiteHat, @kobigurk, @liangcc, @yingtong, and @lsankar4033 for their feedback, and @dankrad for his extremely helpful [blog post](https://dankradfeist.de/ethereum/2020/06/16/kate-polynomial-commitments.html) on the topic.

    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