The name does most of the damage
Two words, both wrong. It is not a contract in the legal sense, because nothing in it binds anybody and nothing in it knows what anybody intended. It is not smart, because it does exactly what it was written to do and has no opinion about whether that is sensible. Say both of those out loud before anything else, because almost every disappointment in this area is somebody taking the name at face value.
★ What you walk out with tonight. One sentence for the mechanism: code stored in the register, which every participant runs against the same inputs and therefore agrees on the output of. One requirement that explains the rest: same inputs, same output, on every machine. And three limits stated plainly enough to say to somebody selling you the idea.
LiveWithout the hype4 min▶
A rule is filed in the register the same way an entry about a consignment is filed. It is hashed with everything else, it is linked to what came before it, and anybody holding a copy can see which version of it is there. When something happens that the rule cares about, every participant runs the rule against the register they hold. Because they hold the same register and run the same rule, they produce the same output, and there is nothing left to argue about.
That is the whole of it. The interesting property is not that code runs, which is unremarkable. It is that a rule nobody can quietly swap out produces a result nobody has to take on trust, because everybody computed it themselves.
Tokens, dapps and the wider stack built on top of this idea belong to learn-web3-with-phoebe, and none of the mechanism tonight depends on any of it.
Self-studyThe words that will keep coming back4 min▶
- Deterministic. Same inputs, same output, every time, on every machine. The single requirement the whole design is built around.
- State. What the rule is allowed to read: the register, and nothing else.
- Oracle. Whatever puts outside information into the register so a rule can react to it. A person typing, or a sensor reporting. Session a5.
- Append only. A rule adds entries. It does not replace them, so a rule that behaved wrongly leaves its wrong output in place.
- Immutability. The property that makes an old entry trustworthy, and the same property that makes a mistake permanent.
- Code is the agreement. The position that what the rule does is what was agreed, with no appeal above it. Part 4, argued both ways.
- Upgradeability. Whatever arrangement lets a filed rule be replaced later. Every such arrangement gives somebody the power to change the rule, which is the thing filing it was meant to prevent.
Code in the register, run by everybody
12 min liveNothing about the storage is special. The rule is an entry. What is special is what happens next: every participant runs it for themselves, rather than asking anybody what the answer was.
LiveWhy everybody running it is the point3 min▶
Ordinary automation runs in one place and reports its answer. Everyone downstream believes the report, because checking would mean holding the same data and the same code, which they do not. The report is a trust relationship wearing the clothes of a computation.
Here the computation is repeated by everybody who cares. There is no report to believe. A participant who thinks the output is wrong recomputes it, and either they are wrong or the others are, and the disagreement is settled by arithmetic rather than by seniority.
Self-studyWhat the rule is allowed to see3 min▶
A rule reads the register and nothing else. That is not a restriction somebody added for safety, it is the only thing every participant demonstrably holds in common. Anything outside it is something one machine has and another does not, and the moment a rule depends on such a thing the participants stop agreeing.
The practical consequence is that any fact the rule needs must already be an entry. Somebody has to have written it down first, which is where Part 3 starts.
One requirement, and the strangeness follows from it
8 min liveMost lists of rules about writing these programs read as arbitrary. They are not. Every one of them is the same requirement applied to a different temptation: every machine must reach the same result from the same inputs, or the agreement that made the whole thing worth doing collapses.
LiveRandomness is the sharpest case3 min▶
A rule that needs to pick something at random cannot simply draw a number, because every participant would draw a different one and the register would fork into as many versions as there are participants. Anything used as randomness has to be a value they all already hold, which means it is not secret from anybody who holds the register, including whoever stands to gain from the outcome.
That is a genuinely hard problem, and it is hard for a reason that is now obvious rather than mysterious: shared and unpredictable are close to opposites when everybody has the same copy.
Self-studyTime, which people assume is free3 min▶
A rule cannot ask what time it is. Each participant's clock says something slightly different, and slightly different is enough. What a rule can use is a value recorded in the register, which is a claim somebody made about the time rather than the time itself.
So a deadline enforced by such a rule is enforced against a written claim, not against the world. That is a smaller thing than it sounds like when somebody says the deadline is enforced automatically, and it is the same shape as the limit in Part 3.
Three things it does not guarantee
10 min liveThese are the session. Each one is assumed by somebody buying this idea, none of them is delivered by it, and all three failures verify perfectly clean, because from inside the system nothing has gone wrong.
LiveA bug is as permanent as a feature4 min▶
Take the property that makes an old entry trustworthy and apply it to a rule. Nobody can change the rule after the fact, which is exactly what you wanted when you imagined somebody tampering with it. It is exactly what you did not want the moment you notice the rule says intact where it should have said broken.
The mechanism draws no distinction between those two cases, because a distinction would require knowing what was intended, and that is precisely the thing it has no access to. Correctness has to be bought before filing, with review and testing, by the ordinary unglamorous means. There is no arrangement that keeps a rule beyond reach and also lets you fix it.
LiveThe oracle problem, with money or goods attached4 min▶
Session a5 established that whatever a register knows about the world, a person or a sensor put there, at unchanged trustworthiness. A rule that reacts automatically makes that limit sharper rather than softer. Before, a false entry sat in a register and somebody might notice before acting on it. Now the entry is the action: write the sentence and the consignment moves.
So automation raises the value of lying at the point of entry, and every defence against that is in the physical world. Two signatures instead of one, a photograph hashed alongside the entry, a second sensor that would have to fail in the same direction at the same moment. None of them is a chain technique.
Self-studyWhat happens when nobody intended the result4 min▶
Suppose a rule does something every party agrees was not what they meant. The register holds a valid output, produced correctly by a rule everybody ran. There is no error to report and nothing to verify differently. The question of what should happen now is a question the chain has no answer to, and never claimed to.
It goes where such questions went before: to whatever written agreement exists outside the register, to whoever has jurisdiction over the parties, and to what the parties are willing to do voluntarily. Any organisation relying on automatic rules should know which of those it would be reaching for, before it needs one.
Code is the agreement: feature, or bug
6 min liveThis one is not settled and is not going to be settled here. It is worth knowing both readings well enough to state either, because which one the person opposite you holds will predict most of what else they think.
Self-studyThe escape hatch that eats itself4 min▶
The obvious compromise is to file the rule and keep a way to replace it if it turns out wrong. Notice what that does. Whoever holds the power to replace the rule now holds the power to decide outcomes, which is the position the arrangement was built to remove. Participants are back to trusting a party, and the rule is a strong default rather than a guarantee.
That is not an argument against it. Plenty of operations would rather have a strong default with a named owner than an unstoppable rule. It is an argument for saying which one you have bought, because the two are sold with the same vocabulary and they are not the same product.
The Harbourgate seal rule, traced
6 min liveTake the rule seriously and follow it end to end. Two entries of the Harbourgate register are already the input and the output: block 2 records the inspection, block 4 records the release. The question is what putting a rule between them buys, and what it leaves exactly where it was.
...
LiveTwo ways the same sentence can be false3 min▶
Press the second button and the inspection line is changed after the fact. Verification reports a mismatch at that block immediately, which is the case the structure was built for and it handles it loudly.
Now consider the other case. The false line was filed at the time, by the person entitled to file it. Nothing to detect, nothing to report, and the rule runs on it. The register is in perfect health and the consignment is gone. Only one of these two is a chain problem, and it is the less likely one.
Write the rule, file the inputs, find the step nobody can check
13 min hands onConsole open on this page. Nothing here executes the rule, and nothing pretends to. You write the rule as deterministic pseudocode, file the entries it would read using the real engine, verify them, and then say out loud which step the structure cannot support.
Check the hash first
Run CHAIN.selfTest().ok. Four seconds, and everything below is worth nothing without it.
Write the rule so two strangers get the same answer
Rewrite the pseudocode above for a rule of your own. Then hand it to somebody and ask them to find an input on which the two of you would disagree. Every disagreement they find is a place the rule reached outside the register.
Hunt your own non-determinism
Go back through your rule and mark every point where you wanted a time, a lookup, or a choice. Write beside each one what a second machine would have got instead. Three is a normal score.
File the inputs as ordinary entries
Build the chain above and confirm verify(chain).ok is true. Note that the rule itself is entry 1 and is hashed and linked exactly like the consignment lines around it. There is nothing special about how it is stored.
Name the step nobody can verify
Five entries. Point at the one whose truth cannot be established from inside the register, and say who would have to be trusted for it instead. Then say what you would put in place around that person, given that no amount of chain helps.
Break it the easy way and the hard way
Run the tamper line and read what verify reports. Then describe, in one sentence, the version of the same falsehood that verification would never report, and which of the two you would actually expect to face.
Write the bug you would not be able to fix
Take one rule your organisation runs today and invert a single condition in it. Write what would happen for a week. Then write what you would do if that rule could not be edited, only appended to.
The habit to keep. When somebody says a rule runs automatically on a register, ask two questions. What does it read, and who wrote that. The first answer tells you whether it can be agreed on. The second tells you what it is actually worth.
Three questions
Why can a rule of this kind not ask the network for a value while it is running?
Every restriction of this kind comes from one requirement: same inputs, same output, on every machine. A value that is not already in the register is not shared, and anything not shared cannot be agreed. Speed is not the issue and storage is not the issue.
A rule releases a consignment when an inspection entry records the seal intact. The inspector never opened the door and filed the entry anyway. What does the system report?
Nothing has gone wrong from inside the system. The entry was filed by somebody entitled to file it, the rule read it and did what it was written to do, and verification has nothing to object to. This is the oracle problem from session a5 with a consignment attached to the outcome.
Which statement about "the code is the agreement" is honest?
The two camps agree completely about what the mechanism does and disagree about how much a missing escape hatch costs, which depends on how often the letter and the intent come apart in your own operation. That is an empirical question about you, not a question about chains.
Homework
Twenty minutes, on one rule your organisation already runs without a human deciding each time.
Write down what it reads
List every input that rule depends on, and beside each one write who or what produced it. Circle any input that came from a person typing or a sensor reporting. Those are the ones automation makes more valuable to falsify.
Write down what you would do if it could not be changed
Assume the rule is filed permanently and can only be added to, never edited. Say in two sentences how you would handle the week it turns out to be wrong. Bring both answers to session 10, where the engine runs end to end.
What this session covers
learn-web3-with-phoebe.