Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

License

NotificationsYou must be signed in to change notification settings

eth-infinitism/account-abstraction

Repository files navigation

This repository contains the tools and resources for working withERC-4337 Account Abstraction smart contracts. This includes the code for the singletonEntryPoint contract that is deployed by our team on most EVM-compatible networks.

Overview

Account abstraction allows users to interact with Ethereum using smart contract wallets instead of EOAs, without compromising decentralization, providing benefits like:

  • Social recovery
  • Batched transactions
  • Sponsored transactions (gas abstraction)
  • Signature abstraction
  • Advanced authorization logic

Repository Structure

Core Components

  • EntryPoint Contract (contracts/core/EntryPoint.sol): The central contract that processes UserOperations
  • BaseAccount (contracts/core/BaseAccount.sol): Base implementation for smart contract accounts
  • BasePaymaster (contracts/core/BasePaymaster.sol): Helper class for creating a paymaster
  • StakeManager (contracts/core/StakeManager.sol): Manages deposits and stakes for accounts and paymasters
  • NonceManager (contracts/core/NonceManager.sol): Handles nonce management for accounts
  • UserOperationLib (contracts/core/UserOperationLib.sol): Utilities for working with UserOperations
  • Helpers (contracts/core/Helpers.sol): Common constants and helper functions

Sample Implementations

  • SimpleAccount (contracts/accounts/SimpleAccount.sol): Basic implementation of an ERC-4337 account

  • Simple7702Account (contracts/accounts/Simple7702Account.sol): A minimal account to be used with EIP-7702 (for batching) and ERC-4337 (for gas sponsoring)

  • SimpleAccountFactory (contracts/accounts/SimpleAccountFactory.sol): A sample factory contract for SimpleAccount

Developer setup

Installation

Clone the repository:

git clone https://github.com/eth-infinitism/account-abstraction.gitcd account-abstractionyarn install

Compilation:

yarn compile

Testing:

yarntest

Entrypoint Deployment

The EntryPoint contract is the central hub for processing UserOperations. It:

  • Validates UserOperations
  • Handles account creation (if needed)
  • Executes the requested operations
  • Manages gas payments and refunds

The EntryPoint is deployed by using

hardhat deploy --network {net}

EntryPoint v0.8 is always deployed at address0x4337084d9e255ff0702461cf8895ce9e3b5ff108

This repository also includes a number of audited base classes and utilities that can simplify the development of AA related contracts.

Usage

For projects integrating the library

If you are building a project that uses account abstraction and want to integrate our contracts:

yarn add @account-abstraction/contracts

For Paymaster development

import"@account-abstraction/contracts/core/BasePaymaster.sol";contractMyCustomPaymasterisBasePaymaster {/// implement your gas payment logic herefunction _validatePaymasterUserOp(        PackedUserOperationcalldatauserOp,bytes32userOpHash,uint256maxCost    )internalvirtualoverridereturns (bytesmemorycontext,uint256validationData) {        context= “”;// specify “context” if needed in postOp call.        validationData=_packValidationData(false,            validUntil,            validAfter        );    }}

For Smart Contract Account development

import"@account-abstraction/contracts/core/BaseAccount.sol";contract MyAccount is BaseAccount {    /// implement your authentication logic herefunction_validateSignature(PackedUserOperation calldata userOp, bytes32 userOpHash)    internal override virtual returns (uint256 validationData) {        // UserOpHash can be generated using eth_signTypedData_v4if (owner!= ECDSA.recover(userOpHash, userOp.signature))return SIG_VALIDATION_FAILED;return SIG_VALIDATION_SUCCESS;    }}

Resources


[8]ページ先頭

©2009-2025 Movatter.jp