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

socialweb.computer/socialweb-computer-kcp

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

1 collaborator
0
0
88 lines · 4.7 KB Raw History
# Two trust decisions, configured independently

A contract has two sides, and each one has its own thing to worry about. A bidder is deciding who it will let run on
its own machines. A requester is deciding who it will trust to run its workload at all. Neither side inherits the
other's answer: a bidder can be open to anyone it vouches for while a requester is picky about providers, or the
reverse. Both use the same mode vocabulary, applied to different questions.

## Bidder's policy: who gets to run on my compute

Set when the bidder starts (`install bidder --bidder-policy <name>`; default `bidder-tangled-vouch`). It gates which
RFPs the bidder will even consider bidding on: a filter over incoming requesters, checked before it spends any
resources on a job, and checked again when the accept arrives.

## Requester's policy: who I'll trust to run my compute

Set per contract (default `requester-tangled-vouch`), written as a signed record in the requester's own repo, and
referenced from the RFP's `policies`. It governs which bidders the requester is willing to accept a bid from: a filter
over incoming providers. The bidder runs the requester's attached policy next to its own: both must allow.

## The modes, read from both sides

Same names, same underlying mechanics, but the question each one answers depends on which side configured it.

| mode | as the bidder's policy | as the requester's policy |
| --- | --- | --- |
| `only-me` | Only serve RFPs from the operator itself, or its agents. | Only accept bids from the requester's own DIDs, or their agents. |
| `tangled-vouch` | Only serve requesters this bidder's side has vouched for. | Only accept bids from providers (or their operators) this requester has vouched for. |
| `mutuals` | Serve requesters that this side vouches for and that vouch back. | The same, from the requester's side. |
| `open` | No restriction: only when named, never on prod. | The same. |

Nothing requires the two sides to pick the same mode. A `tangled-vouch` bidder can still bid on an RFP from an
`only-me` requester: the requester's mode only constrains which bid it will accept, not who is allowed to try.

## Vouch and denounce

`tangled-vouch` and `mutuals` read the same graph: vouch records published under Tangled's own namespace
(`sh.tangled.graph.vouch`). A vouch is a signed statement, "I trust this DID," stored as a Tangled record whose rkey is
the vouched DID. A denounce is the same shape with `kind: "denounce"`, and no policy counts it. Each side reads its own
vouches: a bidder (and its operator) checks who it has vouched for; a requester checks who it has vouched for. Agents
count as their principal: a bidder is an agent of its operator's account through an association record, so a vouch for
the operator covers its bidders.

### Vouch

Alice vouches for Bob. If Bob runs his bidders on `bidder-tangled-vouch` and vouches for Alice, they now bid on Alice's
RFPs, and Alice accepts their bids.

### Denounce

Alice denounces Eve. The denounce record is not a vouch, so Eve does not pass Alice's `tangled-vouch` or `mutuals`
check. It does not undo a vouch in another record: treat vouches as an allowlist, not a reputation system.

Where this is thinner than it sounds: a vouch today is boolean, not weighted or scored by how many hops away it is.

## When each side's policy runs

1. The requester creates the RFP. Its policy is written as a signed record and referenced from the RFP: public, fixed
   before anyone sees it.
2. The bidder's scope check: its own policy, on the DIDs only, before anything else.
3. The bidder's full evaluation: its own workflow and every policy the RFP attaches; all must allow before it bids.
4. The requester's checks: each bid on the DIDs, then the full policy on the winner, right before accepting.
5. Accept -> provision: the bidder runs both checks again on the accept, then provisions.

How the policy engine runs them, and what it caches: [protocol/policy.md](../../docs/protocol/policy.md).

## badge.blue attestations

Every record in the chain carries a signature over its own content-addressed CID, not just an author DID. Both sides
check it before acting.

```yaml
$type: com.publicdomainrelay.temp.market.rfp
payload: {uri: at://did:plc:alice/com.publicdomainrelay.temp.compute.vm/3mm3d, cid: bafyrei...vm}
signatures:
  - $type: network.attested.signature
    key: did:key:zQ3s...
    cid: bafyrei...attestation
    signature: {$bytes: "..."}
    issuer: did:plc:alice
```

### Once a workload is running

Policy decides who bids and who is accepted. What credentials the workload itself gets is a separate mechanism:
Workload Identity Federation.

- [Workload Identity Federation](workload-identity.md)
- [Security & verification](security.md)