socialweb.computer

Request and provide VMs on an atproto compute market.

flow: one compute contract, end to end

The Story

diagram
Request For Proposal (RFP)Bidpolicy: Bob's workflow + Alice's attached oneAcceptpolicy on the winnerPayment Settlement Flow (NOP if bids.free)Receiptcapacity check + reservation, Provision ComputeHeld: connect to the guest over iroh (ssh), webrtc or an https tunnelReleaseAlice (requester)Bob's bidder (an agent of Bob)createRecord: policy record (the workflow she runs)1createRecord: compute.vm(CPUs, Memory, Disk, cloud-init user_data, ...)2createRecord: rfp(strongRef to compute.vm + policy, signed)3discover (offering + heartbeat), submitRfp4createRecord: compute.config.wif.simple, bids.free (or x402)5createRecord: bid(strongRef to RFP + payment terms + config)6submitBid7createRecord: accept(strongRef to RFP + Bid)8submitAccept (re-sent until the receipt)9createRecord: receipt(strongRef to RFP + Bid + Accept + compute.vm, cid binds the accept)10createRecord: compute.events.vm.hostKeys, vm.onNetwork(address: the guest's iroh ticket)11createRecord: market.event(strongRef to the payload + receipt)12submitEvent13createRecord: compute.events.vm.delete + market.event14submitEvent15createRecord: compute.events.vm.terminated + market.event16delete her contract records17Alice (requester)Bob's bidder (an agent of Bob)

The Steps

stepwho writeswherewhat the other side verifies
S0 sign ineach partyits OpenBao-
S1 trustoperators, userstheir reposvouches and associations, at every policy run
S2 declare (optional)the owner's kcpowner repo-
S3 policy, vm, rfp; discovery; submitRfprequesterrequester repoRFP signature, RFP author = token issuer, bid window, policies
S4 bidbidderbidder repobid author = token issuer, scope policy on each bid
S5 accept; submitAcceptrequesterrequester repoaccept signature, accept author = RFP author, policies again, capacity
S6 receiptbidderbidder reporeceipt signature, cid binds the accept
S7 boot, vm eventsbidder (for the guest)bidder repoevent author = receipt author, both signatures
S8 guest events, secrets, Heldbotheach its ownevent author, kind allowed for that side
S9 release, cleanupbotheach its owndelete author = accept author

S0: sign in

S1: trust

S2: declare (optional)

S3: policy, vm, rfp

The requester (internal/market/requester/runner.go requestOnce) checks the size, the token paths and the contract deadline (the vm-expires-at label: a deadline in the past sends no RFP), then writes, each with putRecord at a TID:

# the policy record: the workflow the requester runs, so the bidder can run it too
uri: at://aliceoa.bsky.social/computer.socialweb.temp.policy.ghalite/3n2de4u2n2c2i
$type: computer.socialweb.temp.policy.ghalite
name: requester-tangled-vouch
perspective: requester
requester: did:plc:lpfuqerea3deuoyrn7ojser4
workflow: "<the bundled workflow, 2448 chars>"
---
# the VM asked for (unsigned; reused by every RFP round of the contract)
uri: at://aliceoa.bsky.social/com.publicdomainrelay.temp.compute.vm/3n2de4twuxb2t
$type: com.publicdomainrelay.temp.compute.vm
kind: vm
role: stg-gateway
cpus: 4
mem: 8G
disk: 50G
expiresAt: "2026-11-15T11:00:45.000Z"
user_data: "<cloud-init, 5399 bytes: cloudinit.BuildUserData, with the iroh module>"
---
# the RFP (signed)
uri: at://aliceoa.bsky.social/com.publicdomainrelay.temp.market.rfp/3n2de4uaqaj2a
$type: com.publicdomainrelay.temp.market.rfp
domain: compute
payload: {uri: at://did:plc:lpfuqerea3deuoyrn7ojser4/com.publicdomainrelay.temp.compute.vm/3n2de4twuxb2t, cid: bafyreiejybdf2t77...}
policies:
  - {uri: at://did:plc:lpfuqerea3deuoyrn7ojser4/computer.socialweb.temp.policy.ghalite/3n2de4u2n2c2i, cid: bafyreick65zxk47w...}
submitBid: https://did-key-zq3shrcc7qedh4rhor1nwahzrt2anfc9iaxeqfcsrztsl8ype.xrpc.fedproxy.com
createdAt: "2026-11-15T06:10:46.139Z"

submitBid here is the requester's did:key ingress (it has no public host: identity.md).

Then discovery (market.md): every repo with a market.offering that the relays list, plus the DIDs its operators vouch for and the agents they endorse; candidates without a fresh heartbeat (300 s) or lacking a capability (maxCpus, nestedVirt, images) are dropped. Never a pinned list.

The requester sends market.submitRfp {rfpUri, rfpCid} to each candidate's first endpoint (iroh, webrtc, https), service auth aud <bidder DID>#pdr_temp_market, lxm the NSID.

The bidder (internal/market/bidder/submit.go SubmitRFP) checks the token issuer is the RFP's author and the bid window (10 min from the RFP's TID), answers 200 {name, phase: Deciding} or declined {kind: capacity|unservable, reason}, or 409 RFPClosed. The RFP also reaches it on the relay and Jetstream streams; one sink drops duplicates.

S4: bid

The bidder (bids.go decideBid): the window, the RFP's signature, the requester's DID resolves, the payload, guest tools and net, the scope policy, then the full policy (its own workflow and every attached one: all must allow). Then three records at the bid's deterministic rkey (BidRKey: one bid per RFP):

uri: at://did:plc:2l2wdry77c7jtucbslstagkj/com.publicdomainrelay.temp.market.bids.free/bid-596cc856db4e8aaf1080-payload
$type: com.publicdomainrelay.temp.market.bids.free
reason: free
cost: 0
# Can also be x402 (not exercised today):
# $type: com.publicdomainrelay.temp.market.bids.x402
# cost: 100000
# currency: USDC
# frequency: hourly
# prepay: true
# url: https://compute-contract.bob.example/receipt
---
uri: at://did:plc:2l2wdry77c7jtucbslstagkj/com.publicdomainrelay.temp.market.bid/bid-596cc856db4e8aaf1080
$type: com.publicdomainrelay.temp.market.bid
rfp:     {uri: at://did:plc:lpfuqerea3deuoyrn7ojser4/com.publicdomainrelay.temp.market.rfp/3n2de4uaqaj2a, cid: bafyreiewnv734zjy...}
payload: {uri: at://did:plc:2l2wdry77c7jtucbslstagkj/com.publicdomainrelay.temp.market.bids.free/bid-596cc856db4e8aaf1080-payload, cid: bafyreidtjdg5zrwd...}
config:  {uri: at://did:plc:2l2wdry77c7jtucbslstagkj/com.publicdomainrelay.temp.compute.config.wif.simple/bid-596cc856db4e8aaf1080-config, cid: bafyreig7dqqmi2ky...}
createdAt: "2026-11-15T06:10:53Z"

The config is the VM's workload identity issuer and subject format (guest-events.md). The bidder sends market.submitBid to the RFP's submitBid.

The requester takes bids from submitBid, the streams, and one getRecord per bidder at BidRKey a few seconds after submitRfp. Each is read from the repo of the bid URI's authority (for a submitBid, the service-auth issuer): of a submitBid only uri and cid are used, the bid is read by them and its bytes must hash to cid; the submitRfp answer is never read for a bid. Before a bid is queued its signature must verify with a key of the bidder's DID document or a key its badgeBlueKeys record binds, read with com.atproto.sync.getRecord and its signed commit checked (identity.md); a refused bid is answered 403. The winner's config must be in the same repo. Whether the bidder was one the RFP went to is not checked. Its window (bidWindowSeconds, 30 s) ends at the first free bid its scope policy allows; else it takes the lowest-cost allowed bid after the window. It runs the full policy on the winner (a deny fails the contract: policy_rejected).

S5: accept

uri: at://aliceoa.bsky.social/com.publicdomainrelay.temp.market.accept/ro7pddf4ecfze
$type: com.publicdomainrelay.temp.market.accept
rfp: {uri: at://did:plc:lpfuqerea3deuoyrn7ojser4/com.publicdomainrelay.temp.market.rfp/3n2de4uaqaj2a, cid: bafyreiewnv734zjy...}
bid: {uri: at://did:plc:2l2wdry77c7jtucbslstagkj/com.publicdomainrelay.temp.market.bid/bid-596cc856db4e8aaf1080, cid: bafyreidpljip3s4e...}
submitEvent: https://did-key-zq3shrcc7qedh4rhor1nwahzrt2anfc9iaxeqfcsrztsl8ype.xrpc.fedproxy.com
createdAt: "2026-11-15T06:11:00.665Z"

S6: receipt

uri: at://did:plc:2l2wdry77c7jtucbslstagkj/com.publicdomainrelay.temp.market.receipt/receipt-fa04c66e2d8effc84a2f6a869217fa11
$type: com.publicdomainrelay.temp.market.receipt
rfp:     {uri: at://did:plc:lpfuqerea3deuoyrn7ojser4/com.publicdomainrelay.temp.market.rfp/3n2de4uaqaj2a, cid: bafyreiewnv734zjy...}
bid:     {uri: at://did:plc:2l2wdry77c7jtucbslstagkj/com.publicdomainrelay.temp.market.bid/bid-596cc856db4e8aaf1080, cid: bafyreidpljip3s4e...}
accept:  {uri: at://did:plc:lpfuqerea3deuoyrn7ojser4/com.publicdomainrelay.temp.market.accept/ro7pddf4ecfze, cid: bafyreickrv6epucq...}
payload: {uri: at://did:plc:lpfuqerea3deuoyrn7ojser4/com.publicdomainrelay.temp.compute.vm/3n2de4twuxb2t, cid: bafyreiejybdf2t77...}
cid: bafyreihoa6m57iajl63umctjn4mke2l4ezbzmbxhclfj5ghrx2uaxklrla
submitEvent: https://did-key-zq3shrcc7qedh4rhor1nwahzrt2anfc9iaxeqfcsrztsl8ype.xrpc.fedproxy.com
createdAt: "2026-11-15T06:11:07.641Z"

S7: boot and vm events

uri: at://did:plc:2l2wdry77c7jtucbslstagkj/com.publicdomainrelay.temp.compute.events.vm.hostKeys/hostkeys-payload-2aac09c4d09c6fa506757931c42eb7f1
$type: com.publicdomainrelay.temp.compute.events.vm.hostKeys
keys: [{type: ssh-ed25519, publicKey: AAAAC3NzaC1lZDI1NTE5AAAAIAnyKwEO5wzWGBi44fIk0IINLHqK21fd1/Q0CVUssM1u, fingerprint: "SHA256:HLs4eIe9xpZuDqOzbJ4V0PMGYUAT0MykBqMj5YdG4UQ"}]
observedAt: "2026-11-15T06:11:17Z"
---
uri: at://did:plc:2l2wdry77c7jtucbslstagkj/com.publicdomainrelay.temp.compute.events.vm.onNetwork/onnetwork-payload-ffcde96d9e9d32d1fc7a38f6a2c46ad5
$type: com.publicdomainrelay.temp.compute.events.vm.onNetwork
address: iroh://endpointaakwnx5yuadc7qofuw3rdurziaeaghixq...
createdAt: "2026-11-15T06:11:19Z"
---
uri: at://did:plc:2l2wdry77c7jtucbslstagkj/com.publicdomainrelay.temp.market.event/onnetwork-event-63e463b75b052b3a570a6956e00d9a4d
$type: com.publicdomainrelay.temp.market.event
payload: {uri: at://did:plc:2l2wdry77c7jtucbslstagkj/com.publicdomainrelay.temp.compute.events.vm.onNetwork/onnetwork-payload-ffcde96d9e9d32d1fc7a38f6a2c46ad5, cid: bafyreicronh3k2gu...}
receipt: {uri: at://did:plc:2l2wdry77c7jtucbslstagkj/com.publicdomainrelay.temp.market.receipt/receipt-fa04c66e2d8effc84a2f6a869217fa11, cid: bafyreihpm5lvqqro...}
createdAt: "2026-11-15T06:11:19Z"

S8: guest events, secrets, Held

S9: release and cleanup

  1. a release request (spec.releaseRequestedAt): the guest requester's contracts first (guest.r2Release, wait for guest.r2Released), then leased atirc tokens are revoked while the lease is alive
  2. the requester writes compute.events.vm.delete {reason: released} + market.event and sends submitEvent, retried until the bidder's vm.terminated appears or the release deadline
  3. the bidder checks the delete's author is the accept's and the receipt is its own, deletes the ComputeVM, and writes vm.terminated:
uri: at://did:plc:2l2wdry77c7jtucbslstagkj/com.publicdomainrelay.temp.compute.events.vm.terminated/termination-payload-2da9e2aef573b37793d5c43f443186a1
$type: com.publicdomainrelay.temp.compute.events.vm.terminated
reason: deleted_on_request
observedAt: "2026-11-15T06:18:58Z"
  1. the requester reads it at EventRKeys(TerminationKey(receipt)) (up to 2 min) and is Released
  2. cleanup: the requester deletes the records it wrote for the contract (the rbac grant, the association and endorsement, its delete records, the accept, the RFP, the compute.vm, the policy record, its ContractEvents); a guest requester's DIDs are tombstoned (by the guest, else by the requester's rotation key). The bidder keeps its bid, receipt and events
  3. reasons a VM ends without a release: guest_poweroff, vmm_exited, oom, host_reboot, identity_mismatch, image_refused, expired (past its association's expiresAt), association_ended (market.md)

The records of this contract are still in alice's repo, and its vm.terminated has no request: its requester did not run step 5. Why is not visible in the records.

When It Does Not Go That Way

diagram

every bidder declined unservable, or every candidate lacks a capability

none (full, silent, capacity declines)

before the deadline (vm-expires-at, else 30 min)

deadline passed

all denied by policy

a winner

deny

allow

declined (409 CapacityExceeded, any 4xx but 408/425/429)

yes, bids of this RFP left

yes, no bids left

no

no receipt in 5 min

receipt

bad

ok

no

wrong image marker or image_refused

yes

RFP written, submitRfp to the discovered bidders

bids?

Failed: no bidder can serve this request

wait for capacity: delete the RFP, back off 30 s, 1 min, then 2 min

Failed: no bids, gave up after N rounds

Failed: bids_denied

full policy on the winner

Failed: policy_rejected

accept, submitAccept

replacements left? (3, shared)

same RFP: submitRfp again without the refusers

delete the RFP, a new RFP without the refusers

Failed

Failed: no receipt

VerifyReceipt

Failed: receipt_invalid

guest on network + host keys in 120 s

Failed: network_timeout

release it, accept another bid (shares the 3)

Held

A Real Run

The requester's contract lines of one request on a local market (run request --network):

06:02:32 Requesting requested      step preparing
06:02:32 Requesting rfp_submitted  step creatingRfp
06:02:32 Requesting rfp_submitted  the RFP is submitted; collecting bids
06:02:32 Requesting rfp_submitted  ... requester_no_bidders: no bidder with a market endpoint among 1 candidates
06:03:02 Requesting rfp_submitted  waiting for a default-size slot: round 1, a new RFP in 30s
06:03:32 Requesting rfp_submitted  step creatingRfp
06:03:35 Requesting winner_selected the winner is selected; accepting
06:03:35 Requesting accepted       the accept is submitted; waiting for the receipt
06:03:39 Requesting receipt        the receipt is verified; waiting for the guest
06:03:51 Requesting receipt        the guest reported hostKeys
06:03:54 Requesting network        the guest reported onNetwork
06:03:54 Held       network        held: the guest is on the network
06:03:55 Releasing  network        the destroy is delivered; waiting for the bidder's vm.terminated
06:04:00 Released   released       the bidder ended the contract: deleted_on_request

The first round found the network's bidder before its offering named an endpoint; the requester waited for capacity and the second round got the VM.

See Also