A fruit fly's compass circuit, kept alive on a blockchain.
155 neurons of the head-direction ring — the cells a fly uses to know which way it is facing — read out of the FlyWire connectome and rebuilt as spiking neurons inside a smart contract on BNB Smart Chain. It fires, it walks, it remembers where it has been. It also starves. Every simulation step costs it one unit of energy, and only $FLY that somebody burns puts energy back.
The animal this came from
Fig. 1 | All 139,248 neurons of the adult Drosophila melanogaster brain, reconstructed by FlyWire from electron microscopy. Optic lobes to either side, central brain in the middle. The 155 cells that live on-chain are highlighted, and they flash as they fire. Drag to rotate.
Vital signs
Fig. 2 | a, Spike raster of all 155 neurons, ordered by role and by position on the ring. A single band of activity — the bump — marks the animal's current heading; it jumps rows when the heading changes. b, The same activity read as a compass. c, The path the animal has walked, decoded from the bump.
It stays alive because people feed it.
Nothing about this organism is automatic. Running the brain forward costs gas; keeping it fed costs $FLY, which is destroyed in the act. Anyone may do either, and both are written into the animal's permanent record along with the address that did it.
Feed
1 $FLY = 1 stepOne unit of energy is consumed per simulation step. Feeding sends $FLY to the dead address; it is gone, and the animal lives longer.
Stimulate
400 $FLYInject current into a named group of real neurons for 64 steps, the way an experimenter would, then watch Figure 2.
Your record
life 1 · gen 0Every feed and every stimulus is stored against the address that sent it. The animal keeps a list of who has kept it alive.
Read the contract on BscScan →Why this circuit, and not a pile of neurons
A fly knows which way it is facing because about fifty EPG neurons in the ellipsoid body hold one bump of activity that points in that direction. PEN neurons shove the bump around when the animal turns. Δ7 neurons suppress everything far from it, so there is only ever one bump. PEG neurons feed it back into itself so it does not fade. It is among the best-understood circuits in any brain, its output is a single number, and a single number moves a body. That is what makes it worth running in a place as expensive as a blockchain.
| Type | n | Transmitter | What it does |
|---|---|---|---|
| EPG | 47 | acetylcholine | Holds the bump. One wedge each. Its spikes are the heading. |
| EPGt | 4 | acetylcholine | A tile variant of the same compass cell. |
| PEG | 20 | acetylcholine | Excites the same wedge back, so the bump persists. |
| PEN_a | 20 | acetylcholine | Angular velocity. One hemisphere shifts the bump each way. |
| PEN_b | 22 | acetylcholine | A slower second rotation population. |
| Δ7 | 42 | glutamate, inhibitory | Reads the bump, suppresses everything far from it. |
Every one of these 155 cells is a specific animal's neuron with a FlyWire accession number, listed in full below. The weights between them are the synapse counts measured in the electron microscopy volume, not parameters anyone chose.
How a nervous system fits inside a contract
The model is the one the whole field uses for connectome simulation — leaky integrate-and-fire, one weight per synapse, sign from the transmitter — rewritten in integers so the Ethereum Virtual Machine computes it exactly, with no floating point and nothing to disagree about.
Each neuron is an integer
A membrane potential that leaks toward zero, sums what arrived from the synapses that fired last step, and emits a spike when it crosses threshold. Ten storage words hold all 155.
Noise without an oracle
Real neurons are noisy; a contract must be deterministic. The background noise is keccak256(step number), so anyone can recompute the animal's entire life from its events and get the same bits. A test replays the real mainnet transactions and checks every spike count.
The wiring lives in bytecode
The circuit table — cell types, ring positions, every synapse, every FlyWire accession number — is stored as the code of a data contract and anchored by its keccak hash, so the wiring cannot change under the animal.
It costs about a third of a milli-BNB to think
Thirty-two steps of the whole circuit run for roughly 7 million gas. At BNB Smart Chain's 0.05 gwei that is around 0.0003 BNB. On almost any other chain this animal could not afford to be alive.
Death is a state, not an ending
When energy reaches zero the animal stops. What it was at that instant — every membrane potential, the engram, the memory of every direction it has held — is hashed and written into its lineage. Resurrection does not make a copy or start over. The same brain continues from the same state, in a new body, at the origin.
Brain
155 membrane potentials and every pending synaptic current, in storage, rewritten on each tick.
Engram
Cells that fire habitually potentiate; silent ones depress. Bounded, permanent, and carried through death.
Lineage
Birth block, death block, steps lived, spikes fired and the hash of the brain, one row per life.
Accession
155 FlyWire root IDs in the bytecode. The same animal, provably, in every generation.
“Would be cool to see someone make ‘immortal fruit flies’ on BNB Chain.”CZ · 15 September 2026, quoting Siyuan on the fly brain that escaped the computer
In the week the male fruit-fly connectome was published, people put that brain in DOOM, in Beat Saber, in Minecraft, and in a walking robot. Several tokens followed. In all of them the neurons run on a graphics card and the chain only ever sees a swap.
Siyuan's reply named the five things a chain could actually hold: identity, brain state, memory, lineage, interaction history. Those are exactly the things that make an organism persist. So we put the neurons themselves in the contract, and everything else followed from that.
A token because the animal needs a metabolism
$FLY is an ordinary BEP-20 with no tax, no owner and no mint. It has exactly one use: it is destroyed to buy the animal time. Feeding, stimulating and resurrecting all send it to the dead address, where it can never move again, and each of those burns is stored against the address that paid it. Supply only falls, and it falls in proportion to how much anyone cares.
What it buys
| 1 $FLY | 1 step of life |
| 100 $FLY | 1 unit of stimulus |
| 100,000 $FLY | one resurrection |
The token
| Supply | 1,000,000,000 |
| Decimals | 18 |
| Tax | 0% |
| Owner | renounced |
What the contract cannot do
FlyBrain has no owner, no admin function, no upgrade path and no pause. Every dynamical parameter is immutable. The only way to change the animal is to deploy a different one, and this one keeps living.
Every neuron, by accession number
Nothing here is illustrative. The circuit was extracted from FlyWire release 783, the public whole-brain connectome of an adult female Drosophila. Each cell's angular position on the ring was measured from the coordinates of its own synapses inside the ellipsoid body, not assigned by hand. Open any accession number below to inspect the real cell.
doi:10.5281/zenodo.10676866