~ knotless Search/
↑↓ move↵ open⇧↵ all results

socialweb.computer/socialweb-computer-kcp

socialweb.computer: a compute market on atproto (kcp)

1 collaborator
0
0
94 lines · 4.7 KB Raw History

Four signed hops, one verifiable contract.

A requester wants a machine. A provider has one spare. Nothing changes hands until both sides have signed a record that says so, and anyone watching the firehose can check the whole chain later.

Step 1 - Requester: publish the RFP

The requester signs a compute.vm record describing the machine (cpus, memory, disk, network, a role, and cloud-init user data), then wraps a strong reference to it in a market.rfp envelope, together with a strong reference to the policy it runs. Both land on the requester's own PDS. The requester discovers bidders through the relays (every repo with a market.offering and a fresh market.heartbeat) and the vouch graph, then pushes the RFP to each bidder's submitRfp endpoint.

$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 - Providers: bids arrive

Bids arrive through two channels: a direct submitBid XRPC call, and the relays and Jetstreams as the fallback. A bidder bids only when its policy and every policy the RFP attaches allow it. It creates a market.bids.free payload (cost: 0; x402 paid pricing is defined in the lexicons but not used today), a workload identity config, and binds them to the RFP in a signed 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 - Requester: score bids, accept one

The requester's bid window is 30 s by default: the first free bid its policy allows ends it, else it takes the lowest-cost allowed bid when the window closes. Before it locks the winner in, the full policy runs on it. Locking it in means signing a market.accept record that references both the RFP and the winning bid, then calling the provider's submitAccept endpoint.

$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 - Provider: provision, receipt

The provider checks its capacity (a full host answers CapacityExceeded and the requester accepts the next bid), checks the accept and the RFP again, provisions the VM from the compute.vm's cloud-init user_data, and mints a signed market.receipt. The receipt anchors rfp, bid and accept, and its cid binds it to the accept. When the guest is up, the provider reports its ssh host keys and its iroh ticket as vm.hostKeys and vm.onNetwork events.

$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 - Requester: verify receipt, ssh in

The requester verifies the receipt's signature and the binding of its cid to the accept. Once valid, and once the guest is on the network with its host keys, the contract is Held: ssh connects over iroh to the guest's own iroh ticket, with the host keys the bidder reported. Per tunnel, an https URL or WebRTC is there too.

The contract's lifecycle

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

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

What the protocol enforces

  • The bidder checks the accept's signature, that the accepted bid is its own bid for that RFP, that the accept's author is the RFP's author, and the RFP's signature, before it provisions anything.
  • Every market record carries an inline network.attested signature by its author.
  • The receipt's cid must bind it to the accept: a bad one fails the contract ReceiptInvalid at the requester.
  • Only the accept's author may release the VM: the bidder checks the author of a vm.delete against the accept.

See the full spec

Every record type, field and validation rule, laid out for reference.