After Your First Contract
Your First Contract ends with two parties, one signature rule, and a witness that lets either of them sign. The pages below are what you do next. Each one adds one idea and one use case, and each one ends on a commit you cause to be refused.
Read them in order. Each page starts its own directory, so a mistake on an
earlier page does not block the next one. When a page shows a modality
block, that block is the file model/default.modality. Replace the file
with it before the commit that follows. Formulas come from the
formula cookbook. Models come from the
model cookbook.
| You learn | You use it to | |
|---|---|---|
| 1. The commit that used to work | A rule stays | Freeze a note the parties already posted |
| 2. States, not one room | A commit has to be a step | Accept an offer only after it is made |
| 3. A move that never happens | A box: every matching step | Let members write, and membership change only together |
| 4. A finish that stays possible | Reachability | Keep a way to mark the offer done |
| 5. The rule that looks right | A box and a diamond | Require a memo before an invoice changes |
| 6. A key, not a person's name | Who signs is a posted key | Take turns |
| 7. Two of three | A threshold | Move a treasury |
| 8. Pay someone | Create, send, receive | Pay an invoice |
| 9. Too strong, then too weak | A rule can miss the request | Break a membership rule both ways, then repair it |
| 10. On the testnet | A sequenced commit | Let a stranger open the contract |
| 11. Get paid | A wallet is a contract | Receive and send MOD |
| 12. Someone else's word | A fact has to be posted | Release an escrow after delivery is attested |
| 13. Their state, in yours | A repost is a snapshot | Bind to a price they already posted |
| 14. Commit, then show | A hash, then the body | Seal terms, then open them |
| 15. The program and the invariant | A program computes | Swap, inside the pool's rules |
| 16. An agent may edit, and may not land | The rule binds the tool | Land a change only on the path |
| 17. Hand it over | Replay | Check a log you did not write |
Contract Hub, hub assets, and the JavaScript SDK are how you do the testnet and repost lessons with another person or from code.