Skip to content

Commit

Permalink
docs: Add ERC-4337 terms to the Glossary (#454)
Browse files Browse the repository at this point in the history
* Add 4337 terms to the Glossary

* Update ERC-4337 Glossary
  • Loading branch information
germartinez authored Apr 29, 2024
1 parent b4b434e commit 5c5cbab
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 6 deletions.
34 changes: 33 additions & 1 deletion pages/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ See also:
- [Account Abstraction](https://ethereum.org/en/roadmap/account-abstraction) on ethereum.org
- [ERC-4337: Account Abstraction](https://www.erc4337.io) on erc4337.io

## Bundler

Bundlers are nodes that participate in the [ERC-4337](#erc-4337) standard who bundle [user operations](#user-operation) from an alternative mempool and submit them to the blockchain. Bundlers pay for the associated transaction fees in advance, which are later refunded by the user account who proposed the user operation or by a [Paymaster](#paymaster).

See also:
- [Bundling](https://eips.ethereum.org/EIPS/eip-4337#bundling) process on ethereum.org
- [Bundlers](https://erc4337.io/docs/bundlers/introduction) on erc4337.io

## EIP-1271

The [EIP-1271](https://eips.ethereum.org/EIPS/eip-1271) is an [Ethereum Improvement Proposal](https://eips.ethereum.org) that proposes a standard way for any contract to verify whether a signature on behalf of a given contract is valid. This is possible via the implementation of a `isValidSignature(hash, signature)` function on the signing contract, which can be called to validate a signature.
Expand All @@ -25,9 +33,17 @@ The [EIP-1271](https://eips.ethereum.org/EIPS/eip-1271) is an [Ethereum Improvem

The [EIP-712](https://eips.ethereum.org/EIPS/eip-712) is an Ethereum Improvement Proposal that proposes a standard for hashing and signing of typed structured data instead of just bytestrings.

## EntryPoint

According to the [ERC-4337](#erc-4337), the EntryPoint is the singleton smart contract that processes bundles of [UserOperation](#user-operation) objects sent by the [Bundlers](#bundler). It verifies and executes them by calling the target smart accounts according to predefined rules.

See also:
- [EntryPoint](https://eips.ethereum.org/EIPS/eip-4337#entrypoint-definition) on ethereum.org
- [Bundlers](https://erc4337.io/docs/bundlers/introduction) on erc4337.io

## ERC-4337

The [ERC-4337](https://eips.ethereum.org/EIPS/eip-4337) is an [Ethereum Request for Comments](https://eips.ethereum.org/erc) that introduces a higher-layer pseudo-transaction object called `UserOperation`. Users send `UserOperation` objects into a separate mempool. A special class of actor called bundlers package up a set of these objects into a transaction making a `handleOps` call to a special contract, and that transaction then gets included in a block.
The [ERC-4337](https://eips.ethereum.org/EIPS/eip-4337) is an [Ethereum Request for Comments](https://eips.ethereum.org/erc) that introduces a higher-layer pseudo-transaction object called `UserOperation`. Users send `UserOperation` objects into a separate mempool. A special class of actor called [Bundlers](#bundler) package up a set of these objects into a transaction making a `handleOps` call to a special contract, and that transaction then gets included in a block.

See also:
- [ERC-4337 Documentation](https://www.erc4337.io) on erc4337.io
Expand Down Expand Up @@ -61,6 +77,14 @@ A Safe owner is one of the accounts that control a given Safe. Only owners can m
See also:
- [OwnerManager.sol](https://github.com/safe-global/safe-smart-account/blob/main/contracts/base/OwnerManager.sol) on github.com

## Paymaster

Paymasters are smart contracts that allow an account to pay for the gas fees of other users. This feature abstracts away the concept of gas fees by subsidizing them for users, allowing them to pay with ERC-20 tokens, and enables many other use cases.

See also:
- [Paymasters](https://eips.ethereum.org/EIPS/eip-4337#extension-paymasters) on ethereum.org
- [Paymasters](https://www.erc4337.io/docs/paymasters/introduction) on erc4337.io

## Relayer

A relayer is a third-party service acting as an intermediary between users' accounts and [blockchain networks](#network). It executes transactions on behalf of users and covers the associated execution costs, which may or may not be claimed.
Expand Down Expand Up @@ -147,6 +171,14 @@ The threshold of a Safe account is a crucial configuration element that enables
See also:
- [Get the threshold](./sdk/protocol-kit/reference.md#getthreshold) and [change the threshold](./sdk/protocol-kit/reference.md#createchangethresholdtx) of a Safe with the Safe{Core} SDK on docs.safe.global

## UserOperation

`UserOperation` objects are pseudo-transaction objects introduced by the [ERC-4337](#erc-4337) that users send to the `UserOperation` mempool. They wrap the users' transactions, and are sent to the [EntryPoint](#entrypoint) contract by [Bundlers](#bundler).

See also:
- [UserOperations](https://eips.ethereum.org/EIPS/eip-4337#useroperation) on ethereum.org
- [UserOperation mempool](https://www.erc4337.io/docs/understanding-ERC-4337/user-operation#useroperation-mempool) on erc4337.io

## Wallet

A wallet is an interface or application that gives users control over their blockchain account. Wallets allow users to sign in to applications, read their account balance, send transactions, and verify their identity.
Expand Down
4 changes: 2 additions & 2 deletions pages/home/4337-guides/permissionless-detailed.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ pnpm install viem permissionless

### Estimate the UserOperation gas

To estimate the gas limits for a `UserOperation`, we call the `estimateUserOperationGas` method from the bundler API, which receives the `userOperation` and `entryPoint` as parameters.
To estimate the gas limits for a user operation, we call the `estimateUserOperationGas` method from the bundler API, which receives the `userOperation` object and `entryPoint` as parameters.

After that, we call the `getUserOperationGasPrice` method to get the maximum gas price and add all the returned values to the `sponsoredUserOperation`.

Expand Down Expand Up @@ -804,7 +804,7 @@ pnpm install viem permissionless

{ /* <!-- vale on --> */}

To get more details about the submitted `UserOperation` copy the value of the `userOperationHash` returned, visit the [UserOp Explorer](https://jiffyscan.xyz/?network=gnosis), and paste it into the search bar.
To get more details about the submitted `UserOperation` object copy the value of the `userOperationHash` returned, visit the [UserOp Explorer](https://jiffyscan.xyz/?network=gnosis), and paste it into the search bar.

Lastly, to get more details about the transaction, we can get the receipt of the `sponsoredUserOperation`, get the `transactionHash`, and check the transaction details in the [Gnosis Chain block explorer](https://gnosisscan.io).

Expand Down
2 changes: 1 addition & 1 deletion pages/home/4337-overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import CustomCard from '../../components/CustomCard'

[ERC-4337](../glossary.md#erc-4337) addresses the challenges associated with account abstraction without requiring changes to the consensus-layer protocol. It serves as a transaction relayer for smart accounts like Safe. It does so by introducing a pseudo-transaction object called a `UserOperation`, which sends a transaction on behalf of the user.

Nodes in Ethereum can act as a Bundler, which picks up multiple `UserOperation`(s) and packs them into a single transaction known as a bundle transaction. The bundle transactions are then sent to a global smart contract on Ethereum (of which there is only one) called the `EntryPoint`.
Nodes in Ethereum can act as a Bundler, which picks up multiple user operations and packs them into a single transaction known as a bundle transaction. The bundle transactions are then sent to a global smart contract on Ethereum (of which there is only one) called the `EntryPoint`.

``` mermaid
---
Expand Down
4 changes: 2 additions & 2 deletions pages/home/4337-safe.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ It implements the ERC-4337 interface, including the functions to validate and ex

### UserOperation validation

The Safe Proxy contract receives a call to the `validateUserOp` function from the `EntryPoint` and forwards it to the `Safe4337Module`. The module validates the `UserOperation` by checking that the Safe owner(s) signed the `UserOperation` hash and returns the result. It also executes a module transaction to pay the fees back.
The Safe Proxy contract receives a call to the `validateUserOp` function from the `EntryPoint` and forwards it to the `Safe4337Module`. The module validates the `UserOperation` object by checking that the Safe owner(s) signed the `UserOperation` hash and returns the result. It also executes a module transaction to pay the fees back.

![diagram validate userop](../../assets/diagram-4337-validate.png)

### UserOperation execution

After successful validation, the `EntryPoint` calls the `executeUserOp` function, forwarding it again to the module, which executes a module transaction with the target and data specified in the `UserOperation`.
After successful validation, the `EntryPoint` calls the `executeUserOp` function, forwarding it again to the module, which executes a module transaction with the target and data specified in the `UserOperation` object.

![diagram execute userop](../../assets/diagram-4337-execute.png)

0 comments on commit 5c5cbab

Please sign in to comment.