Skip to content

DavideRezzoli/ERC-4337_DifferentSignatures

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

ERC-4337 Simulation README

Overview

This project simulates the behavior of transaction bundling and inclusion fees in an ERC-4337-like environment using the cadCAD simulation framework. The goal is to understand how different parameters, such as bundle size and inclusion fees, affect the performance and earnings of transaction bundlers. In this second simulation, we added two different signature types and allowed each bundler to accept a specific type of signature. We also improved the posted price calculation. This project is part of the ROP-7 initiative. For more details, refer to the ROP-7 page.

This project is a continuation of the work started in the Simulations_ERC4337 repository, focusing specifically on simulations involving different signature types.

Prerequisites

Before running the simulations, ensure you have the following libraries installed:

  • numpy
  • pandas
  • cadCAD
  • matplotlib

Similarities with the Old Simulation

The simulation initializes with an empty mempool, a base fee, and specific bundle sizes. It tracks the transactions and earnings of various bundlers, each with distinct inclusion fee requirements.

State Variables

  • mempool: List of unprocessed transactions.
  • base_fee: Fixed base fee for transactions.
  • bundle_size: Maximum number of transactions a bundler can handle.
  • bundlers: Dictionary of bundlers with their respective inclusion fee requirements.
  • bundler_transactions: Tracks the number of transactions each bundler accepts.
  • bundler_earnings: Tracks the earnings of each bundler.

Transaction Generation

Transactions are generated randomly, with inclusion fees ranging between 0.3 and 2.5. Transactions are added to the mempool if they do not already exist.

Transaction Allocation

Transactions are allocated to bundlers based on their inclusion fees and the bundler's capacity. Allocation follows specific rules:

  • Inclusion fee < 0.5: Not added to any bundler.
  • 0.5 ≤ fee < 1: Added to Bundler A.
  • 1 ≤ fee < 1.5: Added to Bundler A or B.
  • 1.5 ≤ fee < 2: Added to Bundler A, B, or C.
  • fee ≥ 2: Added to any bundler.

Simulation Execution

The simulation runs for 500 timesteps, skipping the initial step where the mempool is empty. Each step involves generating new transactions, allocating them to bundlers, and updating the state.

Differences with the Old Simulations

  • Different Signature Types: This simulation includes handling of different transaction signature types (e.g., Schnoor, BLS).
  • Improved State Update: The state update functions provide more accurate and efficient processing.

Example Results

Simulations demonstrate various scenarios:

  • Small bundle size with a lower number of transactions.
  • Larger bundle sizes with higher transaction volumes.
  • Effects of varying inclusion fees on bundler performance and earnings.

Visualization

The simulation results include:

  • Number of transactions per bundler over time.
  • Earnings of each bundler over time.
  • Total allocated transactions vs. transactions remaining in the mempool.

Conclusion

By running these simulations, you can gain insights into how different parameters influence transaction processing in an ERC-4337-like environment. Experimenting with different configurations can help optimize bundler strategies and improve overall efficiency.

Link to Other Repo

For the old simulations please refer to the following repository: ERC-4337 Simulations.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages