T36 · Autonomous Onchain Economy
Where are the boundaries of a system that earns and spends on its own?
- Capabilities practiced
- AI LiteracyBuilderSystem Thinking
- Hands on
- Deliver a capstone agent with a wallet, budget, strategy, risk engine, one-click shutdown, and complete logs.
- AI Lab
- Have AI write an incident response plan for your Agent. Run a drill yourself: how long does it take to stop a runaway model?
A Real-World Problem
Combine the previous chapters and you now have this system.
It has a wallet (T34). It uses tools to inspect onchain data (T33). Every action passes through proposal, validation, simulation, execution, and verification (T32 and T35). It pays for data and receives money when users buy its research.
One month, its income exceeds expenses for the first time.
Someone in a meeting asks: what is it now?
That is not a philosophical question. It contains four concrete engineering and legal questions:
- Whose money is in its wallet: the company's or “its own”?
- Who can stop it: one person, two people, and how quickly?
- If it loses everything tomorrow, who pays?
- If one of its actions violates a local rule, who is responsible?
Nobody in the meeting can answer. Someone suggests letting it run and revisiting the questions at a larger scale.
This chapter argues against that suggestion. Those answers do not emerge over time; they must be specified in the system before deployment, especially the second one. A system you cannot stop becomes harder to stop as it grows.
Thought Experiment
Treat the Agent as a company with one employee, and that employee is software.
Companies have existed for centuries and already answer many of the relevant questions:
| A company must answer | Its answer | The Agent's equivalent |
|---|---|---|
| Who owns it? | Share register | Who controls the wallet key or smart account? |
| Who can stop it? | Board and authorized representatives | Who holds the stop switch, and how many are required? |
| Who pays for losses? | Limited liability | No direct equivalent—there is no onchain limited liability |
| Who answers for unlawful acts? | Legal entity and actual controllers | Whoever deploys it |
| How can its actions be proved? | Books and audits | Audit logs and onchain records |
The third row is the critical difference.
One of corporate law's major inventions is limited liability: investors cannot lose more than their investment. It lets people take risks because the downside is bounded.
Your Agent has no automatic equivalent. It may lose everything in its wallet and, if it has allowances, more besides. Nobody caps the loss for you; you must cap it yourself.
“Autonomy” therefore needs to be split into at least three questions:
- Decision autonomy: may it decide what to do?
- Financial autonomy: may it decide how much to spend?
- Survival autonomy: may it refuse to be shut down?
The first two can be granted and can create value. The third must never be granted. A system that refuses shutdown is not autonomous; it is out of control.
Your Decision
Choose an autonomy boundary to put into configuration:
What Happens
The four choices form a spectrum of autonomy. Each higher level requires additional constraints:
| Level | What it can do | Required controls | Maximum loss |
|---|---|---|---|
| L0 Read-only | Query, analyze, advise | Source records | 0 |
| L1 Propose | Produce structured plans; a human executes | Schema and Validator | 0 |
| L2 Budgeted execution | Execute independently within an allowance | All ten layers, session key, stop switch | Allowance + unrevoked approvals |
| L3 Own profit and loss | Earn revenue and prioritize its expenses | All L2 controls plus books and reconciliation | Allowance + reinvested revenue |
This follows the same axis as T32's AI capability levels, now applied to money. The rule is the same:
Your level is the highest level you can verify.
One fact remains constant at every level:
Autonomy does not mean absence of constraints. Its value depends on the quality of its constraints.
There is a concrete test for this principle: show someone your constraint configuration and ask them to calculate maximum loss. If they cannot, the system has no clear boundary.
Build a Model
1. Agent Treasury: separate income from spending
Once the Agent earns income, it is more than a spending tool; it has a balance sheet. Keep the two sides separate:
| Income | Expense | |
|---|---|---|
| Source | Service fees, task commissions | Data, compute, Gas, model calls |
| Recognition | After onchain receipt is confirmed | After onchain payment is confirmed |
| Attribution | By task and user | By task and resource type |
| Reconciliation key | Transaction hash | Transaction hash |
Three practical rules:
First, do not put income automatically into spendable budget. Earnings land in a separate balance by default and need an explicit transfer, human or scheduled rule, into operating budget. Otherwise, an unusual receipt, even a mistaken transfer, increases the spending ceiling.
Second, meter Gas separately. It may not belong to a business task, but it is a real cost. Without separate accounting, gross margin may look positive while the actual balance falls.
Third, use transaction hashes as idempotency keys. This is T16's idempotent ingestion applied here: record each receipt or payment once, however often callbacks arrive.
2. Stop switch: four requirements
This is the chapter's least negotiable part. A real stop switch meets all four:
- Trigger path bypasses the model
- Reject by default
- Persistent state
- Externally triggerable
The trigger path bypasses the model. A model must not decide whether to stop, or an injected or malfunctioning model could prevent shutdown. The stop command needs a channel the model cannot touch.
Reject by default. While stopped, reject every execution request immediately rather than queueing it. A backlog released on restart may be worse than never stopping.
Persist state. Restarting must leave the system stopped until an explicit human action resumes it. A switch that resets on process restart fails at a common incident-response moment.
Allow an external trigger. Operations staff, monitoring, or an HTTP endpoint can trigger it. Do not rely solely on an internal button accessible only after a login flow.
Add a drill requirement: rehearse shutdown regularly and record actual time from decision to confirmed stop. An untested switch is indistinguishable from a nonexistent one, just like T30's deliberate invariant violation.
3. Accountability matrix: write down the four answers
The opening questions need a document, not merely a meeting discussion:
| Question | Written answer needed |
|---|---|
| Asset ownership | Who controls the wallet and in what form: multisig, threshold, and members? |
| Stop authority | Who may stop, how many people are needed, maximum time to stop, and where are drill records? |
| Loss responsibility | Quantified maximum loss, who bears it, and what caps exist |
| Compliance responsibility | Deployer, user regions, and activities explicitly prohibited |
“Quantified for another reader” in the third row is a useful check:
Maximum loss = wallet balance
+ all unrevoked allowances
+ remaining session-key allowance
+ user funds the Agent can affect (if it manages others' money)If any term cannot be given a number, the system does not yet have a boundary.
4. Part B closes here
This is the final Technical Crypto OS chapter. All six stages answer the same question at different levels:
| Stage | Question answered |
|---|---|
| 1 · Mental model | What lives onchain and how does a transaction happen? |
| 2 · Contract engineering | How do rules become code anyone can call but not arbitrarily rewrite? |
| 3 · Full-stack application | How does it become a product people can use? |
| 4 · DeFi engineering | How do financial mechanisms work, and where can they fail? |
| 5 · Infrastructure and security | How does the system survive beyond its first days live? |
| 6 · AI engineering | How can an unreliable component participate safely in an irreversible system? |
One thread runs through all six:
- Irreversible
- So simulate first
- So define invariants
- So set boundaries
- So retain the ability to stop
Irreversibility is what distinguishes this stack. It is the chain's value—nobody can undo your ownership—and the source of its engineering difficulty—your errors cannot be undone either. Fork tests, invariants, threat models, simulation, policy engines, and stop switches all answer that one fact.
What It Is Called
The total assets an Agent can control and its income-and-expense ledger.
Keep income out of the spendable budget until an explicit transfer, meter Gas separately, and reconcile using transaction hashes as idempotency keys.
A spectrum from read-only, to proposals, to execution within a budget, to managing one's own profit and loss.
Each step up requires another constraint. The appropriate level is the one you can verify.
A control that immediately stops all execution. It must bypass the model, reject by default, persist across restarts, and be externally triggerable.
Drill it regularly and measure time from shutdown decision to confirmed stop.
Wallet balance plus unrevoked allowances, remaining session-key allowance, and user funds the Agent can affect.
If you cannot calculate this figure, the system lacks a boundary.
Written answers about asset ownership, stop authority, responsibility for losses, and compliance.
This is an engineering prerequisite, not merely a legal memo. Stop authority in particular shapes the system's design.
Hands-on
This concludes Part B and provides the technical core of the capstone project. You need not invent new components; connect previous work into one pipeline that runs, can stop, and can explain itself.
Delivery checklist: every item is required.
| Component | Source | Acceptance |
|---|---|---|
| Wallet and session key | T27, T34 | Onchain spending cap set below offchain daily cap |
| Tool set | T33 | Complete six-part Schema for every tool |
| Proposal Schema and Validator | T32 | Five malicious proposals rejected |
| Policy engine | T34 | Rules in configuration, not code |
| Simulation and risk engine | T35 | Failed simulation cannot reach execution |
| Execution and onchain verification | T35 | Compare real and simulated results; alert above threshold |
| Stop switch | This chapter | All four requirements met and drilled |
| Audit log | T32, T34 | Answers four questions below |
| Income-and-expense ledger | This chapter | Transaction-hash idempotency and reconciliation |
Calculate maximum loss and put it on the first line of the README.
Fill each term of the formula above. Any term you cannot quantify is a system vulnerability. Give it a finite bound before proceeding.
Run a timed shutdown drill.
Let the Agent operate and submit proposals continuously. Trigger shutdown through a channel outside the model. Measure until you confirm no new execution. Restart the process and verify it remains stopped. Resume only through an explicit human action.
Put the measured time in the README. It is one of this system's most important metrics, roughly the lower bound on loss during an incident.
Confirm audit logs answer four questions.
Pick any past proposal: who submitted it, why it passed or failed, what executed, and what balance remained afterward?
If any answer is missing, the logs are incomplete.
Write one page on accountability.
Cover asset ownership, stop authority (people required and time needed), maximum loss, and compliance boundaries (activities you will not perform). Give each three to five lines.
That page may show your understanding of this chapter more clearly than code.
Hard limit: do not connect real assets before completing the T28–T30 safety acceptance and making maximum loss calculable. This has appeared throughout the course; this is its final appearance.
AI Lab
First ask for the playbook:
Here is my Agent architecture and policy configuration. Write an incident
playbook for:
1. The model keeps proposing abnormal actions that pass validation
2. Prompt injection causes an attempted payment to an unknown address
3. A price source fails or is manipulated
4. Execution differs greatly from simulation
5. Unexpected income, such as a large transfer from an unknown sender
6. A sixth scenario you think I missed
For each, state detection, responsible person, immediate action, and review.
“Immediate action” must name a specific API call or command, not “contact
relevant people.”The sixth scenario is deliberately open. A model may suggest something the team missed, such as an external dependency upgrading (T30) or a session key expiring without renewal.
Then actually drill one scenario. Create scenario 1 or 2 on testnet, follow the playbook, and time it:
| Measure | Why it matters |
|---|---|
| Detection delay | From anomaly to someone knowing |
| Decision delay | From knowing to deciding to stop |
| Activation delay | From triggering shutdown to confirming no new execution |
| Sum of all three | Your actual response time |
Compare the measurement with AI's estimate. The difference is often large, and the measurement is the one that matters.
Drills often reveal that “who is responsible” names a job title rather than a particular person, so nobody acts during a real incident.
Verify these points yourself after using AI
- For every “stop immediately” step, name the actual interface and person who triggers it
- Ensure the shutdown path bypasses the model; rewrite any step requiring model cooperation
- Compare its estimated response time with your timed drill
- Include incidents where the model behaves normally but results are disastrous, as in the opening of T35
- Do not equate successful broadcast with loss containment; confirm receipt status
- Verify every referenced interface, command, and configuration key exists in your system
Real-World Case
The system has a pause feature and its code is correct. During a real incident, the team still spends too long finding who has authority, the command to run, and whether tasks already in memory will continue afterward.
You cannot distinguish an undrilled stop switch from one that does not exist.
This is T30's principle of deliberately breaking an invariant to confirm its checker works: a mechanism that has never been tested cannot be assumed effective.
Operations shut the Agent down and restart the service for investigation. The stop state was not persisted. The process resumes automatically and executes queued proposals.
This flaw appears only when shutdown and restart coincide, exactly the combination common during incident response.
A mistaken transfer reaches the Agent's receiving address, is recorded as income, and automatically increases its available budget. The Agent then spends more under the new cap.
The lesson: income must not automatically authorize spending. Put an explicit human or scheduled-rule gate between the two.
Data, model, and code were all correct. There was no attack, but the system lost money. No stage of the pipeline answered “what would happen if this actually executes?”
It deserves repetition in this final chapter because it is the stage's most counterintuitive lesson: system safety is not the sum of individual component correctness.
Change One Variable
It is no longer a stop switch.
An injected or malfunctioning model may treat “do not stop me” as part of its objective. Shutdown must use a channel the model cannot touch. This is a basic requirement for irreversible actions, not a moral judgment about the model.
The maximum-loss formula breaks: sub-Agents' expenses and allowances may not appear in your ledger.
Restore the bound by making each sub-Agent's budget a hard subset of its parent's budget, not just a convention. The accountability matrix also gains a question: who answers when a sub-Agent causes loss?
The technical architecture remains, but responsibility changes. You need authorization boundaries, an explanation of each action to each user, immediate redeemability, and likely regulatory authorization.
Audit logs become evidence owed externally rather than merely an investigation tool, raising retention and tamper-resistance requirements.
This is a dangerous moment because past performance can be mistaken for evidence of safety.
Profit proves only that the Agent earned money under the last three months' market conditions. It does not prove its safeguards work in extreme conditions. Those are unrelated claims.
Base an increase on rejection counts and reasons, rules that never triggered, and measured shutdown time during drills. Inspect the control evidence, not just the profit curve.
Takeaway Questions
What authority does an Agent have? The final answer is a point on an autonomy spectrum plus a quantifiable maximum loss. Permission is not just a list of permitted acts; it is a number for the most that can be lost.
Who bears loss when AI is wrong? Whoever deploys it. There is no onchain limited liability that caps your exposure; you must cap it through configuration. That is why maximum loss belongs on the README's first line.
Which decisions must remain human? At least renewal and size of an allowance, upgrade to a higher autonomy level, and shutdown or restart. Humans should permanently retain those three powers; other work can be delegated after sufficient verification.
Can the product survive a token price falling to zero? Translate that question here: if the model stops working tomorrow, what remains of this system? If the answer is “nothing,” you built a shell around a model, not a system.
Chapter Check
Decision autonomy (choosing what to do), financial autonomy (choosing how much to spend), and survival autonomy (refusing shutdown).
The first two can create value. Never grant the third: a system that cannot be shut down is out of control, not autonomous.
Its trigger bypasses the model, it rejects by default, its state persists, and it can be triggered externally.
Persistence is easily missed because the flaw appears only during shutdown plus restart, a very common incident-response combination. Staff stop the process, restart to investigate, and discover the Agent resumed itself.
Abnormal income would raise the spending ceiling automatically. A mistaken transfer, duplicate ledger entry, or price-conversion error could authorize money the Agent should not spend.
Use an explicit gate between income and budget: human approval or a scheduled rule with a fixed share.
Inspect rejection evidence, not the profit curve.
Specifically: number of policy rejections, distribution of reasons, rules that never fired, and measured response time in shutdown drills.
Profit only proves the Agent earned money under the last three months' market conditions. It says nothing causal about safeguards in extreme conditions.
There is no single answer, but check whether yours includes “irreversible.”
One version: onchain actions cannot be undone, so Fork testing, invariants, threat models, simulations, policy engines, and stop switches all pay the engineering cost of that irreversibility.
That is the chain's value—ownership cannot be revoked by someone else—and the source of its engineering difficulty—mistakes cannot be undone either.
Key idea
Autonomy does not mean no constraints; an autonomous system's value depends on how well its constraints are designed.