Skip to content

Shchepetov/EIP-4337-Alt-Mempool

Repository files navigation

EIP-4337 Alt Mempool

This project implements the RPC service based on the protocol described in EIP-4337, with several distinctive features that set it apart from the original workflow:

⛓️ White list of auxiliary smart contract bytecodes - UserOps using Factory, Account or Paymaster, whose bytecode is on the white list are added to the mempool without checking the opcodes used during simulation. Smart contract bytecode can be manually added to the white list by the pool administrator using a special command.

⛓️ Black list of auxiliary smart contract bytecodes - UserOps using Factory, Account, or Paymaster, whose bytecode is on the blacklist, are rejected. Smart contract bytecode can be added to the blacklist manually using a special command or the bytecode is added automatically during UserOp verification when added to the mempool. When a bytecode is added to the blacklist, any UserOps using that bytecode which have already been added to the mempool will be removed.

⛓️ Zero tolerance - Within the pool, only one UserOp that uses the same bytecode, not on the white list, can be present simultaneously. The stake check described in EIP-4337 is not performed at the same time.

Supported methods:

  • eth_sendUserOperation
  • eth_estimateUserOperationGas
  • eth_getUserOperationByHash
  • eth_getUserOperationReceipt
  • eth_supportedEntryPoints
  • eth_lastUserOperations

Try out the implemented mempool on the Gnosis

You can use the mempool with the entry point located at http://shchepetov.xyz/api/:

The repository contains a simple client application ./client.py for convenient use of the remote mempool, which allows you to call all supported mempool methods.
To learn more about how to call these methods on the remote mempool, run the following command: python3 client.py --help.

Run your own mempool

Prerequisites

apt-get update && apt-get install -y sudo gnupg2 software-properties-common nodejs npm postgresql postgresql-contrib gcc python3-dev python3-pip
npm install -g ganache-cli && npm install -g solc
python3 -m pip install -r requirements.txt

This project uses the Brownie framework for testing and generating ABI of smart contracts. Before beginning work, you need to install the necessary packages and compile the smart contracts:

brownie pm install OpenZeppelin/[email protected] && brownie pm install safe-global/[email protected]
rm -r build/contracts/*.json && brownie compile

Initialize database

  1. Run the PostgreSQL service:
service postgresql start && sudo -u postgres createdb mydb
  1. Set the following environment variables:
  • DB_HOST (default is localhost)
  • DB_USER
  • DB_PASSWORD
  1. Initialize databases:
python3 manage.py initialize-db

Run the RPC server

  1. Set the RPC_ENDPOINT_URI environment variable to the external entry point of the RPC API node.

⚠️ The node must support the debug_traceCall method.

  1. Run the mempool service
python3 manage.py runserver --workers=%NUMBER_OF_WORKERS%

To get additional information about mempool administration capabilities, execute the following command: python3 manage.py --help

About

EIP-4337: Account abstraction via alt mempool

Resources

License

Stars

Watchers

Forks

Releases

No releases published