Skip to content
06 / DOCS

Run it yourself

Everything needed to rebuild Parallax and repeat the measurements. The repository README has the same steps plus the design notes: github.com/Akinbola247/parallax-reactive.

1. Build and test

Requires Foundry 1.5 or later, Node 22, jq and bc.

git clone https://github.com/Akinbola247/parallax-reactive && cd parallax-reactive
git submodule update --init      # forge-std, v4-core, v4-periphery, solmate, reactive-lib-omni (pinned)
cd contracts && forge test       # unit, fuzz, v4 PoolManager and full-loop tests

2. Rehearse on forks (no funds needed)

Three anvil forks run the real Uniswap v4 and Lasna system-contract code. relay-local stands in for Reactive Network between them: it calls react() while impersonating the system contract and delivers the callback while impersonating the proxy. It is for rehearsal only and never produces reported numbers.

anvil --fork-url https://sepolia.base.org     --port 18545 &
anvil --fork-url https://sepolia.unichain.org --port 18546 &
anvil --fork-url https://lasna-rpc.rnk.dev/   --port 18547 &
# give the three wallets ETH on each fork (anvil_setBalance), then:
BASE_RPC=http://127.0.0.1:18545 UNI_RPC=http://127.0.0.1:18546 LASNA_RPC=http://127.0.0.1:18547 MIN_LREACT=0 ./scripts/deploy-all.sh
cd scripts && npm ci
PARALLAX_NETWORK=fork PARALLAX_DEPLOYMENTS=testnet npm run relay-local
PARALLAX_NETWORK=fork PARALLAX_DEPLOYMENTS=testnet npm run shock -- --ticks 200 --dir up

3. Deploy to testnet

Put three keys in a gitignored .env at the repo root. The deployer needs Base Sepolia and Unichain Sepolia ETH. deploy-all.sh converts Base Sepolia ETH to lREACT through the official faucet, or you can send Sepolia ETH to 0x9b9BB25f1A81078C544C829c5EB7822d747Cf434 (1 ETH = 100 lREACT).

# .env
DEPLOYER_PK=0x...   # deploys; funds the other two wallets
SHOCK_PK=0x...      # moves the reference price on Base Sepolia
ARB_PK=0x...        # arbitrage bot on Unichain Sepolia

./scripts/deploy-all.sh
  1. Base Sepolia: deploys pETH/pUSD, initialises a vanilla v4 pool at 3000 and adds full-range liquidity.
  2. Lasna: deploys the reactive diamond, funded at construction, subscribed to the pool's Swap events, and paused.
  3. Unichain Sepolia: deploys the facets, mines a CREATE2 salt for the hook permission bits, deploys the hook diamond, initialises the shielded and control pools, and prepays callbacks through depositTo on the callback proxy.
  4. Lasna: sets the hook as destination and unpauses.

4. Shock, arbitrage, measure

cd scripts
npm run shock -- --ticks 150 --dir up            # one shock, prints explorer links
npm run arb-bot                                  # races both Unichain pools
npm run bench -- --n 40 --label latency          # latency benchmark
npm run bench -- --n 12 --with-arb --label arb   # arbitrage race
npm run report -- --in ../data/bench-testnet-latency-latest.json   # writes LATENCY.md

5. This site

cd web && npm ci && npm run dev          # http://localhost:3210
./scripts/publish-pages.sh               # static export to the gh-pages branch

The site reads Base Sepolia and Unichain Sepolia directly from public RPC endpoints. No keys are involved. Benchmark data for Replay and the loop pages is committed in web/src/data.