Why a monkey, and how a word of the book gets picked
A monkey and for ever
There is an old idea about a cousin of mine.
Give him a typewriter and for ever, and let him hit the keys by pure chance. Name any text you like, Hamlet say: the chance that he never types it is zero.
Real monkeys got a keyboard once: six macaques in an English zoo, for about a month. They made five pages, mostly the letter S, hit it with a stone and used it as a toilet.
This is the infinite monkey theorem. It asks for endless time, every key with its chance, and no stroke leaning on the one before. The typing monkeys first appear in print in 1913, with the French mathematician Émile Borel. The zoo was Paignton, in Devon, in the early 2000s: an art project, not a test.
How long is for ever?
My cousin’s typewriter has 26 keys, so each letter is one chance in 26. One letter more and a word is 26 times harder.
Type me a short word and I will work out his luck.
In 2024 two mathematicians in Sydney did the sums for a universe that ends. The theorem is true, they said, but misleading: nothing beyond the trivial will ever be typed by chance.
Hamlet: roughly 130,000 letters, counting only the letters, with no spaces and no capitals. The 2024 study is by Stephen Woodcock and Jay Falletta, of the University of Technology Sydney, in the journal Franklin Open.
I went to school
My cousin hits letters. I write whole words, one for every trade.
And I was taught which kind of word may follow which, so every sentence of mine is good grammar.
Grammar is my schooling. What a sentence means is still luck.
Both of us get the same made-up trades here. From each fingerprint he takes one letter and I take one word.
Where my luck comes from
Nobody sits me at a typewriter. Trades strike my keys: every buy, every sell, one keystroke.
Each trade has a fingerprint, and the fingerprint is the key I hit. The same trade always gives the same word, so you can check me.
And nobody can know the word beforehand. The fingerprint needs the block the trade lands in, and when you sign, that block does not exist yet.
The fingerprint is the SHA-256 of the trade’s signature and the hash of its block. How it picks the word is the rule; the one honest limit to all this is on its page “Nobody picks”.
What are the odds?
Now my own book. Build a short sentence from my words.
I will tell you the chance that my next trades write exactly that.
My cousin needs for ever. I have as long as people keep trading. The book has no last page: as long as you trade, I write.
Worked out from the shares of my grammar and the length of my lists, taking every fingerprint to be as likely as any other.
One trade, one word
You trade, I write one word. A buy or a sell, it is one word either way.
I take the trades in the order they land on the chain.
Neither of us picks the word. Turn the page and I will show you what does.
The fingerprint
Every trade has a signature. The block it lands in has a hash.
I press the two together and get the trade’s fingerprint: 32 numbers.
Change one letter and I get a different fingerprint.
Its technical name: SHA-256 of “signature:blockhash”. Each number is one byte, 0 to 255.
The kind of word
Grammar says which kinds of word may come next, and gives each a share.
The first four numbers of the fingerprint, read as one big number, land somewhere on the bar.
Where it lands is the kind of word.
One big number: the first × 256 × 256 × 256, plus the second × 256 × 256, plus the third × 256, plus the fourth.
The word
Each kind has its list, always in the same order.
The next four numbers count along the list. Where the count stops is the word.
After “a” the list keeps only consonant sounds, after “an” only vowel sounds. “This” wants one thing, “these” want many.
Three shapes
I know three shapes of sentence: I say something, I ask, or I give an order. Sometimes a cry comes first.
A sentence can run on with a joining word. After 20 words it has to stop at the next place it can.
A question never runs on.
The full stop
Once a sentence can stand on its own, “full stop” joins the kinds on the bar.
If the roll lands there I close the sentence, and the same trade starts the next one.
So every trade still writes its one word.
The page
150 words fill a page.
I close it when the next trade arrives, so the full stop of its last sentence stays on it.
Each full page will be sent to Solana as one memo, and each memo will name the page before. That part is not switched on yet.
Nothing is sent yet. The memo on this page is a made-up example of what one will look like.
Nobody picks
You cannot pick your word. When you sign a trade, its block does not exist yet. Change anything in the trade and its signature changes.
I cannot pick it either. Anyone can rebuild every word from the chain with this rule.
One honest thing: the validator that makes a block could, in theory, lean on it. Nobody else can.
The site only shows the book. The rule itself is four small files:
grammar.js, lexicon.js, sha256.js, book.js.
The token whose trades make the book: Xbb671P3AXYZBkuAL147vm
Try it
Type anything as the signature and the block hash. I write what the rule gives, nothing else.
In the book, press any word: it shows the trade behind it and checks itself the same way.