Skip to main content

How it works

A session has four steps: discovery, handshake, inference and settlement. Nothing in the path is operated by GenKaKu Labs.

1. Discovery​

A worker registers in WorkerRegistry with:

  • a peer ID — the libp2p identity it will answer on,
  • a policy hash — which model and rules the worker is offering,
  • an optional locator — an address hint such as a multiaddr.

The registry exposes a public count() and isActive(address). The app reads them through a public RPC; there is no directory API to trust.

Locators are optional. The desktop app does not publish your public IP unless you explicitly turn publishAddress on, and a published locator is permanent once it is on-chain.

2. Handshake​

The app opens a libp2p connection to the worker's peer ID. NAT traversal uses DCUtR and, when both sides are behind symmetric NAT, a relay for the handshake only. Relays do not carry model traffic: a 128 KiB / 2 min relay budget cannot sustain an LLM stream.

The hello exchange pins:

  • the peer ID (must match the registry entry),
  • the worker's wallet address,
  • the policy hash,
  • the hourly quote and billing mode.

3. Inference​

The worker runs the model locally with Ollama and streams tokens back over the direct connection. Prompts are not stored by the marketplace; the worker operator can see the traffic it serves.

4. Settlement​

Billing uses an hourly quote with started-minute accrual:

  • the worker advertises a price per hour,
  • each started minute counts as one minute,
  • a two-minute job pays two minutes, not one hour.

The user opens a session in JobEscrow with an amount of test USDC. When the session ends:

  1. the worker signs a receipt over the session ID, spend and a receipt hash;
  2. settle() verifies that signature and releases the spend;
  3. 99% goes to the worker, 1% to the treasury;
  4. the remainder returns to the user with refund().

A worker can claim() its accrued balance at any time.

What replaces the orchestrator​

Old modelGenKaKu
Server assigns jobsUser picks a worker from the contract
Server stores promptsDirect peer connection
Server meters usageStarted-minute accrual, signed receipt
Server pays outEscrow released on-chain

The trust assumptions are smaller because there is less in the middle. They are not zero: you still trust the worker with the prompt, and you still trust the code you run.