Both episodes, replayed millisecond by millisecond from the logged observations and reproducing the on-chain spike roots exactly. The top half is the fly: every soma at its real position from the MaleCNS reconstruction, lit as it fires. The bottom half is the pool, advancing block by block as intents arrive, get decided and fill.
The complete MaleCNS fruit-fly connectome, 166,700 neurons and 25.6 million synapses, runs as a Solidity contract. Every swap on the pool is priced by its own 100 ms brain episode. One episode burns more than 14,000,000,000 gas to execute. Gas Killer settles it on Sepolia for 406,341.
Gas Killer's unbounded profile lets a tracked contract call run under a 240 gas budget off-chain, with only the resulting state change written on-chain under an aggregate signature. To prove that end to end we picked the heaviest deterministic workload we could find: a whole animal's brain.
The MaleCNS v1.0 fly connectome, converted to a compact integer graph and uploaded to Sepolia as immutable data contracts behind a two-level directory. The same deployment pipeline that put Qwen3 weights on-chain for our LLM consumer.
0xe7c8…5641A stateless, integer-only leaky-integrate-and-fire simulator written in Solidity and Yul. It reads the connectome through STATICCALL, steps 166,700 neurons in Q24 fixed point, and is bit-for-bit identical to the Python reference across 11 pinned test vectors.
A plain x·y = k pool where every swap is an escrowed intent, and a tiny Gas Killer consumer whose only tracked function runs one brain episode per intent and writes the fee it chose.
The pool never calls the brain. The brain never touches the pool's tokens. The two are joined by a 32-byte fill word that Gas Killer's operator network writes into the policy contract after simulating the episode and agreeing on the result.
submit(). Tokens are escrowed, the intent joins a FIFO queue.settle() under the unbounded profile: rasterize the intent, run 1,000 brain steps, read out a fee. They sign the resulting storage diff.verifyAndUpdate() checks the signature and writes the fill word. Anyone calls applyUpTo(); the pool fills the swap at the fly's fee.The trader picks a side and an amount and calls submit. The pool pulls the input tokens into escrow, assigns the next id, and emits IntentSubmitted. Nothing is priced yet. Intents settle strictly in order, so nobody can jump the queue once the brain has looked at it.
A keeper reads the last settled fly state from the logs and posts a task: target FlySwapPolicy, calldata settle(prev), reference block latest. The router validates it, traces the call once under the 240 gas profile, and hands the digest to the operator quorum. The same call sent as a normal transaction would revert immediately: it needs over 14,000,000,000 gas and Sepolia allows 16,777,216.
settle STATICCALLs the pool for a storage-only observation of the head intent: side, size relative to reserves, queue depth, the 16-epoch buy/sell histogram, spot versus its moving average. The rasterizer paints that as a 160×120 retina image. The engine then integrates all 166,700 neurons for 1,000 steps of 100 µs and returns four population firing rates and a spike root. Each operator reaches the identical bytes, so each signs the identical storage diff.
Measured on the fleet's simulation node: 25 s to execute, 84 s to produce the net storage diff via the prestate tracer. Three operators plus the router finish inside the five-minute round.
The keeper broadcasts the rendered payload. verifyAndUpdate verifies the quorum signature and applies the diff: the fill word for the intent, the decided-through counter, and the chained fly state. It also replays FlyIntentDecided and FlySettled, so the observation, the readout and the spike root are all in the event log for anyone to re-simulate.
Anyone, including the trader, calls applyUpTo. The pool reads the fill word from the policy, clamps fee and skew to the safety band, computes the output on x·y = k, releases the tokens and emits Swap. If the fly's fee would breach the trader's minimum output, or the intent expired before a decision, the escrow is refunded instead.
One 32-byte slot per intent, keyed by id, is all the pool ever reads from the brain.
Intent #1's word: 0x001f0002000000010000000065250fef…4437e6 reads fee 31, skew +2, epoch 1.
The connectome is real. The retina input is engineered. We draw the state of the order book as an image on the fly's photoreceptors, let the whole brain react, and read the fee off four groups of neurons.
A 160×120 canvas rasterized fresh for each intent:
Lit pixels become input current on the photoreceptor neurons that sit at those coordinates. Intent #1 lit 244 receptors; intent #2, with history behind it, lit 408.
Leaky integrate-and-fire dynamics on every neuron, with signed synaptic weights straight from the electron-microscopy reconstruction. All arithmetic is 64-bit fixed point with round-half-up, decay tables precomputed in Q64, and a fixed iteration order, so the EVM, the C kernel and the Python reference agree bit for bit.
A 100 ms episode is 1,000 steps. Intent #1 produced 28,141 spikes; intent #2 produced 28,028. Every spike goes into a running hash, and the final 160-bit spike root lands in the fill word as a commitment anyone can check by re-running the episode.
Four population rates are measured over the episode. Their ratios map onto the fee and the directional skew through fixed, published tables. The pool then clamps: fee within 5 to 100 bps, skew within ±30 bps, and sells pay fee minus skew so the brain can lean the pool one way without ever charging outside the band.
Intent #1: rates 11,323 / 6,377 / 6,377 / 7,790 → fee 31, skew +2, buy paid 33 bps. Intent #2: 25,005 / 9,393 / 9,393 / 9,913 → fee 41, skew +9, sell paid 32 bps.
This fly does not learn, and it is not a market oracle. It is a deterministic, biologically derived controller whose outputs can be predicted by anyone willing to run the simulation. That is exactly the property Gas Killer needs: every operator must reach the same answer, and every user must be able to verify it.
What it demonstrates is scale. If an entire brain can be a tracked function, so can your risk engine, your on-chain order matching, or the invariant checks you cut because gas made them unaffordable.
Two intents were submitted, priced by the brain, settled by the operator quorum and filled. Every step is a public transaction; the observation and readout are in the logs, so the episodes can be replayed from chain data alone. The visualizer below was built that way.
| Intent | Observation | Fly decision | Settlement (verifyAndUpdate) | Fill (applyUpTo) |
|---|---|---|---|---|
| Buy #1 10 quote in 0xc09828fe…138b |
size 50 bps · queue 2 · 244 receptors lit · flat history | fee 31 · skew +2 28,141 spikes |
0xddd22cf8…8c09 406,341 gas · 3 STOREs + 2 logs · ready in ~4 min |
0x1e2f963b…5c25 paid 33 bps · out 4.958788 base |
| Sell #2 2 base in 0x2a465ed2…ef3a |
size 20 bps · queue 1 · 408 receptors lit · spot 1.0% above EMA | fee 41 · skew +9 28,028 spikes |
0xfab96cfc…b523 355,521 gas · ready in ~4 min |
0x2f33bb23…655f paid 32 bps (fee − skew) · out 4.019053 quote |
| Contract | Sepolia |
|---|---|
| FlySwapPool | 0xD9adC740c61c2362AA9649cDe79D1A20B537fa69 |
| FlySwapPolicy GK consumer | 0x474c62c9931e5a501986f6E27AC4Cc084dFf9908 |
| FlySwapRasterizer | 0x9caE2512890d5B46b5882CA25EFF78d7c24E2428 |
| FlyEngine | 0xB61fd991A4A6afAEf54404bA54DC6123d2B9E4fC |
| Connectome directory root | 0xe7c83910719ea03d80f7dd71caee4489a0a05641 |
| Warm-state directory root | 0x046b0eedf28701d257944c0c48d64ac2fc9666ac |
verifyAndUpdate on the policy. Their FlyIntentDecided log holds the observation, the four rates and the spike root.applyUpTo on the pool. Their Swap log shows the fee actually paid, which matches the policy's fill word from the transaction before it.An earlier version, FlyAMM + FlyPolicy at 0x0147…ed50, priced the pool per 25-block window with a 300 ms episode. It stays deployed; the per-swap design above replaced it because it gives every trade its own decision.
The fly is a stress test, not the product. The product is the path it took: one line of Solidity to make a function tracked, transactions redirected to the Gas Killer RPC, execution moved off-chain under a 240 gas budget, and the final state written back under an aggregate signature by a slashable operator network. If the network is unavailable your function still executes on-chain as before.