HackMD
  • Beta
    Beta  Get a sneak peek of HackMD’s new design
    Turn on the feature preview and give us feedback.
    Go → Got it
    • Beta  Get a sneak peek of HackMD’s new design
      Beta  Get a sneak peek of HackMD’s new design
      Turn on the feature preview and give us feedback.
      Go → Got it
      • Sharing Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • More (Comment, Invitee)
      • Publishing
        Please check the box to agree to the Community Guidelines.
        Everyone on the web can find and read all notes of this public team.
        After the note is published, everyone on the web can find and read this note.
        See all published notes on profile page.
      • Commenting Enable
        Disabled Forbidden Owners Signed-in users Everyone
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
        • Everyone
      • Invitee
      • No invitee
      • Options
      • Versions and GitHub Sync
      • Transfer ownership
      • Delete this note
      • Template
      • Insert from template
      • Export
      • Dropbox
      • Google Drive Export to Google Drive
      • Gist
      • Import
      • Dropbox
      • Google Drive Import from Google Drive
      • Gist
      • Clipboard
      • Download
      • Markdown
      • HTML
      • Raw HTML
    Menu Sharing Help
    Menu
    Options
    Versions and GitHub Sync Transfer ownership Delete this note
    Export
    Dropbox Google Drive Export to Google Drive Gist
    Import
    Dropbox Google Drive Import from Google Drive Gist Clipboard
    Download
    Markdown HTML Raw HTML
    Back
    Sharing
    Sharing Link copied
    /edit
    View mode
    • Edit mode
    • View mode
    • Book mode
    • Slide mode
    Edit mode View mode Book mode Slide mode
    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
    More (Comment, Invitee)
    Publishing
    Please check the box to agree to the Community Guidelines.
    Everyone on the web can find and read all notes of this public team.
    After the note is published, everyone on the web can find and read this note.
    See all published notes on profile page.
    More (Comment, Invitee)
    Commenting Enable
    Disabled Forbidden Owners Signed-in users Everyone
    Permission
    Owners
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Invitee
    No invitee
       owned this note    owned this note      
    Published Linked with GitHub
    Like BookmarkBookmarked
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Private Asset Bridges ## Setup - Chain A with native asset of type T - Chain B with a bridged-version of asset T, that is only minted when T assets are moved to a special account (representing Chain B) on Chain A - Asset bridge from Chain A to B: move assets from A to B as well as B to A - Chain A and B both assumed to have DKG setups, e.g. Ferveo. Chains have public keys $pk_A$ and $pk_B$ respectively. - Chain A use ZCash-like system to keep track of T assets, where values are committed to homomorphically (e.g. Pedersen). - Core restriction: Chain B cannot run a client of Chain A directly, i.e. chain B cannot maintain an account on Chain A natively. Therefore, Chain A maintains a special account for outgoing funds to Chain B. - Core problem: make sure T assets of chain A does not inflate even if Chain B fail to balance. ## Sketch of a private bridge (Wei: this is my interpretation of the construction proposed by @cwgoes during Crypto retreat) - Construction hides transfer amount, but not asset type (for now) - Fix an homomorphic encryption scheme, say modified ElGamal, where $Enc_{pk}(m; r) := (g^r, pk^r \cdot g^m)$. (This could be any additive homomorphic encryption scheme.) - Chain A keeps track of encrypted balance of outstanding T-assets that is transferred to chain B, $Bal_T = Enc_{pk_A}(bal)$, which is initialized to $Enc_{pk_A}(0)$. - A private bridge transfer from A to B of amount k need to: (1) spend a note (revealing a value commitment of the form $C_1 = (g^r, h^rg^k)$), (2) add a ciphertext $C_2 = Enc_{pk_A}(k)$ to the encrypted counter $Bal_T$ homomorphically, and (3) prove that the value commitment $C_1$ and the ciphertext $C_2$ encode the same value. - A private bridge transfer from B to A of amount k: chain B tells chain A to (1) create a new note of type T with value commitment $C_1$, (2) substract $Bal_T$ with some ciphertext $C_2$, and (3) proves that $C_1$ and $C_2$ encode the same value. However, during this step, chain A needs to be convinced that chain B is not creating more asset T, i.e. the encrypted balance is always positive. Chain A runs some protocol $RangeTest(Bal_T, q)$ to verify that the encrypted balance $bal_T$ is in some range $[0, q]$. ## Open question 1: RangeTest protocol Given an ElGamal ciphertext, $C = (g^r, pk^r \cdot g^m)$, where a set of n validators hold the threshold key shares $s_1, \ldots, s_n$ for public key $pk$. We need a protocol between the validators to decide whether $m$ is in some range $[0, q]$ for some public input q, without revealing $m$ itself. Call this protocol $RangeTest(C, q)$. Validators needs to run $RangeTest(C, q)$ everytime Chain B sends T asset to Chain A. Related works: [1] [A Novel Range Test](https://eprints.qut.edu.au/24581/8/A_Novel_Range_Test.pdf) [2] [An Efficient and Verifiable Solution to the Millionaire Problem](https://eprints.qut.edu.au/24573/1/An_Efficient_and_Verifiable_Solution_to_the_Millionaire_Problem.pdf) [3] [Efficient Zero-Knowledge Argument for Correctness of a Shuffle](https://link.springer.com/content/pdf/10.1007/978-3-642-29011-4_17.pdf) [4] [Mix-nets from homomorphic signatures](https://eprint.iacr.org/2019/547.pdf) [4] [MPC "bit decomposition"](https://www.iacr.org/archive/tcc2006/38760286/38760286.pdf) ### Range Test from [1] Peng et al. proposed a range test, which *does not* actually work! ### Sketch of protocol (adapted from [1]): We fix an additive homomorphic encryption scheme. Encryption is denoted $Enc(m)$ where $m \in Z_p$. Every encryption is assumed to use independent randomness. The set of validators together has the ability to decrypt, which is denoted as $Dec(C)$ for a ciphertext $C$. Multiplication of ciphertext is denoted by $C \cdot C'$ (which for ElGamal is done component-wise). Additive homomorphism of the scheme requires that $$Dec(C \cdot C') = Dec(C) + Dec(C') \mod p \; .$$ We first consider a zero test protocol. ```=pseudocode // A protocol between the set of validators ZeroTest(Z): // test whether Dec(Z) is 0 without revealing the exact message Step 1. Samples r from Z_p^* and set Z = Z^r, broadcast new Z Step 2. Repeat step 1 for at least threshold number of times Step 3. Return true iff Dec(Z) is 0 ``` Step 1 above might require some proof of correctness from validators, but this could simply be an EQDL proof. **TODO**: Design a more efficient protocol to achieve the same functionality in less rounds. Next, consider a function `GenC1E1`, parameterized by a distribution D over Z_p, that samples two ciphertexts. Looking ahead, we would want an MPC that simulates `GenC1E1` without revealing the internal values of m1 and encryption randomness. ```=pseudocode // GenC1E1 is a function that returns two ciphertexts // Parameter D is a distribution over Z_p, GenC1E1(): Sample m1 from distribution D Set C1 = Enc(m1), E1 = Enc(m1 % q) Return C1, E1 ``` Finally, we can now consider the RangeTest protocol. ```=pseudocode // A protocol between the set of validators RangeTest(C, q): // test whether Dec(C) ∈ [0, q] Run "Threshold MPC" to simulate GenC1E1(D) to obtain C1, E1 Set C2 = C / C1 Threshold decrypt m2 = Dec(C2) Compute E2 = Enc(m2 % q) Compute Z1 = E1 * E2 / (C1 * C2) Compute Z2 = E1 * E2 / (C1 * C2 * Enc(q)) Return ZeroTest(Z1) or ZeroTest(Z2) ``` **Claim**: the above protocol always return `True` when $Dec(C) \in [-1, q-1]$. Moreover, if the above protocol return `True` then $Dec(C) \in [-q, 2q-2]$. #### On distribution D If we are using Paillier encryption, then we can pick D to be uniform over $Z_p$. However, we cannot do this in case of ElGamal. The reason is that computation of Dec(C2) could be hard in case of ElGamal. To make this feasible, we need to restrict the distribution D so that decryption of C2 can be bruteforced. The consequence is that $m2 = m - m1 \mod p$ leaks information about $m$. We would need to pick distribution D carefully so that (1) decryption of C2 is not too hard and (2) information leakage of $m$ is minimized. When brutefoce decryption of `C2` fails, the protocol should return `False` denoting that the encrypted value is not in range. ## Open question 2: Dealing with key updates Ferveo periodically updates the chain public key. This means that encrypted balances need to be updated every time the chain public key is changed. This re-encryption should be done without decryption. Suppose the master secret $sk$ is updated to $sk'$, then an encrypted balance $Bal = (C_0, C_1)$ needs to be updated to $(C_0, C_1')$ where $C_1' = C_1 \cdot (C_0)^{sk^{-1} \cdot sk'}$. Note that the imtermediate value $C_0^{sk^{-1}}$ cannot be revealed. This should be feasible with existing MPC techniques. ## Open question 3: Hiding Asset Type The above sketch requires revealing the asset type being transferred, as the validators needs to access the encrypted balance associated with a particular type of asset. Can we design a protocol that also hide which asset type is being transferred? Potential approach: each transfer modify all encrypted balances for all assets. The transfer initiator needs to prove that all modifications are trivial besides the one corresponding to the note being burnt.

    Import from clipboard

    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 lost their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template is not available.


    Upgrade

    All
    • All
    • Team
    No template found.

    Create custom template


    Upgrade

    Delete template

    Do you really want to delete this template?

    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

    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

    Tutorials

    Book Mode Tutorial

    Slide Mode Tutorial

    YAML Metadata

    Contacts

    Facebook

    Twitter

    Feedback

    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

    Versions and GitHub Sync

    Sign in to link this note to GitHub Learn more
    This note is not linked with GitHub Learn more
     
    Add badge Pull Push GitHub Link Settings
    Upgrade now

    Version named by    

    More Less
    • Edit
    • Delete

    Note content is identical to the latest version.
    Compare with
      Choose a version
      No search result
      Version not found

    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. Learn more

         Sign in to GitHub

        HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.

        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
        Available push count

        Upgrade

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Upgrade

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully