ERC-4337 Development Blog
    • 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 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

    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
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    --- title: ERC-4337 Progress report #1 --- # ERC-4337 Progress report #1 ###### Thursday, July 21, 2022 Hello everyone. It has been two weeks since the previous post, and we are glad to announce a major improvement to the ERC-4337 that will be crucial for adoption of Account Abstraction, especially for Layer 2 networks: adding support for Aggregated Signatures. The core benefit of signature aggregation is that instead of passing and verifying a signature for each individual UserOperation in a bunde, we only need to pass a single signature that verifies the entire bundle of UserOperations. If this verification passes, it means that all signatures in a batch were in fact valid, and if there was a single invalid signature in a batch the aggregated signature verification will fail as well. This way we save a lot of crucial calldata size, which is the major part of trasnaction cost for L2 networks. Signature aggregation promises a great savings in both calldata and, eventually, execution gas, and going from "Account Abstraction gives you more flexibility but costs a little bit more gas" to "Account Abstraction gives you more flexibility AND saves you gas" will help us eventually overtake the EOAs. This operation, however, requires some off-chain work to aggregate those signatures and a special entity on-chain to validate such a signature for all operations. If you want to learn more, a good place to start is to watch the `BLS aggregation by Vitalik Buterin and Justin Drake` talk here: {%youtube DpV0Hh9YajU %} [YouTube](https://www.youtube.com/watch?v=DpV0Hh9YajU) Note 1: While the desing is generic enough to support any signature scheme we did use BLS for our main target and terminology. Note 2: Currently, the gas cost of verifying an aggregated BLS signature on-chain on the Ethereum mainnet is still higher than the cost of having individual `ecrecover` for each UserOp. It may never be worth doing on the Mainnet or maybe will require some new precompiles to be financially viable. ## TL;DR If you or your Wallet users are happy with the cost-to-benefit ratio of staying on the Ethereum Mainnet running an `ecrecover` for each UserOp you will not be affected by this change. If your Wallet users are ready to leave ECDSA and EOAs in the past and want to try out BLS signatures, the ERC-4337 is now ready to help! ## Deep dive into the changes *Please feel free to skip this section - it got a little too long and boring. You have been warned.* :smiley: Previously, the ERC-4337 declared the Wallet contracts to be the only ones responsible for doing two things EOAs get from the protocol: checking user signature and providing replay protection (nonce). This approach, however, does not allow the Wallet to delegate signature verification to a third party, which is necessary if we want to verify a signature only once for an etire batch. Now, a new entity is introduced: ## 1. Aggregator - a smart contract whose tasks are to: 1. Combine an array of individual signatures into a single aggregated signature. ``` function aggregateSignatures( bytes[] calldata signaturesForAggregation ) external view returns ( bytes memory aggregatedSignature ); ``` 2. Verify an aggregated signature to be a valid one over an array of UserOperations. ``` function validateSignatures( UserOperation[] calldata userOps, bytes calldata signature ) external view; ``` 3. Verify an individual signature to be a valid one over a singe UserOperation. Alternatively, it provides a data the Bundler needs to perform the verification in native code. 4. Provide the Bundler with all the data that it or the Wallet may need to know about the verified signature. #### Off-chain computation The tasks #3 and #4 are done in a single method: ``` function validateUserOpSignature( UserOperation calldata userOp, bool offChainSigCheck ) external view returns ( bytes memory sigForUserOp, bytes memory sigForAggregation, bytes memory offChainSigInfo ); ``` Notice how tasks #1, #3 and #4 are actions that do not happen on-chain and are only called as a view call. However, these operations may be computationally intensive. It is important to allow Bundlers to run computationally intensive operations natively, outside the EVM, so we made some effort to keep those separable from the rest of the Aggregator interface. The `validateUserOpSignature` method is executed as part of the `EntryPoint::validateUserOpSignature()` so it is executed for every UserOp in the mempool on every block construction run. Running it in the EVM may not be feasible for some signature schemes. This method has two modes of operation: performing the actual signature verification in the EVM (`offChainSigCheck=false`) or in the native code of the Bundler (`offChainSigCheck=true`). #### Notes on offChainSigInfo and sigForUserOp Note that there is no defined interface between the Wallet and the Aggregator. Different implementations of the ERC-4337 may have arbitrary interactions between these components. The returned `offChainSigInfo` value is the only way to pass the Public Keys from the Wallet to the Bundler for native code signature verification. The returned `sigForUserOp` value is the only way for the Aggregator to pass an arbitrary message to the Wallet about the signature it has verified. It is a bytes array that will be passed as `UserOp.signature` to the Wallet. It must be signed if it containes a sensitive information. ## 2. Wallet must verify EntryPoint and Aggregator addresses Previously, the UserOp always contained the signature that only the Wallet would check. This meant there was a limited trust between the Wallet and the EntryPoint. Now, if the Wallet supports aggregation, it will delegate the signature check entirely. Malicious Aggregator can take over the Wallet. The `_validateSignature` parameters include the address of the Aggregator used to verify this particular UserOp: ``` function _validateSignature( UserOperation calldata userOp, bytes32 requestId, >>> address aggregator <<< ) internal virtual view; ``` ## 3. EntryPoint runs aggregated signature verification loop The EntryPoint still iterates over UserOps to verify them by calling to their Wallet's `validateUserOp` and Paymaster's `validatePaymasterUserOp`, and later executes the UserOps in a bundle in the second iteration. However, the UserOps that use an Aggregator don't do any signature validation in their `validateUserOp`. Instead, before executing any UserOps the EntryPoint that iterates over the `aggregators` array and calls their `validateSignatures` method. The entire bundle will revert in case the signature is invalid. The EntryPoint supports mixing multiple Aggregators and Wallets without an Aggregator in a single bundle. All the UserOps using the same Aggregator need to be placed next to each other in the `ops` array. The ones without an Aggregator come last. The execution order of transactions can be controlled by the bundler by filling an optional `execOrder` parameter. ``` function handleOps( UserOperation[] calldata ops, address payable beneficiary, AggregatorInfo[] calldata aggregators, uint[] memory execOrder ) public; ``` ## 4. Aggregator code rules The code in the `validateUserOpSignature` has a set of rules similar to that of the Paymaster: it is not allowed to access the storage of any contract other than Aggregator itself and the Wallet it is verifying the signature for. ## 5. Desired Aggregation Algorithms Support While the algorithms with signature aggregation support are fairly new and may not have been implemented for Ethereum yet, we would love to get community feedback on this feature. Here are some of the algorithms we hope the ERC-4337 is now compatible with. Please respond if you or someone you know are working on a specification or a Solidity implementation of a signature aggreg algorithm so it can be added to our watchlist. [BLS Multi-Signatures With Public-Key Aggregation]( https://crypto.stanford.edu/~dabo/pubs/papers/BLSmultisig.html) [One-Time and Interactive Aggregate Signatures from Lattices](https://crypto.stanford.edu/~skim13/agg_ots.pdf) [Practical SNARK Aggregation](https://eprint.iacr.org/2021/529.pdf)

    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