Decentralized AI inference marketplace. Anyone with a GPU runs a provider and earns xBZZ per token served. Any OpenAI-compatible app points at a gateway and pays per token — no API keys, no signups, no Stripe.
Live at t4t.eth. Container image: ghcr.io/token-for-token/t4t. Coordination via Swarm + PSS; payment, escrow, registry, and slashing on Gnosis Chain.
You run a provider container next to a local Ollama or vLLM. The container:
- Registers your offerings on-chain — every model your local backend exposes gets advertised on the provider registry with your prices (xBZZ per 1M input/output AI tokens).
- Listens for jobs over PSS — clients send encrypted job descriptors directly to your node; no central dispatcher.
- Streams encrypted requests + responses through Swarm — your IP isn't exposed to clients; the content is content-addressed and erasure-coded.
- Claims payment on-chain — at the end of every job, your container calls
JobEscrow.claimJob. xBZZ moves from the client's escrow row to your wallet, refunding any difference betweenmaxPaymentand the actualinputTokens·inputPrice + outputTokens·outputPrice.
The minimum is 100 xBZZ staked + a little xDAI for gas + a Bee node + a GPU your backend can drive. You set your own per-model prices in the admin UI at http://localhost:3000. Nothing to apply for, nothing to renew — your stake is what lets you accept jobs, and slashing is what backstops your SLA.
Roughly: a 4090 serving llama3:8b at the median price on t4t.eth earns proportional to tokens served, paid in xBZZ. Profit depends on your power cost, hardware amortisation, and how many concurrent jobs your VRAM supports (T4T_MAX_CONCURRENT_JOBS).
→ Full provider guide — config, slashing rules, withdrawal flow.
xBZZ is the Ethereum Swarm bridge-token on Gnosis Chain — the same token that pays for the storage every job's payload sits on. Using it for inference means one budget covers both compute and storage; gas costs stay in cents (Gnosis), and the broader Swarm economy gets a second utility surface besides postage stamps. Buy on the Swarm get-bzz page or bridge from Ethereum mainnet.
You run a gateway container locally. Point Open WebUI, LibreChat, Continue.dev, or any OpenAI-compatible app at http://localhost:8080/v1. The gateway picks a provider for each request (top-reputation, cheapest by default), escrows the maximum payment in xBZZ, ships the encrypted request through Swarm, returns the streamed response to your app, and settles on-chain automatically.
curl http://localhost:8080/v1/chat/completions \
-H 'content-type: application/json' \
-d '{"model":"llama3:8b","messages":[{"role":"user","content":"hi"}]}'No API key for the gateway. Your wallet is the API key.
→ Full gateway guide — config, payment flow, app integration.
┌──────────────┐ POST /v1/chat ┌──────────────┐
│ Your app │ ───────────────► │ T4T gateway │
│ (Open WebUI, │ │ (you run) │
│ curl, IDE) │ ◄─────────────── │ │
└──────────────┘ streamed reply └──────┬───────┘
│
┌──────────────┼─────────────────┐
▼ ▼ ▼
┌──────┐ ┌────────┐ ┌──────────┐
│SWARM │ │ GNOSIS │ │ PSS │
│ (req/│ │(escrow,│ │ (job ack,│
│ resp)│ │ claim) │ │ deliver) │
└──────┘ └────────┘ └──────────┘
▲ ▲ ▲
│ │ │
└──────────┐ │ ┌─────────────┘
▼ ▼ ▼
┌──────────────┐
│ T4T provider │ ┌──────────────┐
│ (you / a │ ──► │ Ollama / vLLM│
│ peer) │ ◄── │ (local GPU) │
└──────────────┘ └──────────────┘
Step by step:
- Gateway picks a provider by reading the on-chain registry and filtering on model + price + reputation.
- Gateway uploads the encrypted prompt to Swarm (ECIES to the provider's pubkey), getting back a 32-byte content hash.
- Gateway calls
postJobonJobEscrow, lockingmaxPaymentxBZZ. The job is identified by the Swarm hash; the on-chain state stores only the hash + payment terms. - Gateway notifies the provider over PSS, signed and pinned to that job ID.
- Provider fetches from Swarm, decrypts, runs inference against its local Ollama/vLLM, uploads the response back to Swarm, then PSS-delivers the response hash to the gateway.
- Gateway fetches the response from Swarm and streams it back to your app.
- Provider calls
claimJobwith the actual token counts. Escrow pays the provider, refunds the excess to the gateway. Done.
If the provider misses the ACK deadline or the delivery deadline, the gateway cancels the job and the provider's stake is slashed and burned (not paid to the gateway — that would invert the incentive and reward grief). Full protocol: docs/spec.md. Sequence detail: docs/flow.md.
t4t/
├── contracts/ # Foundry: ProviderRegistry, JobEscrow
│ ├── src/
│ ├── test/
│ └── script/Deploy.s.sol
├── container/ # TS: one image, two modes
│ ├── src/
│ │ ├── lib/ # envelope, swarm, chain, ollama, crypto, config
│ │ ├── modes/gateway/
│ │ └── modes/provider/
│ ├── test/
│ └── Dockerfile
├── docs/
│ ├── spec.md
│ ├── flow.md
│ ├── architecture.md
│ ├── getting-started-gateway.md
│ └── getting-started-provider.md
├── website/ # t4t.eth landing page + live model directory
├── docker-compose.provider-example.yml # provider + ollama (+ optional bee)
├── docker-compose.gateway-example.yml # gateway + open-webui (+ optional bee)
└── Makefile
Prereqs: Foundry, Node ≥ 20, Docker (optional), a Bee node, an Ollama node, and a Gnosis Chain RPC.
make install # forge install + npm install
make test # forge test + vitest (hermetic)
make build # forge build + tsc
make docker # build container image (or `docker pull ghcr.io/token-for-token/t4t`)Run the contract suite end-to-end against a Gnosis Chain fork and the real xBZZ ERC-20 — mirrors SwarmChat's fork-test pattern:
FORK_GNOSIS_RPC_URL=https://rpc.gnosischain.com make test-contracts-forkWallets are seeded via vm.deal; no whale impersonation needed. Excluded
from make test so the default loop stays hermetic.
- Run Anvil forked from Gnosis:
make anvil - Deploy contracts:
make deploy-local(writes addresses to console) - Copy the relevant example (
docker-compose.provider-example.ymlordocker-compose.gateway-example.yml) →docker-compose.yml. Defaults work against the live Gnosis-mainnet deployment; the admin UI handles wallet onboarding on first boot. docker compose up bee ollama- Pull a model:
docker exec -it $(docker compose ps -q ollama) ollama pull llama3:8b docker compose up t4t-provider t4t-gateway- Point any OpenAI-compatible app at
http://localhost:8080/v1
See docs/getting-started-gateway.md and docs/getting-started-provider.md for details.
Scaffold for M1 ("Loop closed"). Cipher is currently a passthrough — see container/src/lib/crypto.ts. ECIES wire-up and event-indexed claimJob resolution land before M2. Roadmap in docs/spec.md §12.
Inspired by SwarmChat — same envelope discipline, same Gnosis + Swarm substrate.
