Lucas Vogelsang
    • 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
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Using Identities for on chain transactions Why talk about this now? For the new anchor scheme, we want to build an authentication scheme that doesn't rely on `msg.sender`. For this we need to be able to uniquely specify a Centrifuge ID and the key used for the signature. This is when I came up with the idea to use some of the bits we have in the uint256 and shorten Centrifuge ID instead storing two mappings. See the document on [Pre Commit & Commit](https://hackmd.io/EfvRCxSTR3C2l7-UCt7tlw?both#Signatures) ![](https://i.imgur.com/8VMmjWQ.png) https://en.wikipedia.org/wiki/Birthday_attack#Mathematics ## Proposal: ID uint256 -> ID: uint48 + uint32 (key) + EmptyRemains We picked uint256 because it was the biggest value we could easily use to store CentrifugeIDs. When picking a value at random and using it, chances of finding a collision are extremely low. A 256bit uint has 77 digits. Your brain does not work with numbers that big. Ethereum addresses are 160 bit long. I propose we use a smaller number for IDs and use the extra digits to for something useful: function (centId, key) { store centId "+" key } ``` [xxxxxxxxxxxxxxxxxxxxxx-xxxxxxxxx] [ Centrifuge ID - key id ] ``` >> If I understand this correctly, a centId will become 128bits long and what the peers will use to pass back and forth will be the ComposedId (CentId+keyId)? I am not sure I understand that yet. >> I like the idea of simplifying our storage. What do you think about the ComposedId that is passed around changing when rotating keys? And the fact that we have P2P key as well (at the moment is the same, but will want to split that up). >> I would like to know more on how it will look like in the smart contracts. [name=Miguel Hervas] > > I think we can store these separately. The composed ID would just be a way to transmit/store the comnbination of which key was used and what ID it was in a uint256 field. > You would only need to store a full id if you want to also identify which key it was that was used to sign but this is not always necessary. However it is needed when you want to efficiently verify a signature on chain because if you don't know which key it was signed with, you would have to check against every public key on the identity. [name=Lucas Vogelsang] We could shorten the cent id to use 128 bits and then use the remaining 128 bits for something else. Things we could use the additional bits for: * Keys: instead of having multiple mappings that keys are stored in, we could store keys in one mapping map[uint64 => uint256] and append the 64 bits to the cent id to indicate which key this message was signed with (or what wallet it was sent from) * Multi node: we could use additional bits to store information about what node this was sent form. This could allow us to implement smarter routing when multiple nodes are running for the same cent id. > > Multi node: In this scenario, we still need a different P2P key per node (to uniquely identify within the p2p network), that is our nodeId. Then we can add some other logic to have one node as a relay of connections by passing the destination in the payload to be routed. > > I think that node metadata should be treated separately. [name=Miguel Hervas] > > I think we can leave 64 bits "empty" for now and define the precise functionality later. I haven't thought too much about the multi node stuff. One node could act as a relay for all keys that it's serving as you mentioned but ideally we would make the resolution happen automatically (i.e. I only want to define the destination cent id not who operates the node that runs it) > When I meant multi node I didn't think of the multi-tenancy thing we are discussing but more about the scenarios where one entity might have multiple systems acting on behalf of it, one example > [name=Lucas Vogelsang] The goal should be that we make sure that everything needed to identify a signature/node etc. we could rely on a value that is never longer than 256 bits. What tare the potential advantages of this: 1) It is cost saving to only store one mapping[uint256 => xxx] instead of two separate mappings. TODO: find out exactly how much. 2) When an endpoint needs to verify a signature, it's not enough to just know the Centrifuge ID to verify it. If just an ID was given, the code would have to iterate over every key on the account to verify the signature. That would be more expensive.

    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