A speed benchmark replaying transactions on a Uniswap V3 pool.
scripts/setup.sh
We recommend to use an INFURA node, alchemy rate limits will timeout the first async benchmark.
Running this script will do 3 things:
- Install
foundry
, an EVM manager which is used to fork mainnet. - Install
node
dependencies - Install
Python
dependencies
-
Create a
.env
file and fill in theRPC_URL
environment variable, similar to.env.example
-
Run:
scripts/run_all.sh
You should see an output that looks something like:
➜ race git:(main) ✗ scripts/run_all.sh
RUNNING DIRECT ARCHIVE NODE REQUESTS OVER ASYNC HTTP
Loaded 58 transactions
Async HTTP archive node: 1.31 seconds
RUNNING DIRECT ARCHIVE NODE REQUESTS OVER HTTP
Loaded 58 transactions
100%|███████████████████████████████████████████| 58/58 [00:06<00:00, 9.06it/s]
HTTP archive node: 6.41 seconds
RUNNING ON ANVIL LOCAL FORK OVER HTTP WITH WEB3.PY
Could not kill process on port 7545. No process running on port.
Loaded 194 transactions
100%|█████████████████████████████████████████| 194/194 [00:06<00:00, 27.86it/s]
Web3.py HTTP Anvil: 6.97 seconds
RUNNING ON ANVIL LOCAL FORK OVER IPC WITH WEB3.PY
Process on port 7545 killed
Loaded 194 transactions
100%|█████████████████████████████████████████| 194/194 [00:06<00:00, 32.08it/s]
Web3.py IPC Anvil: 6.05 seconds