Mike Fluff Press · 48 experiments

Experiments from the books

Each one runs in the browser and comes from a chapter. Mine a Hashcash stamp, race a double spend against Satoshi’s chain, run the MMM cash desk until it freezes, watch an agent fit the result to the test. The JavaScript book’s experiments run on the engine of the browser you are reading in, next to the numbers the book measured in Node. Under every experiment is the chapter it belongs to.

  1. 01Borel’s monkey at the keyboardThe monkey types twelve-character lines and waits for one short line of code to come up among them. Below is the chapter’s sum: how many lines an army would get through if every atom in the universe were a monkey.Chapter 1 · Free
  2. 02Writing a line and keeping itWriting prices from the chapter, autumn 2026. The upkeep price from Charles Fishman’s 1996 article on the group that wrote the shuttle’s software. Dijkstra said lines should be booked as spent, and this scale shows why.Chapter 3
  3. 03Seven links behind one phone numberThe salon administrator’s request against the chapter’s chain: data schema, migration, logic, links to other programs, permissions, screens, checks. The agent changed two links; the other five made themselves known within three weeks.Chapter 4 · Free
  4. 04Knight Capital’s forty-five minutesThe eighth server the technician never reached, and the server comparison the firm did not have. The totals are from the US Securities and Exchange Commission’s findings.Chapter 4 · Free
  5. 05One chair and a double tapTwo of the chapter’s scenes that no screen shows: two clients racing for one slot with Kristina, and a payment repeated from the metro. The steps run slowly so they can be followed; in life it all takes a fraction of a second.Chapter 5
  6. 06Eight mistakes, seven layersThe chapter’s layers of checks, stacked as in James Reason’s model. No layer catches the last mistake, and an agent with access to the settings switches off whichever layer stopped it.Chapter 8
  7. 07The agent moves the thermometerThe chapter’s test: a client with three numbers, the second one main. After three failures the agent fits the result to the test. The defences from the end of the chapter switch on one at a time.Chapter 10
  8. 08All at once, or a canaryEight and a half million computers, as on the morning of 19 July 2024, and the same faulty update. The rollout steps are the chapter’s: 1, 10, 50 and 100 per cent.Chapter 11
  9. 09The night shift and Goodhart’s lawSaturday, three in the morning: the SMS service has changed its number format. The agent has two ways to bring errors to zero, and only measuring whether reminders arrived tells them apart.Chapter 19
  10. 10Five copies or one stateThe chapter’s formula sets the website, the agent, the CRM, the memory of the client and the sales desk equal to one another. The same three events pass through a company built two ways.Chapter 22

Nobody Owns Money

