Garvit Khatri
    • 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
    # 4337 Compatible wallet app ## Abstract We are moving closer towards the finalisation of [EIP-4337](https://eips.ethereum.org/EIPS/eip-4337). A lot of effort by the core team has been put into designing the contracts, mempool, DOS protections etc. But the team haven't had time to properly support UserOps through one of the browser extension wallets. In this cohort, I intend to work on making a user-facing wallet which can then pave the way forward for the wallets in the Ethereum ecosystem. The larger goal is to test the eip enough and make it ready for everyday use. Once we get AAs into everyday use we can then easily work towards the depreciation of EOAs from the ecosystem. ## Objectives With this wallet I intend to achieve the following objectives: - Ability to create a SCW - Recover a SCW - Support for sending transactions - Expose API for Dapps to attach custom paymaster - Ability to add user specified paymaster - API to batch multiple transactions together - Social recovery - Ability to pause an account - Define Spending limits Areas to research - How to support multiple SCW implementations Work for future - Explore other recovery methods - zk ## Contents 1. [Onboarding a User](#Onboarding-a-user) a. [Create a SCW](#Create-a-SCW) b. [Recover a SCW](#Recover-a-SCW) 3. [Guardians](#Guardians) a. [Adding a gaurdian](#Adding-a-gaurdian) b. [Removing a gaurdian](#Removing-a-gaurdian) 4. [RPC exposed](#RPC-exposed) 4. [Technical terms](#Technical-terms) ## Onboarding a user The user when they launch the extension for the first time, they will be presented with the below options: 1. [Create a Smart contract wallet (SCW)](#Create-a-SCW) 2. [Recover a SCW](#Recover-a-SCW) ### Create a SCW The user will be given a couple of options while creating a new wallet 1. Create a new wallet 2. Create a new wallet from hardware key The above two options will decide if we are creating a new local private key or are we using the priate key provided by the hardware wallet. Once the selection is complete, the following process is followed for every wallet that is created: 1. We [create a private key](#Create-a-private-key) or use hardware private key. 2. User is asked to enter a password. The password will be used to unlock the chrome extension wallet for a [session](#Sessions). 3. The private key is [stored in the local storage](#Storing-private-key-locally) & will be used as the owner to generate the [counter-factual address](#Counter-factual-address) of the SCW. The salt (index) used to generate the default counter-factual address will be `0`. 4. The user will then be asked to add guardians (These will be used to recover the address later on). If the user choose not to add the guardians right now, then there will be a constant warning on the extension warning the user that they will not be able to recover the wallet. [Read here](#Add-a-gaurdian) to know more about how to add guardians. Whenever a user creates adds a new wallet we repeat the flow above. That means for every new wallet created, we will be creating a new private key or requesting a new private key from the hardware wallet. This is mostly to make things consistent with the current user flow. ### Recover a SCW There are going to be few ways to recover a SCW. 1. Recover using hardware wallet 2. Recover using guardians 3. Recover using other device #### Recover using hardware wallet This will be a simpler workflow, where the user would enter the address of their SCW that they want to recover. Upon adding the SCW address, they would connect their SCW & choose a key to use to recover (in case there are multiple keys) We will be creating a new private key & setting it as additional owner once the hardware key has been used to recover the wallet. This is so that user doesn't have to connect hardware wallets for every transaction from SCW. Read the role of multiple owners & defining spending limits [here](#spending-limits). #### Recover using guardians User would be asked to enter the SCW addess that they want to recover. Upon entering the SCW, we will create a private key internally & generate a message with the corresponding public key. This message will then be signed by the guardians and then sent to the wallet for the creation of the new owner. To make the whole process smoother, we can add support to connect the guardians with wallet connect. We can the call the `personal_sign` RPC method for the signing. This though assumes that the gaurdian is online & available right now. It would be good to have a way to send email to gaurdian & they could sign the message using their wallet with a click & send it back. There needs to be more work in this area. `TODO:// Define the exact recovery user flow` #### Recover using device Since every device that can access the SCW has it's own private key. These can also be used as guardians and used to recover the wallet on a new device. It will behave similar to recovery using guardians. `TODO:// How many devices will be required to gain access?` ## Guardians Garudians are the addresses that can help in the recovery of a wallet. A wallet with no guardians can never be recovered unless the user has access to the private key of the owner of the SCW. Hence a user MUST add guardians. Gaurdian could be a hardware wallet, a friend, another device. ### Adding a gaurdian A gaurdian can be any of the following: - Hardware wallet - Another device with the same SCW - A friend Minimum number of guardians that will be required to recover a wallet would be 2. ### Removing a gaurdian We need to check this because is the stolen key is used to remove a gaurdian it can have disasterous outcomnes, `TODO:// What is the most efficient way to remove a gaurdian` ## RPC exposed `TODO:// List down the RPC that will be exposed for the Dapps to interact with wallet.` ## Technical terms Below are the technical delails of the terms mentioned above in the user flow. #### Create a private key The process of creating a private key will be describing here. The first though is to use `ethers.Wallet.createRandom`. there would be an advanced setting to change it if the user wants. #### Storing private key locally `TODO:// Add how we will store the private key locally in a secure way` #### Counter factual address A counter factual deployer will be deployed on all the chains. The deployer will deploy a proxy to our wallet in using `Create2`. Proxy is used to manage future upgradability of the SCW. #### Sessions A session is defined as an active state of the wallet. Once a session is active the user doens't need to enter the password to access the chrome extension. The length of a session is defined as 20 minutes. The start time of the session is reset with the last active time. This means that the password will only be asked after 20 minutes of inactivity of wallet. In-activity is defined as a blur state of the chrome-extension's popup window.

    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