Perform "Astral Projection" on the EVM.
This repository accompanies the Part 1 guide on building a local MEV simulation engine. It demonstrates how to simulate complex arbitrage trades locally using eth_call and Phantom Deployments.
📖 Read the full guide on Substack: Ghost Trading: How to Haunt the EVM for Risk-Free Arbitrage
Most arbitrage bots rely on standard math (
The Solution: Instead of deploying a contract to test a trade (expensive), or trusting the Router (risky), we perform a Phantom Deployment.
- We compile our Arbitrage logic (
PhantomOut.sol). - We construct a deployment transaction but send it via
eth_call. - The node executes the constructor, runs the swap logic, and returns the result without ever touching the blockchain state.
Zero Gas. Zero Risk.
- Bun: High-performance TypeScript runtime (faster than Node).
- Foundry: For writing and compiling the high-performance Solidity logic.
- Ethers.js: For interacting with the local/remote Reth node.
Ensure you have Bun and Foundry installed.
# Install Bun
curl -fsSL [https://bun.sh/install](https://bun.sh/install) | bash
# Install Foundry
curl -L [https://foundry.paradigm.xyz](https://foundry.paradigm.xyz) | bash
foundryup
### Install Dependencies
```bash
bun install
```shell
forge build