socialweb.computer

Request and provide VMs on an atproto compute market.

Signed Contract Flow

A requester and a provider form a compute contract through four signed records (market.rfp, market.bid, market.accept, and market.receipt). Nothing is provisioned until both sides publish signed records stating the terms, and anyone watching the firehose can verify the full chain afterward.

Contents

Step 1: Publishing the RFP

The requester publishes two records on its own PDS: a signed compute.vm record describing the machine (CPUs, memory, disk, network, a role, and cloud-init user data) and a market.rfp envelope with strong references to that record and the policy it runs. It then finds bidders through the relays (every repo with a market.offering and a fresh market.heartbeat) and the vouch graph, and pushes the RFP to each bidder's submitRfp endpoint.

Example market.rfp record:

$type: com.publicdomainrelay.temp.market.rfp
domain: compute
payload: {uri: at://did:plc:alice/com.publicdomainrelay.temp.compute.vm/3mm3dolfolz2c, cid: bafyrei...vm}
policies: [{uri: at://did:plc:alice/computer.socialweb.temp.policy.ghalite/3mm3d..., cid: bafyrei...policy}]
submitBid: https://...

Step 2: Sending Bids

Bids arrive over a direct submitBid XRPC call, with the relays and Jetstreams as a fallback. A bidder responds only if both its own policy and every policy attached to the RFP allow it. It creates a market.bids.free payload with cost: 0 (x402 paid pricing is defined in the lexicons, though not used yet) and a workload identity config, then binds both to the RFP in a signed market.bid record.

Example market.bid record:

$type: com.publicdomainrelay.temp.market.bid
rfp: {uri: at://did:plc:alice/com.publicdomainrelay.temp.market.rfp/3mm3d..., cid: bafyrei...rfp}
payload: {uri: at://did:plc:bob/com.publicdomainrelay.temp.market.bids.free/3mm4...-payload, cid: bafyrei...free}
config: {uri: at://did:plc:bob/com.publicdomainrelay.temp.compute.config.wif.simple/3mm4...-config, cid: bafyrei...wif}

Step 3: Scoring and Accepting Bids

By default, the requester opens a 30-second bid window. The first free bid allowed by its policy closes the window right away. Otherwise, the requester waits for the window to close and picks the lowest-cost allowed bid. Before confirming the winner, the requester runs the full policy against it.

To lock in the winner, the requester signs a market.accept record referencing both the RFP and the winning bid, then calls the provider's submitAccept endpoint.

Example market.accept record:

$type: com.publicdomainrelay.temp.market.accept
rfp: {uri: at://did:plc:alice/com.publicdomainrelay.temp.market.rfp/3mm3d..., cid: bafyrei...rfp}
bid: {uri: at://did:plc:bob/com.publicdomainrelay.temp.market.bid/3mm4..., cid: bafyrei...bid}
submitEvent: https://...

Step 4: Provisioning and Receipt

Before provisioning, the provider checks its capacity and re-verifies both the accept and the RFP. If the host is full, it returns CapacityExceeded and the requester moves on to the next bid.

Otherwise, the provider builds the VM from the compute.vm record's cloud-init user_data and creates a signed market.receipt referencing the RFP, bid, and accept, with a cid that binds it to the accept. Once the guest is running, the provider reports its SSH host keys and iroh ticket as vm.hostKeys and vm.onNetwork events.

Example market.receipt record:

$type: com.publicdomainrelay.temp.market.receipt
rfp: {uri: ..., cid: bafyrei...rfp}
bid: {uri: ..., cid: bafyrei...bid}
accept: {uri: ..., cid: bafyrei...accept}
cid: bafyrei...attestation

Step 5: Verification and Connection

The requester checks the receipt's signature and verifies that its cid binds to the accept. Once the receipt is valid and the guest is online with its host keys, the contract is Held. SSH connects over iroh to the guest's iroh ticket using the host keys the provider reported, and each tunnel is also available over an HTTPS URL or WebRTC.

Contract Lifecycle

A normal contract moves through these states:

RFP open -> bidding -> accepted -> receipt -> Held -> released

If no bid passes policy, the contract ends as Failed instead of accepted. If no bidder answers, the requester waits for capacity and sends a fresh RFP until the contract's deadline. Every branch is covered in protocol/flow.md.

Protocol Enforcement

Both sides check signatures and authorship across the lifecycle:

References

Complete record types, fields, and validation rules: