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

QuestionAnswerHow we know
Does it run, and can a signature be made and checked with it?YesBuilt and measured on the real connectome file (section 6)
Does it scramble its input the way a hash should?Yes, on the basic testsMeasured. These tests only catch obviously broken designs
Is it secure enough to lock money?Test in progressNo one has ever tried to break it. That takes years of public attack
Does the fly brain make it stronger?Still checkingA random rewiring of the same brain mixes slightly faster (section 6)
Could it be added to existing wallets without a new vault?On paper, yesIt is one new instruction that existing scripts and programs could call (section 3)
Would Bitcoin or Solana add it as it stands?In progressAbout 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

ChainWhat gets addedWho has to agree
BitcoinOne unused tapscript opcode is given this meaning, the same way BIP-347 does for OP_CAT. Needs OP_CAT and P2MR as wellA soft fork: miners, node operators, developers
SolanaOne new syscall next to the existing hash syscalls (SHA-256, Keccak, Blake3, Poseidon). Any existing program could call itA 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.

  1. 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.
  2. 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.
  3. 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

Two things should be said plainly, because they correct the original idea:

Why use a brain's wiring at all


5. Exact definition, so anyone can reproduce it

Fingerprint of the wiring table (SHA-256): e46c2d0415f3b48796b652e711c99168b600975b8ce6202847589330432dd690

Test values:

Input (hex)FlyBrain-256 output (hex)
00 repeated 32 times9c9c5c4c92e83aad86f1820d27af63035b56ea6803ff426be41abdb19177eeb3
000102...1e1f792d36cfe1ef19145c543d3b4df4ae41edd00820ffea3f39c23adfdbd4587a09

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

Neurons158,262
Connections used2,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 reach9
Share of neurons a signal from the inputs can ever reach93.7%
Neurons with no incoming connection16,691 (10.5%)
Neurons that have the AND step (2 or more inhibitory inputs)93,707 (59%)
Output neurons that have the AND step1,247 of 1,316
Typical number of inputs per neuron / the largest6 / 2,246
Connections that also run the other way10.3%
Size of the table every node would store11.1 MB

Does it scramble?

Flip one input bit, count how much of the output changes. A good function changes half.

After roundFly wiringSame connections, randomly rewired
15.5%8.1%
246.4%49.3%
350.0%50.1%
4 to 1650% (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 acceptedYes
Same signature accepted for a different messageNo (rejected)
Time to create the key3.5 s
Time to check a signature (256 FlyBrain values)1.75 s
Time for the same 256 values with SHA-2560.00017 s
Signature size8,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

  1. Nobody qualified has attacked it. This is the big one. Until that happens for years, it is a curiosity.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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.
  8. 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

  1. Publish this definition and the table so anyone can compute the same values.
  2. Write a fast version in C or Rust and measure the true cost.
  3. Put up public challenges on weakened versions (fewer rounds) and invite people to break them. Raise or redesign based on what breaks.
  4. Get independent cryptographers to analyse it. Expect them to find problems.
  5. 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