Protocol Spec
This spec covers the record types, the reference graph between them, the contract lifecycle, and the validation rules for contracts.
- Record Types
- Record Graph
- Lifecycle
- Authority & Validation
- Settlement
- VM Lifecycle Events
- Compute Types
Related docs: Trust & policy, Security & verification, Workload Identity Federation, and Gateway. See protocol/README.md and the glossary for the full reference and the code behind each rule.
Contents
- Record Types
- Record Graph
- Lifecycle
- Authority & Validation
- Settlement
- VM Lifecycle Events
- Compute Types
- References
Record Types
All records live in AT Protocol repositories, and all market NSIDs use the pre-release com.publicdomainrelay.temp.* prefix. Cross-record references use com.atproto.repo.strongRef, which is a {$type, uri, cid} pointer that content-addresses the target.
compute.vm: VM Specification
Defines the requested machine: cpus, mem, disk, network, a role, cloud-init user_data, and an optional location. Setting kind: deno requests a Deno sandbox instead of a VM:
cpus: 2
mem: 4G
disk: 40G
network: 500G
role: my-cool-role
user_data: |
#cloud-config
runcmd:
- [sh, -c, "echo hi"]
location: {country: USA, region: west}
market.rfp: RFP Envelope
Wraps a strong reference to the VM record. The requester publishes this record and sends it to the bidders it discovered:
domain: compute
payload: {uri: at://did:plc:alice/com.publicdomainrelay.temp.compute.vm/3mm3d, cid: bafyrei...vm}
policies: [{uri: ..., cid: ...}]
submitBid: https://...
signatures: [...]
market.bids.free: Free Pricing Payload
A zero-cost bid with a reason string and signatures. This is the default and the only pricing payload written right now:
reason: free
cost: 0
signatures: [...]
market.bids.x402: Pricing Payload
Pricing terms for a paid bid: cost (in the currency's smallest unit), currency, frequency, prepay, and a settlement URL. This is defined in the lexicons, though no bidder writes it yet:
cost: 100000
currency: USDC
frequency: hourly
prepay: true
url: https://compute-contract.bob.example/receipt
market.bid: Bid Envelope
Binds a pricing payload to a specific RFP by strong reference. config is the VM's workload identity issuer:
rfp: {uri: ..., cid: ...}
payload: {uri: ..., cid: ...}
config: {uri: ..., cid: ...}
signatures: [...]
market.accept: Accept
Locks in the requester's chosen bid by referencing both the RFP and the winning bid:
rfp: {uri: ..., cid: ...}
bid: {uri: ..., cid: ...}
submitEvent: https://...
signatures: [...]
market.receipt: Receipt
Proof that the provider took the contract. It references the full contract chain, and its cid binds it to the accept:
rfp: {uri: ..., cid: ...}
bid: {uri: ..., cid: ...}
accept: {uri: ..., cid: ...}
payload: {uri: ..., cid: ...}
cid: bafyrei...binding
signatures: [...]
Record Graph
Every envelope points backward by strong reference, so you can follow the arrows from a receipt to rebuild the entire contract:
VM <- RFP rfp.payload -> vm
RFP <- Bid -> bids.free bid.rfp -> rfp, bid.payload -> bids.free
RFP <- Accept -> Bid accept.rfp + accept.bid
Receipt -> RFP + Bid + Accept
Lifecycle
A contract moves through these states from the initial RFP to termination:
| State | Entered when | Next |
|---|---|---|
| RFP open | The requester writes the VM record and the RFP | bidding |
| bidding | Bidders take the RFP from submitRfp or the relays | accepted, or no bids |
| no bids | Nobody answered | A new RFP after a backoff, until the deadline, then Failed |
| Failed | No bid passes the policy, or the winner is denied | terminal |
| accepted | The requester writes the accept | receipt |
| receipt | The provider provisions and writes the receipt | Held |
| Held | The guest is on the network with its host keys | released |
| released | The requester writes vm.delete and the provider writes vm.terminated | terminal |
See protocol/flow.md for every branch.
Authority & Validation
Providers check these rules before provisioning, and requesters check them before holding:
- The accept must carry a valid signature, its author must be the RFP's author, and the accepted bid must be the provider's own bid for that RFP.
- The RFP must carry a valid inline
network.attestedsignature from the requester, and every bid, accept, receipt, and event carries one from its author. - A full host refuses the accept before issuing any receipt (
submitAcceptreturns 409CapacityExceeded). - The receipt's
cidmust bind to the referenced accept record (VerifyReceiptfails the contract withReceiptInvalidif the binding is invalid). - For
vm.delete, the event's author must be the accept's author.
Settlement
Free settlement is the only flow in use right now. The accept carries no payment, and the receipt follows directly. The lexicons also define accepts.free, accepts.x402, receipts.free, and receipts.x402 for a paid flow, though nothing writes them yet.
VM Lifecycle Events
Lifecycle updates are market.event records submitted with submitEvent, and each record references the receipt it belongs to:
| Event | Payload NSID | Written when |
|---|---|---|
vm.hostKeys | com.publicdomainrelay.temp.compute.events.vm.hostKeys | The guest bound its ssh host key |
vm.onNetwork | com.publicdomainrelay.temp.compute.events.vm.onNetwork | The guest is on the network (includes its iroh ticket, plus an https URL or WebRTC fingerprint per tunnel) |
vm.delete | com.publicdomainrelay.temp.compute.events.vm.delete | The requester is done (accept author only) |
vm.terminated | com.publicdomainrelay.temp.compute.events.vm.terminated | The provider stopped the VM, with a reason |
vm.memoryPressure, vm.oomKilled | com.publicdomainrelay.temp.compute.events.vm.* | The VM's memory crossed a threshold or was OOM-killed |
vm.sandbox | com.publicdomainrelay.temp.compute.events.vm.sandbox | A Deno sandbox ended, with its output |
Guest events (compute.events.guest.* for keys, sealed WebRTC signals, and secrets) use the same envelope. See guest-events.md.
Compute Types
By default, a compute.vm record requests a Firecracker VM. With kind: deno, the same market, bid, and receipt records request a Deno sandbox instead. The bidder runs user_data as the sandbox program, as long as it opted in (install bidder --compute-kinds vm,deno).
References
- Trust & policy: how bidders and requesters choose who they deal with.
- Security & verification: signed records, content addressing, and how to verify a receipt yourself.
- Workload Identity Federation: how a workload gets a scoped credential instead of a secret.
- Gateway: Kubernetes clusters whose nodes the gateway requests on the market for you.
- How it works: the RFP -> bid -> accept -> receipt walkthrough.
- Marketplace: the live market.
- Get started: commands for a requester or a provider.
- About: why this exists and where it is headed.