Simulation modeling of the maximal extractable value in Ethereum blockchain network
Abstract
Proposed a simulation environment for modeling the phenomenon of Maximal Extractable Value (MEV) with implementation in the Python programming language using the Gymnasium library. The environment reproduces the interaction between the mempool, the block builder, the MEV extractor agent, and the automated market maker (AMM) pool of a decentralized exchange. Formally, the environment is described as an extended partially observable decision-making process in which the agent interacts with a discrete-time episodic model reflecting the sequence of transaction arrivals, block construction, and the execution of swap operations on a decentralized cryptocurrency exchange. Reinforcement learning methods are used to model the adaptive behavior of the agent, while a counterfactual evaluation approach is applied to quantitatively analyze user losses by comparing transaction execution outcomes under different ordering regimes while keeping the input conditions unchanged. The study employs a previously proposed method for mitigating the negative effects of MEV extraction based on Lamport logical timestamps. This method implements local causal transaction ordering within an individual smart contract without modifying the global consensus mechanism of the Ethereum blockchain network. To assess the practical effectiveness of this approach, three simulation scenarios are defined: a baseline scenario without systematic MEV attacks to estimate the overhead associated with the protection mechanism, a systematic sandwich-attack scenario to analyze the methods ability to reduce user losses and constrain the capabilities of the MEV extractor, and a parametric analysis scenario aimed at investigating the trade-off between the level of protection and the "cost" of its application. The obtained results show that the proposed MEV-protected ordering method can reduce user price losses caused by sandwich attacks while also affecting transaction rejection rates and the associated fee expenditures, indicating the presence of a controllable trade-off between protection effectiveness and the overhead of its use. The practical value of the work lies in the creation of a reproducible simulation environment for studying the strategic behavior of MEV agents and evaluating mechanisms for mitigating the negative effects of MEV under controlled conditions. Such an environment can be used for further security analysis of decentralized finance protocols and for the design of new transaction ordering methods.
Downloads
References
Adams, A., Chan, B. Y., Markovich, S., & Wan, X. (2024). Dont let MEV slip: The costs of swapping on the Uniswap protocol. Financial Cryptography and Data Security: 28th International Conference (pp. 172-191). https://doi.org/10.48550/arXiv.2309.13648
Alharby, M., & van Moorsel, A. (2020). BlockSim: An extensible simulation tool for blockchain systems. Frontiers in Blockchain, 3, article ID 28. https://doi.org/10.3389/fbloc.2020.00028
Bartoletti, M., & Zunino, R. (2023). A theoretical basis for Blockchain Extractable Value. arXiv. https://doi.org/10.48550/arXiv.2302.02154
Bellman, R. (1957). A Markovian decision process. Journal of Mathematics and Mechanics, 6(5), 679–684. https://doi.org/10.1512/iumj.1957.6.56038
Cherkas, N. S., & Batyuk, A. Ye. (2023). Maximal extractable value (MEV) in blockchain networks and its impact on blockchain ecosystem. Ukrainian Journal of Information Technology, 5(2), 60–71. https://doi.org/10.23939/ujit2023.02.060
Cherkas, N., & Batyuk, A. (2025). Transaction ordering via Lamport logical timestamps to mitigate MEV extraction in Ethereum smart contracts. Herald of Khmelnytskyi National University. Technical Sciences, 357(5.2), 187–192. https://doi.org/10.31891/2307-5732-2025-357-83
Daian, P., Goldfeder, S., Kell, T., Li, Y., Zhao, X., Bentov, I., Breidenbach, L., & Juels, A. (2020). Flash Boys 2.0: Frontrunning in decentralized exchanges, miner extractable value, and consensus instability. In 2020 IEEE Symposium on Security and Privacy (SP) (pp. 910–927). IEEE. https://doi.org/10.1109/SP40000.2020.00040
Ethereum.org. (n.d.). Proposer-builder separation. Retrieved March 17, article ID 2026. URL: https://ethereum.org/en/roadmap/pbs/
Farama Foundation. (n.d.). Gymnasium documentation. Retrieved March 9, 2026. URL: https://gymnasium.farama.org/
Hardhat. (2026, February). Hardhat 3: Rust-powered Solidity tests. Ethereum development environment for professionals. URL: https://hardhat.org/
Huang, R. (2025). Research on optimization of cryptocurrency trading strategies based on reinforcement learning: Combining traditional machine learning and deep reinforcement learning methods. ITM Web of Conferences, 78, article ID 01001. https://doi.org/10.1051/itmconf/20257801001
Jain, S. (2026). Algorithmic predatory equilibrium: Multi-agent reinforcement learning and market manipulation in decentralized finance [Preprint]. SSRN. 27 p. https://doi.org/10.2139/ssrn.6087766
Liu, Y., Lu, Y., Nayak, K., Zhang, F., Zhang, L., & Zhao, Y. (2022). Empirical analysis of EIP-1559: Transaction fees, waiting times, and consensus security. In Proceedings of the 2022 ACM SIGSAC Conference on Computer and Communications Security (pp. 2099–2113). https://doi.org/10.1145/3548606.3559341
Mazorra, B., Reynolds, M., & Daza, V. (2022). Price of MEV: Towards a game theoretical approach to MEV. In Proceedings of the 2022 ACM CCS Workshop on Decentralized Finance and Security (pp. 11–18). https://doi.org/10.1145/3560832.3563433
Nisan, N., Roughgarden, T., Tardos, E., & Vazirani, V. V., (Eds.). (2007). Algorithmic Game Theory. Cambridge University Press, 754 p. https://doi.org/10.1017/CBO9780511800481
Roussille, H. (2024). A case study on blockchain vulnerabilities using Multi-Agent Reinforcement Learning. Cryptography and Security [cs. CR]. Doctoral dissertation, Université de Montpellier. HAL. 138 p. URL: https://theses.hal.science/tel-05101983
Schwarz-Schilling, C., Saleh, F., Thiery, T., Pan, J., Shah, N., & Monnot, B. (2023). Time is money: Strategic timing games in Proof-of-Stake protocols. arXiv. https://doi.org/10.48550/arXiv.2305.09032
Wen, E., Deng, Z., Mo, Y., Zhou, Y., & Shi, X. (2025). RL-BES: Optimizing strategies using reinforcement learning for blockchain economic security. Blockchain, 2025(1), article ID 0005. https://doi.org/10.55092/blockchain20250005
Wu, F., Thiery, T., Leonardos, S., & Ventre, C. (2024). Strategic bidding wars in on-chain auctions. In 2024 IEEE International Conference on Blockchain and Cryptocurrency (ICBC) (pp. 503–511). IEEE. https://doi.org/10.1109/ICBC59979.2024.10634354
Xu, J., Paruch, K., Cousaert, S., & Feng, Y. (2023). SoK: Decentralized exchanges (DEX) with automated market maker (AMM) protocols. ACM Computing Surveys 55(11), 1-50. https://doi.org/10.1145/3570639



