OP_FLYBRAIN
A one-way function wired like a fruit fly brain, offered as one optional instruction for existing chains
Status: prototype, 3 December 2026.
1. Would it work? The short answer
| Question | Answer | How we know |
|---|---|---|
| Does it run, and can a signature be made and checked with it? | Yes | Built and measured on the real connectome file (section 6) |
| Does it scramble its input the way a hash should? | Yes, on the basic tests | Measured. These tests only catch obviously broken designs |
| Is it secure enough to lock money? | Test in progress | No one has ever tried to break it. That takes years of public attack |
| Does the fly brain make it stronger? | Still checking | A random rewiring of the same brain mixes slightly faster (section 6) |
| Could it be added to existing wallets without a new vault? | On paper, yes | It is one new instruction that existing scripts and programs could call (section 3) |
| Would Bitcoin or Solana add it as it stands? | In progress | About 10,000 times slower than SHA-256, an 11 MB table every node must store, and no security review (section 7) |
So: it works as a machine, it is unproven as a lock, and it only becomes real if the parties agree and cryptographers fail to break it first. That is the honest version of "works on paper".
2. Why this idea fits the current conversation at all
The OP_CAT argument going around is this: if Bitcoin scripts could glue pieces of data together (OP_CAT, BIP-347) and coins could be locked to a script with no ordinary key behind it (P2MR, BIP-360), then any user could lock their own coins with a hash-based signature instead of today's elliptic-curve signature. The known recipe for this is Jeremy Rubin's 2021 write-up "Quantum Proof Bitcoin With Just CAT".
Hash-based signatures (Lamport 1979, Winternitz) are the most conservative kind there is. They need only one ingredient: a one-way function, meaning something easy to run forward and practically impossible to run backward. There is no elliptic curve and no lattice in them. That matters this week because the lattice-based schemes are the ones under discussion after the papers reported on 30 November 2026. Hash-based signatures are not touched by that work.
Today the one-way function in those scripts would be SHA-256 or HASH160, which Bitcoin already has.
Our proposal changes one thing only: it offers a second one-way function, built from the wiring of a fly brain, that a script may use instead of, or next to, SHA-256.
3. The proposal
One instruction
OP_FLYBRAIN takes the top item on the stack, which must be exactly 32 bytes, and replaces it with its 32-byte FlyBrain-256 value. That is all it does. It is used exactly where a script uses OP_SHA256 today.
Proving one secret:
<secret> OP_FLYBRAIN <published value> OP_EQUALVERIFY
A hash-based signature is a few hundred of those lines, one per bit (or per group of bits) of what is being signed. OP_CAT does the gluing, as in the existing recipe.
The "second lock" use
The only serious reason to want a second one-way function is insurance: if one is ever broken, the other still holds. The script demands two different secrets, one under each function:
<secret A> OP_SHA256 <published A> OP_EQUALVERIFY
<secret B> OP_FLYBRAIN <published B> OP_EQUALVERIFY
A thief would have to break both. (It must be two different secrets. The same secret under both functions would be only as strong as the weaker one.)
What each chain would have to agree to
| Chain | What gets added | Who has to agree |
|---|---|---|
| Bitcoin | One unused tapscript opcode is given this meaning, the same way BIP-347 does for OP_CAT. Needs OP_CAT and P2MR as well | A soft fork: miners, node operators, developers |
| Solana | One new syscall next to the existing hash syscalls (SHA-256, Keccak, Blake3, Poseidon). Any existing program could call it | A feature activation by validators |
In both cases every node must carry the same wiring table (11.1 MB) and the rule must name it by its fingerprint (section 5) so that nobody can swap the wiring.
4. How FlyBrain-256 works
It uses the wiring diagram of the fly connectome already used in this project: which neuron connects to which, and whether each connection excites or inhibits. Nothing is simulated and nothing is random. The same input always gives the same output on any computer.
- Load. The 256 input bits are placed on the 16,557 sensory neurons, the cells where signals enter a real fly. Every other neuron starts at 0.
- Mix, 32 rounds. In each round every neuron updates from the neurons wired into it:
- its excitatory inputs are combined with XOR,
- its inhibitory inputs are split into two groups, each combined with XOR, and the two results are combined with AND,
- a fixed public constant is added so the rounds differ.
- Read. The output is read off the 1,316 descending neurons, the cells that carry commands from a real fly's brain to its body, folded down to 256 bits.
In one line:
new[j] = old[j] XOR (excitatory inputs) XOR ((inhibitory group 1) AND (inhibitory group 2)) XOR constant
What is "fly" about it, and what is not
- From the fly: the 2,406,105 connections, their direction, and their sign (excite or inhibit); where the input goes in and where the output comes out.
- Not from the fly: the XOR and AND rule. Real neurons add up their inputs and fire past a threshold. That rule is easy to run backward, so it is useless for a lock. We kept the fly's wiring and used a standard kind of mixing rule on top of it.
Two things should be said plainly, because they correct the original idea:
- The security cannot come from the brain being unpredictable. The wiring is public and has to be, or nobody could check a signature. In any lock of this kind the only secret is the user's own random number.
- So this is not "a fly brain guarding your coins". It is a fly's wiring diagram used as the layout of a mixing machine.
Why use a brain's wiring at all
- There is real theory nearby. Oded Goldreich proposed in 2000 ("Candidate One-Way Functions Based on Expander Graphs") that a simple rule applied over a sparse, well-connected graph may be one-way. That proposal is still studied. Ours has the same shape, with the graph taken from nature instead of chosen at random.
- Nobody designed the wiring, so nobody could have hidden a back door in it. Cryptographers call this a "nothing up my sleeve" choice. This is only true of the wiring. The mixing rule, the constants and the round count were chosen by us.
- Name note: "FlyHash" already exists (Dasgupta, Stevens, Navlakha, 2017). It is a similarity-search trick, not a cryptographic hash, and has nothing to do with this.
5. Exact definition, so anyone can reproduce it
- Neurons are numbered in order of their ID in the dataset. Connections between the same two neurons are merged into one. Self-connections are dropped.
- Connections are sorted by target, then by source. A neuron's inhibitory inputs are split alternately into group 1 and group 2 in that order.
- Input bit
igoes to every sensory neuron whose position among the sensory neurons isimodulo 256. Output bitiis the XOR of every descending neuron whose position isimodulo 256. - Round constants come from a fixed public formula (splitmix64 of the neuron number, bit
tfor roundt). - 32 rounds.
Fingerprint of the wiring table (SHA-256): e46c2d0415f3b48796b652e711c99168b600975b8ce6202847589330432dd690
Test values:
| Input (hex) | FlyBrain-256 output (hex) |
|---|---|
00 repeated 32 times | 9c9c5c4c92e83aad86f1820d27af63035b56ea6803ff426be41abdb19177eeb3 |
000102...1e1f | 792d36cfe1ef19145c543d3b4df4ae41edd00820ffea3f39c23adfdbd4587a09 |
The working code is flybrain256.py. It was checked against a second version written as plain loops, one neuron at a time, and the two agree.
6. What was measured
Everything below was run on this project's real connectome file, not estimated. Raw numbers are in test-results.json.
The wiring
| Neurons | 158,262 |
| Connections used | 2,406,105 (1,585,933 excitatory, 820,172 inhibitory) |
| Input neurons (sensory) | 16,557 |
| Output neurons (descending) | 1,316 |
| Hops for a signal to spread from the inputs to everything it can reach | 9 |
| Share of neurons a signal from the inputs can ever reach | 93.7% |
| Neurons with no incoming connection | 16,691 (10.5%) |
| Neurons that have the AND step (2 or more inhibitory inputs) | 93,707 (59%) |
| Output neurons that have the AND step | 1,247 of 1,316 |
| Typical number of inputs per neuron / the largest | 6 / 2,246 |
| Connections that also run the other way | 10.3% |
| Size of the table every node would store | 11.1 MB |
Does it scramble?
Flip one input bit, count how much of the output changes. A good function changes half.
| After round | Fly wiring | Same connections, randomly rewired |
|---|---|---|
| 1 | 5.5% | 8.1% |
| 2 | 46.4% | 49.3% |
| 3 | 50.0% | 50.1% |
| 4 to 16 | 50% (within 0.2) | 50% (within 0.2) |
The fly wiring gets there in 3 rounds. The random rewiring gets there in 2. So the brain's own structure is a small handicap, not an advantage. With 32 rounds the difference is covered many times over, but the claim "the fly's pattern makes it stronger" is false and the proposal does not make it.
Is the output balanced? Over 3,200 random inputs, each output bit was 1 about half the time (average 50.07%). The worst single bit was off by 2.6%, which is what pure chance gives at this sample size (2.7%). All 3,200 outputs were different.
Is the algebra complicated enough? A standard probe (a 10-bit "cube" test) gives all zeros when a function is too simple and random-looking results when it is not. It gave zeros through round 4 and random-looking results from round 5 on. This also showed that the first round does almost no real mixing, because sensory neurons are nearly all excitatory. The round count allows for that.
Why 32 rounds. Three measured minimums: 3 rounds to change half the output, 9 rounds before the algebra can reach full complexity, 9 hops to reach every reachable neuron. 32 is more than three times the largest. This is a safety margin chosen by rule of thumb, not a proof.
Does a signature work end to end?
A one-time (Lamport) signature was built using FlyBrain-256 as its only one-way function: 512 throwaway secrets, 512 published values, then sign and check.
| Correct signature accepted | Yes |
| Same signature accepted for a different message | No (rejected) |
| Time to create the key | 3.5 s |
| Time to check a signature (256 FlyBrain values) | 1.75 s |
| Time for the same 256 values with SHA-256 | 0.00017 s |
| Signature size | 8,192 bytes, the same as any Lamport signature |
What these tests do and do not show
They show the function is not broken in the obvious ways and that the code does what the definition says. They do not show that it is hard to run backward. Many functions that passed tests like these were later broken by people who looked harder. Confidence in a hash function comes only from years of failed public attacks.
7. Weaknesses, stated up front
- Nobody qualified has attacked it. This is the big one. Until that happens for years, it is a curiosity.
- The fly adds no strength. Measured: random wiring mixes faster. Brain wiring is clumpy, has a few huge hubs (one neuron has 2,246 inputs while the typical one has 6), and one connection in ten is two-way. An attacker would study exactly those features.
- Parts of the machine do little. 10.5% of neurons have no input, 6.3% are never reached from the inputs, and 41% have no AND step, so they only do the easy, reversible kind of mixing.
- The hard-to-reverse step is thin. One AND per neuron per round. SHA-3 also uses a light step like this per round, but its layout was designed for the purpose and has been attacked in public for over fifteen years. Ours was laid out by evolution for flying, not for secrecy.
- Our own choices are unreviewed. How the bits are loaded, how inhibitory inputs are paired, the constants, the read-out, the 32 rounds. Each is a place to be wrong.
- It is slow and heavy. Each value takes about 77 million small steps (2.4 million connections, 32 rounds), against a few thousand for SHA-256. In this reference code it is roughly 10,000 times slower. Optimised code would close some of that gap, not most of it. Every node on a network has to re-check every transaction, so slow instructions are a way to attack the network, and they get priced very high or refused.
- It does not fix a problem SHA-256 has. Quantum computers are not known to threaten SHA-256 in the way they threaten elliptic curves. The only argument for a second function is insurance, and for insurance a chain would choose SHA-3 or BLAKE, which are already trusted.
- A dataset is not a standard. The wiring comes from one research release. The proposal pins one exact table by its fingerprint, but a consensus rule that depends on an 11 MB biology file is something no chain has ever accepted.
8. What it would take to become real
- Publish this definition and the table so anyone can compute the same values.
- Write a fast version in C or Rust and measure the true cost.
- Put up public challenges on weakened versions (fewer rounds) and invite people to break them. Raise or redesign based on what breaks.
- Get independent cryptographers to analyse it. Expect them to find problems.
- Only after years of that: write a BIP or a Solana improvement proposal.
Realistic odds of adoption: close to zero. As a piece of research, a demonstration, or the hook for a video ("the connectome as a lock"), it stands on its own and everything in it is real and reproducible.
9. Reproduce it
From the flybrain-lock-proposal folder:
python flybrain256.py
runs every test in about 70 seconds and rewrites test-results.json.
python flybrain256.py 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
prints the FlyBrain-256 value of one 32-byte input.
It reads output/full_brain_cache.npz and neurons.csv.gz from the project folder, needs only Python with numpy, uses no network, and touches no wallet or key.
10. References
- BIP-347, OP_CAT in Tapscript.
- BIP-360, Pay to Merkle Root (P2MR).
- Jeremy Rubin, "Quantum Proof Bitcoin With Just CAT", 2021.
- Leslie Lamport, "Constructing Digital Signatures from a One Way Function", 1979.
- Oded Goldreich, "Candidate One-Way Functions Based on Expander Graphs", 2000.
- Dasgupta, Stevens, Navlakha, "A neural algorithm for a fundamental computing problem", Science, 2017 (the unrelated "FlyHash").
- The wiring: the BANC connectome, v888 (158,262 neurons). Bates, Phelps, Kim, Yang, Matsliah, Ajabi, Perlman and others, "Distributed control circuits across a brain-and-cord connectome", Nature, 2026, doi:10.1038/s41586-026-10735-w. Data on Harvard Dataverse, doi:10.7910/DVN/7WTH1N, used under CC BY 4.0. Changes made here: connections between the same two neurons were merged into one, self-connections were dropped, and only the wiring and its sign are used.