Stent
    • 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
    1
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    In the [3PP doc](https://hackmd.io/@JI2FtqawSzO-olUw-r48DQ/BJ_tSlId3) there were some problems with the way user's data was signed by the exchange. We try to solve these problems by introducing a more complicated signing technique. _(it's assumed that the above-linked document has been read)_ ## Original signing technique At a particular timestamp the exchange would, for each user, create a record of that user's balance, account ID and timestamp, sign it and send it to them via email. These are the problems with this technique: 1. **Friend attack:** this was a goal of the 3PP doc but it was not achieved. The idea was to ask the exchange for a PoL sometime in the past, making it impossible to have a friend transfer funds; but the exchange knows exactly which timestamps it is signing for it’s users, so it can preemptively do the friend attack on those timestamps. The risk of this can be reduced by having the signing frequency increased to daily or even hourly; the reasoning behind this is that a friend is less likely to lend funds if the lending has to be done 24 times a day everyday. But there is still the collusion attack where exchanges share funds between one another, and this attack is easy no matter how high the frequency of signature production is, as long as the colluding exchanges sign at different timestamps. 2. **On-demand requests of records:** users may want to request records from the exchange on-demand, but they cannot send these to the 3rd party in hopes that they will aid in the PoL effort because on-demand would imply a timestamp unique to only 1 record so the exchange would know exatcly which user will be verified when the 3rd party gives them that timestamp in a PoL request. Even if an auditor came around and requested on-demand a large set of records they would likely not ask for every user so the exchange could leave out some users from the PoL. 3. **Faking data in records:** if we try to allow auditors to come in and request signed records for multiple users the exchange could create fake data and sign that. The auditors wouldn’t know if the data it contained was correct or not unless they reached out to the users, but this means the user's identities would have to be given to the auditors. The same issue applies to users requesting records in the past: if they don’t remember what their balances should have been at the time then they cannot tell if the data has been tampered with. ## New signing technique The exchange signs every change that a user makes to their account balance. This is a more continuous approach compared to the original one, and requires a more invasive change from the exchnage's side because more data will need to be stored in the database. What exactly needs to be stored is up to the exchange but every time a user makes a change to their account a record needs to be created, signed and sent to them via email. The records should look like this: ![](https://hackmd.io/_uploads/B1N2T2fYn.png) Balance, account ID and timestamp are there same as in the original technique, but transaction count has been added. The reason for this is to deter exchanges from creating records with fake data, as will be explained below. ### PoL over an interval Because every record potentially has a different timestamp the 3rd party cannot request a single timestamp PoL from the exchange since the exchange will know exactly which user is going to be verified. The 3rd party must request an interval instead of a particular timestamp. Since an account may have multiple different balances over a particular interval existing PoL protocols have to be adjusted slightly. If we restrict ourselves to the Maxwell tree example of PoL then we can easily adjust it to fit the interval: every balance for a user in the interval is used to make up their leaf, and we make the tree 'double' by having both the min and max balances of every user bubble up to the top. Using min and max works well with the PoA because the final asset sum should be between the min and max values from the PoL. Here is an example of how a part of the tree would look: ![](https://hackmd.io/_uploads/SkI_3SZt3.png) There are a few drawbacks with this tree: - it is larger than a regular Maxwell tree - if the balances are to be hidden via Pederesen commitments then 2x more range proofs would have to be done for an inclusion proof - more data is leaked than a regular Maxwell tree; even if the balances are hidden behind Pedersen commitments the number of txs is leaked It is also possible to make the tree only use max, which means it would basically be a regular Maxwell tree but with different leaf nodes. But without a min it is difficult to judge how far off the total asset sum should be allowed to be from the max: is it 0.01%? Or maybe 1%? ### Example To see why the tx count and hashes are necessary let's look what users balances look like over some period of time. Suppose these are the balance changes for 6 users over some interval: ![](https://hackmd.io/_uploads/HJqso3gY3.png) and suppose the balances in green are those that were shared by users to the 3rd party: ![](https://hackmd.io/_uploads/rJ6xnnet2.png) The 3rd party asks the exchange to perform a PoL over an interval: ![](https://hackmd.io/_uploads/H1xdh3gt2.png) The 3rd party knows some of the balances, and can check those in the PoL returned by the exchange. The tree would look like this: ![](https://hackmd.io/_uploads/HkDtSjMK3.png) Let's see how the exchange could cheat. Suppose the records were not as described above but rather just balance, timestamp & account ID. The exchange could add fake balances of 0 into the tree to lower their min value. ![](https://hackmd.io/_uploads/ryYh_oft2.png) The exchange has added fake balance 1.2 with a value of 0, and has just changed the number of the old 1.2 to 1.3 (value stays the same). No matter how many records the 3rd party had they would not be able to catch this cheat. If we were to add tx count to the records then the exchange would get caught in this instance because the tx count of balance 1.2 changed. But tx count is not enough because the exchange can still cheat by adding 0-balances onto the end of a user's balance chain, like so: ![](https://hackmd.io/_uploads/rke2hnzY2.png) The exchange can send the real 3.2 to the user when they eventually make another tx. This case will only get caught if the user sends the 3rd party the real 3.2 but will go undetected otherwise, even if the user sends all balances after 3.2. Ideally we would like a record system that would be able to detect any kink in the chain but that will have to be explored later down the line.

    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