SlabtestnetRun a node

Docs

Gateway HTTP API

slab-gateway serves Slab data over plain HTTP. Reads are open; uploads are optional and paid from the gateway's wallet.

Running a gateway

slab-gateway --listen 127.0.0.1:8080                 # read-only, joins the testnet
slab-gateway --listen 127.0.0.1:8080 --wallet w.json # also accepts uploads
slab-gateway --site <owner>/<topic>                  # serve a feed as a website at /
OptionMeaning
--listenHTTP address (default 127.0.0.1:8080)
--peerbootstrap node (repeatable); default: the public testnet
--walletwallet to pay uploads from; enables POST /bytes and POST /slab
--siteserve a feed’s directory at /; the link paste page moves to /gateway

Reading

Method and pathReturns
GET /bytes/{ref}the file’s raw content (400 for a directory)
GET /slab/{ref}/a directory’s index.html, or the file itself
GET /slab/{ref}/{path}a file inside a directory, with its content type
GET /feeds/{owner}/{topic}the feed’s current {"seq", "reference"}
GET /feeds/{owner}/{topic}/{path}what the feed points at, like /slab
GET /v0/file/{root}?key=<hex>[&name=<file>]the original form; name sets Content-Disposition
GET /healthzok
  • Ranges. Every read supports one HTTP Range (206 with Content-Range, 416 if unsatisfiable) and fetches only the slabs it covers, so video seeking works.
  • Errors. A fetch that fails on the network gives 502.
  • Isolation. Content under /slab and /bytes is served with Content-Security-Policy: sandbox allow-scripts allow-forms allow-popups allow-downloads and X-Content-Type-Options: nosniff: sites run without the gateway’s origin, so they can’t read each other’s storage or call the upload API.

Uploading

Only with --wallet. Each upload is paid from that wallet, one voucher per slab.

Method and pathDoes
POST /bytesstore the body as a file → 201 {"reference": "<128 hex>"}
POST /slab?name=<file name>store the body as a one-file directory
curl -X POST --data-binary @photo.jpg \
  -H "Authorization: Bearer $(cat w.json.token)" \
  -H "Content-Type: image/jpeg" \
  http://127.0.0.1:8080/bytes
  • Auth. Authorization: Bearer <token>; the token is created on first start in <wallet>.token (0600). The Host header must name the gateway’s listen address. Together these stop web pages you visit from spending the wallet (no CORS preflight passes, and DNS rebinding fails the Host check).
  • Size. A Content-Length is required (vouchers are taken up front; 411 without it), up to about 2 GiB (413 above). Bodies are streamed to the network; a 300 MB upload peaked at 27 MiB of gateway memory.
  • Uploads run one at a time. Tar collections (POST /slab with application/x-tar) aren’t supported; upload directories with slab put <dir>.

Coming from Swarm

/bzz is an alias of /slab for every route above, so tools written for a Bee gateway (scripts, curl one-liners, site deploy tooling) can talk to a Slab gateway by changing the base URL. Only the paths match: a Swarm reference doesn’t resolve on Slab and a Slab reference doesn’t resolve on Swarm, so content has to be uploaded to Slab first. Bee’s swarm-postage-batch-id header is ignored: Slab uploads are paid by vouchers in the gateway’s wallet, not postage stamps.