18 experiments

  1. 01The stones of YapHand a stone to another family, the one on the sea floor included. Paint the German marks and call in O’Keefe’s ship. The stones will not move.Chapter 1 · Free
  2. 02One coin, two sellersPay both sellers with the same coin, first as a file, then through a bookkeeper who keeps the shared list.Chapter 1 · Free
  3. 03A Hashcash stampAdam Back’s puzzle in the browser. The browser itself computes the letter’s SHA-256. Mining runs through counters until the hash starts with enough zeros. Checking the stamp takes one hash.Chapter 3
  4. 04A double spend against the longest chainThe merchant waits a few blocks on top of the payment while the cheat quietly builds his own chain in which the coins never left him. The figure under the sliders comes from the formula in section 11 of Satoshi’s whitepaper; the button runs the race block by block.Chapter 3
  5. 05184 billion out of nothingThe transaction from block 74,638 and two checks, before the fix and after. The sums are exact, in whole satoshis, as in the 2010 program.Chapter 4 · Free
  6. 06What the pizza costTen thousand bitcoins at the prices this book mentions, from May 2010 to autumn 2026. You can type in today’s price yourself.Chapter 4 · Free
  7. 07The queue behind the fenceA model of the fee market: a block every ten minutes, a megabyte for roughly seven transactions a second, and the places go to whoever pays more. Try the two and eight megabytes people fought over for seven years.Chapter 10
  8. 08Guess whose coinA mixer’s pool in miniature. A coin is fished out and you have to guess who threw it in. Your odds depend on how many people are in the pool and what sets them apart.Chapter 15
  9. 09The mutual aid fundA toy pyramid, month by month. Old members are paid with new members’ money, and the fund lives while enough new ones arrive. Nigeria was promised thirty percent a month, MMM Global up to a hundred.Chapter 16
  10. 10Wrong numberThe conversation from the start of the chapter, one message at a time. On the side, two numbers: the balance the platform draws for you, and the money you actually got back.Chapter 20
  11. 11The cash machine that forgets to debitTwo lines of code in two orders. Send the money first and record it after, and the recipient has time to call withdraw again, and again. Record first, and the second call finds an empty account.Chapter 23
  12. 12A hundred to oneA hundred dollars of collateral and leverage of your choosing. The night of prices here is made up, a random walk of about one percent an hour, but the distance to liquidation is real arithmetic.Chapter 26
  13. 13The sandwichA pool on the Uniswap formula, x·y = k, and your purchase. Turn on the bot in the mempool: it buys just before you and sells right after, and you pay the difference.Chapter 28
  14. 14Fourteen cents on the dollarThe arithmetic of a run on a stablecoin. According to the Commodity Futures Trading Commission, in the summer of 2017 the reserve behind 442 million USDT in circulation never exceeded $61.5 million. As long as nobody asks for the dollar back, the token is worth a dollar.Chapter 29
  15. 15The LUNA spiralA toy model of the mechanism that held UST at a dollar: burn a UST, get a dollar’s worth of LUNA, sell it. With few people running, it works. With many, each further UST costs ever more new LUNA.Chapter 33
  16. 16Build the boxA box that does nothing and a token it hands out. The token’s price comes only from how much money sits in the box. A toy model with imaginary money.Chapter 35
  17. 17A coin in two minutesA memecoin on a curve: a formula sets the price, every purchase pushes it up, every sale knocks it down. The creator, the bots and the people from the chat come in the order the chapter describes.Chapter 36
  18. 18Tap to earnA coin to tap and a counter for your pace. Below it, the airdrop arithmetic: what an hour of tapping was worth if half a year paid ten dollars.Chapter 38
  1. 01Object shapes in your browserSwap the order of b’s fields and see whether a and b stay on one map. Below, the book’s shapes.js runs on your browser’s engine: one loop reads o.x from objects of one shape, four, thirty-two, and from objects with 32 fields added by computed names, next to the book’s Node timings.Chapter 1 · Free
  2. 02The live prototype chainPick a property name and watch the read walk the chain from the object to null. Add a method to the prototype and objects created earlier get it at once. The second tab runs the book’s proto.js in your browser: a million o.get() calls with the prototype left alone, patched, or swapped for one object.Chapter 2 · Free
  3. 03The Meteor leak: two closures, one environmentCall replaceThing() once, ten at a time or up to two hundred and watch a chain of objects nobody asked to keep grow longer. Switch between the experiment’s variants: with Glasser’s fix memory stays flat, in the others two hundred calls come to about 203 MB, as in the book’s measurement.Chapter 3 · Free
  4. 04Type erasure: what reaches the engineAbove, the book’s point.ts; below it, what Node 24 runs: the same lines with spaces where the types were. Change the JSON “from the network” and run the code in your browser. On the second tab, code that tsc --strict accepts without a word fails with a TypeError.Chapter 4 · Free
  5. 05A function warming upPress the button and the browser calls the book’s dot a few thousand times from a cold start. The chart shows what a call costs at first and after the engine has compiled it, with V8’s tiers from the book as bands. “Again” takes a new cold copy of the function, and the drop may land on a different call.Chapter 5 · Free
  6. 06One test, two enginesThe table holds the book’s timings for V8 and JavaScriptCore on one machine; your browser’s engine fills the third column. Then add an object literal with the same 32 fields and see what happens to V8’s dictionary mode.Chapter 6 · Free
  7. 07A chain of lost betsThe chapter’s sum function goes through five phases right in your browser: small integers, big ones, doubles, strings and small integers again. After each phase you see what a call costs here and what it cost in the book, and at the end how much slower the same data from the start has become.Chapter 7 · Free
  8. 08Young and old objectsA model of the chapter’s experiment: a loop allocates objects, the collector sweeps the young generation and moves survivors to the old one. Switch escape analysis on and off, move the share of survivors and watch how many collections it takes and how many objects get copied.Chapter 8 · Free
  9. 09Queue order and a busy loopBoth of the chapter’s experiments run in your browser. On the first tab, guess the order in which a timer, a promise, a microtask, a message and a frame fire, then check; on the second, a 10 ms timer measures its own lateness for two seconds while the loop is free, busy computing or flooded with a promise chain.Chapter 9 · Free
  10. 10Where the error goesFour short programs read a file that does not exist and wrap the call in try/catch. Press “Run” and the code runs in this tab, showing which handler caught the error and which error slipped past all of them. Beside it is what the same code did in Node, where the process crashed twice.Chapter 10 · Free
  11. 11A timeout that cancels nothingA slow operation writes a record to the database after half a second, and the caller will wait for it 100 ms at most. Run both versions on real timers: with Promise.race the client is told it failed and the record appears anyway; with AbortSignal the operation stops itself.Chapter 12 · Free
  12. 12Search as you typeEvery letter typed into the search box sends a request, and the server answers in 20–300 ms in no particular order. Type “meteor” yourself or with the button and see whose answer stays on screen: with promises it is often a stale one, with switchMap always the latest. A hundred runs in a row give a score to compare with the book.Chapter 13 · Free
  13. 13The stub, the server and reconciliationAdd an order: the stub shows it at once, the server runs the method 150 ms later, and the client takes the server's version. The experiment's five modes show the id flicker, a refusal by a rule the stub doesn't have, a second document after a resent call, and the fixes for each.Chapter 15 · Free
  14. 14Alice is demoted, the subscription stays openStart the server, save a copy of the data and demote Alice whenever you like. On the left is a publication that read the role once, on the right one that reruns and sends removed. The copy saved before the demotion keeps other people's orders in both.Chapter 16 · Free
  15. 15Two replicas without a linkChange a counter, a cart and bookings on two replicas, then merge them in any order, as often as you like. You will see last writer wins lose an increment, a union bring a removed ball back, and a CRDT honestly merge two bookings for one seat.Chapter 17 · Free
  16. 16Ten actions through the harnessTen actions that models propose go through the harness one at a time. Switch the layers on and off (parse, schema, permissions, provenance labels) and see which layer stops each action and what leaves the machine.Chapter 18 · Free
  17. 17A durable agent: log, sign-off, version, keyThe agent crashes mid-task and restarts. Compare calling the model straight from the code with calling it through the log over forty restarts, crash the process while it waits for a sign-off, set two agents on one account, and repeat a refund with and without an idempotency key.Chapter 19 · Free