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

socialweb.computer/socialweb-computer-kcp

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

1 collaborator
0
0

site: the console's style, /fancy/ restored and updated, root page white; docs clean-ups

Merged johnandersen777.bsky.social asked to merge into main from socialweb.computer/socialweb-computer-kcp:phase-2
docs/protocol/flow.md+4−4
@@ -4,7 +4,7 @@
- the compute contract flow can run purely over the firehose and relays (comms mode `Firehose`: no inbound endpoint); the `market.submit*` calls are the fast path
- every record lives in its author's own repo; the other side reads it with one `getRecord` (from a firehose or Jetstream commit, or from the `market.submit*` call that names it)
- every `market.*` record and every event payload carries badge.blue signatures (`network.attested.signature`: [identity.md](identity.md#networkattested)); they are left out of the records below
- the records below are one real contract, read 2026-11-19 from prod: the requester `aliceoa.bsky.social` rented a 4 vCPU VM from one of `bobvmbuilder.bsky.social`'s bidders on 2026-11-15 (trimmed; `did:plc:lpfuqerea3deuoyrn7ojser4` is alice, `did:plc:2l2wdry77c7jtucbslstagkj` the bidder)
- the records below are one real contract, from prod: the requester `aliceoa.bsky.social` rented a 4 vCPU VM from one of `bobvmbuilder.bsky.social`'s bidders on 2026-11-15 (trimmed; `did:plc:lpfuqerea3deuoyrn7ojser4` is alice, `did:plc:2l2wdry77c7jtucbslstagkj` the bidder)
- field by field: [market.md](market.md), [guest-events.md](guest-events.md); who is who: [identity.md](identity.md#actors); every NSID: [glossary.md](glossary.md)
## The Story
@@ -150,7 +150,7 @@ reason: free
cost: 0
# Can also be x402 (not exercised today):
# $type: com.publicdomainrelay.temp.market.bids.x402
# cost: 0.10
# cost: 100000
# currency: USDC
# frequency: hourly
# prepay: true
@@ -256,7 +256,7 @@ observedAt: "2026-11-15T06:18:58Z"
5. 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 renter's rotation key). The bidder keeps its bid, receipt and events
6. 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](market.md#release-and-termination))
The records of this contract are still in alice's repo on 2026-11-19, and its `vm.terminated` has no `request`: its requester did not run step 5. Why is not visible in the records.
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
@@ -292,7 +292,7 @@ flowchart TD
## A Real Run
The requester's `contract` lines of one rent on a local market (`run request --network`, 2026-11-19 UTC; `~/.tmp/docs-0041/local-t1.log` on hat-8):
The requester's `contract` lines of one rent on a local market (`run request --network`):
```
06:02:32 Requesting requested step preparing
docs/protocol/guest-events.md+1−1
@@ -206,7 +206,7 @@ To send secrets to the VM without putting them in cloud-init (public atproto dat
- who can read the bundle: the requester (its OpenBao) and the guest that holds the token. The bidder relays no secret on the getSecrets path and on the sealed path carries ciphertext it cannot open; it does run the token issuer, so a requester trusts the bidder it accepts
- release deletes the rbac record (`deleteRBAC`)
A real bid config (bidder `did:plc:2l2wdry77c7jtucbslstagkj`, read 2026-11-19):
A real bid config (bidder `did:plc:2l2wdry77c7jtucbslstagkj`):
```json
{"uri": "at://did:plc:2l2wdry77c7jtucbslstagkj/com.publicdomainrelay.temp.compute.config.wif.simple/bid-596cc856db4e8aaf1080-config",
docs/protocol/identity.md+1−1
@@ -7,7 +7,7 @@
## Actors
Every actor is an atproto DID with a repo on a PDS; it writes only its own repo. Prod examples (read 2026-11-19).
Every actor is an atproto DID with a repo on a PDS; it writes only its own repo. Prod examples.
| actor | DID | repo lives on | writes |
|---|---|---|---|
docs/protocol/market.md+2−2
@@ -120,7 +120,7 @@ flowchart LR
- discovery results are cached 20 s (only when a bidder was found)
- a bidder's endpoint: the first of iroh (only with `dumbpipe` on PATH), webrtc, https in its offering (`DefaultEndpointKinds`; `SOCIALWEB_REQUESTER_BIDDER_ENDPOINTS` replaces the order); service auth aud `<bidder DID>#pdr_temp_market`
A real offering and heartbeat (one of `bobvmbuilder.bsky.social`'s prod bidders, read 2026-11-19, addresses trimmed):
A real offering and heartbeat (one of `bobvmbuilder.bsky.social`'s prod bidders, addresses trimmed):
```json
{"uri": "at://did:plc:2l2wdry77c7jtucbslstagkj/com.publicdomainrelay.temp.market.offering/self",
@@ -290,7 +290,7 @@ sequenceDiagram
`expired` (the association's expiresAt passed), `association_ended` (the contract that scoped the requester's association is over: its `vm.terminated` or `vm.delete` is present)
- `deleted_on_request` is also written for a direct ComputeVM delete on the bidder (no `request`)
A real `vm.terminated` (bidder `did:plc:2l2wdry77c7jtucbslstagkj`, the release of the contract in [flow.md](flow.md), read 2026-11-19):
A real `vm.terminated` (bidder `did:plc:2l2wdry77c7jtucbslstagkj`, the release of the contract in [flow.md](flow.md)):
```json
{"uri": "at://did:plc:2l2wdry77c7jtucbslstagkj/com.publicdomainrelay.temp.compute.events.vm.terminated/termination-payload-2da9e2aef573b37793d5c43f443186a1",
docs/protocol/policy.md+1−1
@@ -146,7 +146,7 @@ flowchart LR
- who writes vouches: market networks declare operator vouches both ways (`internal/app/marketnetwork/vouches.go`, compose `ApplyOperatorVouch`); people write them from any client. the requester OAuth scope offers vouch write as an optional scope
- requester discovery lists the vouches of its operators (self, `spec.operatorDID`, its walk roots; not intermediate ancestors) to add candidates (`internal/market/requester/discovery.go` `vouchedBy`, a listRecords that skips `denounce` and takes rkeys starting `did:`); the policy, not discovery, decides who is served
Real records (read 2026-11-19): the prod requester `aliceoa.bsky.social` and the bidder operator `bobvmbuilder.bsky.social` vouch each other, so `requester-tangled-vouch` and `bidder-tangled-vouch` both allow (bob's bidders are his agents: their walk reaches him).
Real records: the prod requester `aliceoa.bsky.social` and the bidder operator `bobvmbuilder.bsky.social` vouch each other, so `requester-tangled-vouch` and `bidder-tangled-vouch` both allow (bob's bidders are his agents: their walk reaches him).
```json
{"uri": "at://aliceoa.bsky.social/sh.tangled.graph.vouch/did:plc:ocnuqjlzgohypj3zoznermms",
docs/protocol/release.md+1−1
@@ -16,7 +16,7 @@
An artifact's `cid` is a CIDv1 raw sha2-256 of the file's bytes: the sha256 of the binary, checked after download.
Read 2026-11-19 (trimmed; artifact URL shortened):
Trimmed; artifact URL shortened:
```json
{"uri": "at://socialweb.computer/software.release.channel/socialweb-computer:stable",
site/fancy/about.mdnew+41−0
@@ -0,0 +1,41 @@
# Compute is easier to trust when you can read the receipt.
Cloud marketplaces today ask you to trust a platform's ledger. Compute Contracts Protocol asks you to trust arithmetic
instead: every request, bid, acceptance and receipt is a record you or anyone else can fetch, verify and replay,
because it was never anywhere but your own repository and theirs.
- **No broker.** There is no marketplace operator holding both sides' records. The firehose is public infrastructure;
anyone can run a relay.
- **No trust, just proof.** A receipt's CID binds the whole contract chain. Verifying it is a hash check, not a phone
call.
- **Built on what exists.** It is ordinary AT Protocol records and the same firehose Bluesky and every other app
already reads.
## Not ready to run a requester?
The [gateway](gateway.md) rents the nodes of a Kubernetes cluster for you: a few calls in, a kubeconfig out, while every
record it writes is still the same open protocol underneath.
## Who does what
Four roles, none of them a central authority.
| actor | role |
| --- | --- |
| Requester | Authors the `market.rfp` and `market.accept` records. Wants compute. |
| Provider (bidder) | Authors `market.bid` and `market.receipt`. Has spare machines. |
| PDS | Each actor's Personal Data Server, holding their signed records. |
| Firehose / relay | Streams commits from every relevant PDS so participants can discover each other's records. |
## Where this is headed
This is alpha software: the NSIDs live under a temporary namespace (`com.publicdomainrelay.temp.*`) and interfaces will
move. It already works for individual providers and requesters; the next stretch is organizations that hold compute
and want to hand it to their own members through the same records, and a scorer that goes past "lowest cost."
### Read the code, not just the pitch
The record schemas, the bidder and the requester are all in the open repository.
- [View the repository](https://knotless.dev/socialweb.computer/socialweb-computer-kcp)
- [Read the docs](../../docs/README.md)
site/fancy/docs.mdnew+190−0
@@ -0,0 +1,190 @@
# The protocol spec
Record types, the reference graph between them, the path a contract moves through, and the rules that keep a contract
honest.
- [Record types](#record-types)
- [Record graph](#record-graph)
- [Lifecycle](#lifecycle)
- [Authority & validation](#authority--validation)
- [Settlement](#settlement)
- [Events](#vm-lifecycle-events)
- [Compute types](#compute-types)
More: [Trust & policy](trust.md), [Security & verification](security.md),
[Workload Identity Federation](workload-identity.md), [Gateway](gateway.md). The full reference, with the code behind
each rule: [protocol/README.md](../../docs/protocol/README.md) and [the glossary](../../docs/protocol/glossary.md).
## Record types
All records live in AT Protocol repositories. Cross-record references use `com.atproto.repo.strongRef`: a
`{$type, uri, cid}` pointer that content-addresses the target.
All market NSIDs carry the `com.publicdomainrelay.temp.*` prefix (pre-release namespace).
### `compute.vm`: VM specification
Describes the desired machine: cpus, mem, disk, network, a role, cloud-init `user_data`, and an optional location.
`kind: deno` asks for a Deno sandbox instead of a VM.
```yaml
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: this is what the requester publishes and sends to the bidders it
discovered.
```yaml
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
Zero-cost bid: the default, and the only one written today. A reason string and signatures.
```yaml
reason: free
cost: 0
signatures: [...]
```
### `market.bids.x402`: pricing payload
Cost (in the currency's smallest unit), currency, frequency, prepay and a settlement URL: the economic terms of a paid
bid. Defined in the lexicons; no bidder writes it today.
```yaml
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.
```yaml
rfp: {uri: ..., cid: ...}
payload: {uri: ..., cid: ...}
config: {uri: ..., cid: ...}
signatures: [...]
```
### `market.accept`: accept
The requester locks in a chosen bid, referencing both the RFP and the winning bid.
```yaml
rfp: {uri: ..., cid: ...}
bid: {uri: ..., cid: ...}
submitEvent: https://...
signatures: [...]
```
### `market.receipt`: receipt
The provider's proof it took the contract: anchors the full contract chain, and its `cid` binds it to the accept.
```yaml
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: follow the arrows from a receipt and you can rebuild the whole
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
| 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`, the provider `vm.terminated` | terminal |
Every branch: [protocol/flow.md](../../docs/protocol/flow.md#when-it-does-not-go-that-way).
## Authority & validation
Rules a provider checks before it provisions, and a requester before it holds:
- The accept's signature, the accepted bid being the provider's own bid for that RFP, and the accept's author being the
RFP's author.
- The RFP must carry a valid inline `network.attested` signature by the requester; every bid, accept, receipt and event
carries one by its author.
- A full host refuses the accept (`submitAccept` answers 409 `CapacityExceeded`) before any receipt.
- The receipt's `cid` must bind to the referenced accept record (`VerifyReceipt`; a bad one fails the contract
`ReceiptInvalid`).
- For `vm.delete`: the event's author must be the accept's author.
## Settlement
Free settlement is what runs today: the accept carries no payment and the receipt follows it. The lexicons also define
`accepts.free`, `accepts.x402`, `receipts.free` and `receipts.x402` for a paid flow; none is written today.
## VM lifecycle events
`market.event` records, submitted with `submitEvent`, each referencing 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 (its iroh ticket; per tunnel an https URL or a WebRTC fingerprint) |
| `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.*`: keys, sealed WebRTC signals, secrets) ride the same envelope:
[guest-events.md](../../docs/protocol/guest-events.md).
## Compute types
The RFP's `compute.vm` is the one worked through above: a Firecracker VM by default. With `kind: deno` the same market,
bid and receipt records carry a Deno sandbox that runs the user data as its program, on a bidder that opts in
(`install bidder --compute-kinds vm,deno`).
## More on the protocol
- [Trust & policy](trust.md): how bidders and requesters each choose who they deal with.
- [Security & verification](security.md): signed records, content addressing, and how to verify a receipt yourself.
- [Workload Identity Federation](workload-identity.md): how a workload gets a scoped credential instead of a secret.
- [Gateway](gateway.md): Kubernetes clusters whose nodes the gateway rents on the market for you.
- [How it works](how-it-works.md): the RFP -> bid -> accept -> receipt walk.
- [Marketplace](marketplace.md): the live market.
- [Get started](get-started.md): commands for a requester or a provider.
- [About](about.md): why this exists and where it is headed.
site/fancy/gateway.mdnew+40−0
@@ -0,0 +1,40 @@
# One gateway in front of the whole market
You don't have to run your own requester, watch the relays, or pick bids. The gateway at
[k8s.socialweb.computer](https://k8s.socialweb.computer/) speaks XRPC on one side and the decentralized market on the
other: ask for a Kubernetes cluster, and it rents the cluster's nodes on the market for you, as VMs, with
the same RFP, bid, accept and receipt records.
## In a browser
Sign in at [k8s.socialweb.computer](https://k8s.socialweb.computer/), create a cluster, pick a lifetime (1, 8 or 24
hours, or no expiry), download its kubeconfig, revoke it.
## From the CLI
One call per step, given a `goat account login` session of your account and a service-auth token per call. The
commands, from creating a cluster to deleting it: [gateway.md](../../docs/gateway.md#from-the-cli).
```sh
GW=https://k8s.socialweb.computer AUD=did:web:k8s.socialweb.computer N=com.publicdomainrelay.temp.cluster
goat xrpc procedure "$GW" "$N.createCluster" name=my-cluster \
"Authorization:Bearer $(goat account service-auth --aud "$AUD" --lxm "$N.createCluster")"
```
## Your own gateway
The same gateway runs in your own requester, with no web app: `run requester --with-gateway`; and in a local market:
`dev up --with-gateway` ([quickstart-local.md](../../docs/quickstart-local.md)).
## Rather rent one VM?
The gateway is for clusters. One VM is one command from your own terminal:
<!-- ../../README.md#rent-a-vm -->
### Prefer to run it yourself?
Every record the gateway writes is one you could write yourself: see the raw protocol.
- [Read the spec](docs.md)
- [See trust & policy](trust.md)
site/fancy/get-started.mdnew+88−0
@@ -0,0 +1,88 @@
# From zero to a signed contract
Pick a side. Both paths assume you already have an AT Protocol identity: a DID and a PDS that will hold your records.
The fastest way is the one binary, `socialweb-computer`: `run request` for the requester side and `install bidder` for
the provider side. Each automates the full flow in one process.
## Install
<!-- ../../README.md#install -->
## I need compute
### Run the requester (automated path, recommended)
One command writes the VM record and the RFP, collects bids, signs the accept, waits for the guest, runs your command
(or drops you into a shell) and releases the VM: everything in steps 1-4 below, automated.
<!-- ../../README.md#rent-a-vm -->
Sign-in modes (QR code, browser, app password), holding a VM, ssh, sizes and the long-lived requester:
[quickstart-prod.md](../../docs/quickstart-prod.md).
### Step 1 (what it does): describe the machine
A `compute.vm` record: cpus, mem, disk, network, a role and the cloud-init user data.
```yaml
$type: com.publicdomainrelay.temp.compute.vm
cpus: 2
mem: 4G
disk: 40G
role: ml-inference-worker
```
### Step 2: publish the RFP
A strong reference to the VM record in a `market.rfp`, sent to every bidder it discovered through the relays.
```yaml
$type: com.publicdomainrelay.temp.market.rfp
payload: {uri: at://did:plc:you/com.publicdomainrelay.temp.compute.vm/3mm3d, cid: bafyrei...vm}
```
### Step 3: wait, score, accept
The bid window runs, the policy decides, the first allowed free bid (else the lowest cost) wins, and a signed
`market.accept` goes to the winning provider's `submitAccept`.
### Step 4: get your receipt
The provider provisions the machine and mints a `market.receipt` anchoring the whole chain. That is your proof the
contract happened: check the NSID, the author DID, and that the CIDs bind straight through ([security](security.md)).
## I have machines
### Run a bidder (automated path, recommended)
One service subscribes to the relays, takes RFPs, places bids, takes accepts and provisions VMs: everything in steps
1-4 below, automated.
<!-- ../../README.md#run-a-bidder -->
Builds and channels, who it serves, upgrade and self-update: [bidder.md](../../docs/bidder.md).
### Step 1 (what it does): pick a policy, then watch the market
Choose who is even allowed to reach you (`bidder-tangled-vouch` by default; `bidder-only-me`, `bidder-mutuals`), then
take `market.rfp` records from `submitRfp` and from the relays. See [trust & policy](trust.md).
### Step 2: price it, bid it
Publish a `market.bids.free` payload, then a `market.bid` that binds it to the RFP.
### Step 3: take the accept
Check that the accept references your bid's exact uri and cid, comes from the RFP's own author, and that you still have
room, before provisioning anything.
### Step 4: provision, then mint the receipt
Provision the VM and sign a `market.receipt` anchoring rfp, bid and accept.
### Need the field-by-field detail?
Every record type and validation rule is written up in the spec.
- [Read the spec](docs.md)
- [Try a whole market on one machine](../../docs/quickstart-local.md)
site/fancy/how-it-works.mdnew+94−0
site/fancy/index.mdnew+44−0
site/fancy/marketplace.mdnew+11−0
site/fancy/request-compute.mdnew+23−0
site/fancy/security.mdnew+67−0
site/fancy/trust.mdnew+88−0
site/fancy/workload-identity.mdnew+74−0
site/build.ts+170−27
site/index.md+7−1
site/README.md+5−3
site/style.css+243−88
AGENTS.md+1−1