Sidharth Suresh
    • 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
    # NEAR Proposal Final - Draft For Web3Auth integration in the NEAR wallet adapter, we originally devised five potential flows and, the NEAR team handpicked one out of them. This document is a detailed overview of that flow. ## High-level Overview We aim to modify wallet-selector SDK so that the users can create an implicit account on their preferred wallet without writing down the seed phrase. Users can reconstruct their keys via social login and access on any compatible NEAR wallet (web/extension/native). The entry point to wallet-selector UI will always be a DApp, and once connected, DApps can directly invoke the wallet application to approve transactions. ### Definition **Dapp** - Decentralise Near Application with wallet-selector. **Wallet-Selector** - SDK that powers the UX flow in DApp. **Wallet** - Web wallet or App wallet. **Web3Auth** - Web3Auth site that reconstructs private key. **Broadcast Server** - Server that relays the message on the respective channel ### Abbreviations **FCK** - Function call key(Key with limited access assigned to DApps with a preset allowance). **FAK** - Full Access Key(A key with full access assigned to Wallets). **SDK** - Standard development kit. ## Wallet-Selector NEAR already has a wallet selector node SDK available for DApps to integrate; right now, it is only responsible for wallet discovery. At present, it supports the below-listed wallets : - NEAR Wallet - Browser wallet. - My NEAR Wallet - Browser wallet. - Sender - Injected wallet. - Math Wallet - Injected wallet. - Nightly - Injected wallet. - Meteor Wallet - Injected wallet. - Welldone Wallet - Injected wallet. - Coin98 Wallet - Injected wallet. - Neth - Injected wallet. - Ledger - Hardware wallet. - WalletConnect - Bridge wallet. - Nightly Connect - Bridge wallet. - Here Wallet - Mobile wallet. - NearFi Wallet - Mobile wallet. - Opto Wallet - Mobile wallet & Browser wallet. ### Specification for Wallet-Selector Functions: - Control the end-to-end UX. - Initialize Wallet-selector.web3auth.io context with details like login provider, wallet details, connection details, etc. - Discover and list all supported wallets (This can be crowdsourced). - List social login providers. - Facilitate DApp to wallet connection. Limitations: - Wallet-selector cannot handle key management. - Agnostic about wallet priority. ## Signup Flow ![](https://i.imgur.com/y3rOSp3.png) ### Extension: DApp to wallet connection ![](https://i.imgur.com/zPonAj9.png) 1. User clicks connect button on DApp page. 2. Wallet selector window opens up and user select social provider and wallet app from list. 3. SDK generates a random sessionID for connection and proceed to next step. 4. Request to generate FCK is attached to the connection 5. (Optional) DApp generates a connection URL if a native wallet is selected. 6. Connection is established ## Web3Auth Site Once the user selects the social provider and the wallet, Wallet-selector will redirect the user to the Web3Auth site. Web3Auth site is fully responsible for the key generation and management. ### Specification Functions: - Manage and secure the implicit account’s private key with web3auth. - Manage Full Access Keys (wallet) on implicit account - Communicate with wallet. - Dapp could have a separate client-id (different account for same OAuth login) capability. Limitations: - Signing transactions (except adding or removing FAK) Assumptions: - Wallets are trusted entities. They have full access to account. - Needs a NEAR funding source. ## Key Deliverables ### Wallet-Selector - Updated and stable wallet-selector-SDK for DApps in browser. - Wallet selector can list wallets and do wallet discovery in user’s device. - Documentation for DApps developers to integrate the wallet-selector. - Documentation for wallets to attain compatibility with wallet-selector. - A reference implementation sample for DApps. - A reference implementation sample for Wallets. - Update near provider to invoke injected wallets. <!-- - Api for redirect to web3auth with dapp details --> ### Web3Auth Site - Inject Full Access Key to the Wallet - Send dapp's details and account ID to Wallet. This step is dependant on where the wallet context live - Web + Mobile - send dapp details via bridging server or qrcode - Web + Web - send dapp details via redirect flow - Web + Chrome Extension - send dapp details via `near provider` - get public key via `near provider` and add it as FAK <br/> ### Multichain Wallet App (Edge Case) #### Problem statement Wallets which support multiple chains would like to keep that functionality intact when integrating the new `@web3auth/near-provider` SDK. There could be a discrepency with the existing web3auth SDK which can also be used directly (Check appendix for legacy flow). #### Strategy Below are some proposal strategy for multichain wallet app : - Suggested: ***Wallet will use the FAK to generate keys for other chains*** - Web3auth will return 2 keys. One is FAK for interacting with Near and another secp256k1 key for other chains. ## Appendix ### Bridging Server Server can relay messages in respective channels <!-- ![](https://i.imgur.com/yMFzhzi.png) --> ![](https://i.imgur.com/7Q7y5oZ.png) 1) ECDH connection can be establised between web3auth and the wallet. 2) Wallet in scan the web3auth epmeral public key (g.a). 3) Wallet is will derive g.a.b. 4) Wallet will post a message (connections request and g.b) for g.a. 5) Web3auth will send the implicit key on g.b.a. <br/> ### Explorations for Step 7, 8 in Sign In Flow To asign new wallet to implict account we have options below - Default - Web3auth generates a unique ID and pass the ID to wallet via new browser window's query param / qrcode or etc. - Wallet generates private key pair - Wallet post send public key, wallet name, wallet/app url via bridging server - Web3auth got the request and add public key as FAK of the implicit account - Return( or redirect) to dapp with the wallet details - Pass Private Key via ECDH / Qrcode - Web3auth generates a unique ID and pass the link to wallet via new browser window's query param / qrcode or etc. - Wallet generates private key pair - Setup ECDH between wallet and web3auth - Web3auth generates key-pair - Web3auth add private-key as Full Access Key - Web3auth send private-key to wallet via ECDH (encrypted) - Return to dapp with the wallet details <br/> ### Sign Transaction Flow - Sign Transaction is redirect to respected wallet - For app wallet, deeplink or web with qrcode (bridging server is an option like wallet connect) <br/> ### Legacy Signup The flow below changes the entry point from DApp and wallet selector and move it to wallets. Here the user installs the wallet application and generates the key with Web3Auth from wallet's UI. <!-- ![](https://i.imgur.com/gZDIKUu.png) --> <!-- ![](https://i.imgur.com/3XWe1Ff.png) --> ![](https://i.imgur.com/4ITvxdf.png) <br/> Flow : 1) Redirect to Web3Auth 2) Complete Oauth 4) Open Broadcast Channel with generated `unique id` 5) Open new window to wallet site with `unique id` -or- show qrcode of `unique id` for app wallet to scan 6) Open Broadcast Channel with `unique id` 7) Send public key to web3auth via broadcast channel 8) Send Account Id and wallet details <br /> ### Wallet integration spec Wallet responsible to generate key pair and send the public key to the bridging server endpoint - redirect flow params - `query params` - `?web3auth_channel=<channel id>&account_id=<account_id>&<dapp forwarded data>` - qrcode scan - `data` - `?web3auth_channel=<channel id>&account_id=<account_id>&<dapp forwarded data>` ### Bridge Server API Spec - POST `/channel/<unique-id>/register` body : - publicKey - string (hex) <br/> Description : API to register public key from wallet as Full Access Key on new Wallet flow. - GET `/channel/<unique-id>/transaction` Description: poll api to get pending `transaction` - POST `/channel/<unique-id>/hash` Body: - hash - string Description : Send transaction hash to web3auth which will redirect back to dapp ( for native app flow ) - POST `/channel/<unique-id>/ssr` Description: subscribe to ssr or websocket

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