Connect an agent
One endpoint, no account and no key. Send JSON, get JSON.
POST https://api.versemesh.org/rpc
Run a program
curl -s https://api.versemesh.org/rpc -d '{"op":"run_verified","input":"68","code":"(module (memory (export \"memory\") 2) (func (export \"run\") (param i32 i32 i32) (result i32) (i32.store8 (local.get 2) (i32.add (i32.load8_u (local.get 0)) (i32.const 1))) (i32.const 1)))"}'
One machine runs it and signs a receipt. A second machine runs it again. The answer has both:
{ "ok": true, "output": "69", "fuel": 8, "state": "reproduced", "receipt": { … }, "signed_verdict": { … } }
state is what the second machine found: reproduced (same output, same fuel), mismatch (the first machine
is caught) or abstained (nobody could judge). input and output are hex. code is WebAssembly text;
send wasm instead for a compiled module, as hex. What a program may do: How it works; a full example with a real run: Sandbox.
The same job asked again (the same program, input and limits) comes back at once with "cached": true: the
receipt and the signed verdict of the run that was already re-run, which you check exactly as a fresh one. A
run is the same every time, so nothing is run twice. Name a machine with provider to have it run anyway.
Ask a model
curl -s https://api.versemesh.org/rpc -d '{"op":"chat","question":"What do bees make?"}'
text is the answer, from SmolLM2-135M-Instruct, with the same state, receipt and signed_verdict. It is
a small model: the re-run shows it ran as written, not that it is right.
With an OpenAI client
curl -s https://api.versemesh.org/v1/chat/completions -d '{"messages":[{"role":"user","content":"What do bees make?"}]}'
The same model in the shape most tools already speak. A client that takes a base URL needs no new code: give
it https://api.versemesh.org/v1 and any key. The OpenAI SDK in Python and JavaScript, with a real run: OpenAI SDK. GET /v1/models names the one model. The answer is an ordinary
chat.completion with one more field, verse: the state, the receipt and the signed_verdict.
What differs from OpenAI:
- Only a reproduced answer comes back as a completion. One the second computer got different, or that no second computer could check, is an error (502), since an OpenAI client reads only the text.
- One question a call: the last
usermessage, at most 500 bytes. A system message and earlier turns are not read. - No sampling. The answer is fixed by the model and the question, which is what lets a second machine
reproduce it.
temperatureand the like are ignored. - At most 96 tokens, no
usage, andstream: truesends the whole answer as one piece, once it has been re-run.
Keep data
curl -s https://api.versemesh.org/rpc -d '{"op":"store","data":"68656c6c6f"}'
curl -s https://api.versemesh.org/rpc -d '{"op":"get","cid":"ea8f163db38682925e4491c5e58d4bb3506ef8c14eb78a86e908c5624a67200f"}'
store answers with cid, the BLAKE3 hash of the bytes, and how many machines hold them. get gives the
bytes back as data; hash them and you know they are the ones you stored. This is a testnet: keep nothing
there that you need.
Keep state
An object is a program and a name whose state lasts, in the shape of a Cloudflare Durable Object. Store the
program once with store (a wasm file, as hex), then call the object by name. This one is a ledger already on
the network:
curl -s https://api.versemesh.org/rpc -d '{"op":"object","class":"39832383f717c1fa4fbd2e83ef95b47a105588c4454c0f0152d61acc779b1a3a","name":"live-test","method":"GET","path":"/remaining"}'
Calls to one object run one at a time, in order. A second computer re-runs each call before it counts; only
then are its writes kept and the answer sent, with status, body, the receipt, the signed_verdict and the
object’s new seq. A refused call (status 400 or more) writes nothing. object_history lists every step, and
the SDK’s verifyObjectHistory checks each one without trusting the bridge. Each head is also cosigned by a
witness, which never cosigns two heads at one step: a reader who checks the cosignature cannot be shown two
different histories. A class has one function, fetch(request, storage), with storage.get, put, delete
and list. An object’s state is public and at most 4 MiB.
A class can be JavaScript, written as a Cloudflare Durable Object: export class Counter extends DurableObject
with a fetch(request) that uses this.ctx.storage. examples/js/make-class.mjs writes the file into a
JavaScript engine, and the wasm it writes is the class. This counter is one:
curl -s https://api.versemesh.org/rpc -d '{"op":"object","class":"877842372e165ea777e712984b1e23baa5b8fa29258c4c7170c0d13a9cef798d","name":"try","method":"POST","path":"/increment"}'
Its clock is the time the object’s sequencer writes into each call, the same in the call’s re-run. The step’s
head says that time too, and a witness cosigns it only within 30 seconds ahead of its own clock or 10 minutes
behind, and never before the step before. It has no network, but it can set an alarm (ctx.storage.setAlarm, rung
once at alarm()) and send a call to another object (env.send, delivered once the step is committed); it keeps
values as JSON. examples/js/README.md lists what else differs from Cloudflare.
Every object also has its own address, which takes any method and body and answers with the object’s status
and body, as a Worker’s URL does. X-Verse-Seq and X-Verse-State say which step the call was and whether a
second computer reproduced it:
curl -si -X POST https://api.versemesh.org/o/877842372e165ea777e712984b1e23baa5b8fa29258c4c7170c0d13a9cef798d/try/increment
Run commands
A shell is one such program: its object’s state is a set of files, and a POST runs the body as a script over
them. The answer’s body is the exit status on its first line, then what a terminal would show. The files the
script changed are kept for the next call.
curl -s https://api.versemesh.org/rpc -d '{"op":"object","class":"fab0fb09ae1b3ef7b306318ee23719f3c175ca2647a4377bae8d37e6656c5546","name":"try","method":"POST","path":"/","body":"echo hi > hello.txt && wc -c hello.txt"}'
Pick your own name for your own files: anyone who knows a name can read and change its files. It has pipes,
redirections, here-documents and globs, and cat cd cp cut echo find grep head ls mkdir mv printf pwd rm sed seq sort tail touch tr uniq wc. No loops, no network, no clock. Each call is re-run on a second computer like any
other. The source is examples/sh. The coding agent pi can use it as its computer: pi -e examples/pi/verse.ts --verse <name> runs pi’s bash, read, write and edit there, with whatever model pi is set to use.
Run across machines
A graph is runs that build on runs, for work no one machine does, such as a deep net whose layers are cut across
machines. A node is a stored program, its own input and its data (weights). after names earlier nodes it builds
on: their output ids come first in its input, in that order, and the outputs are its data after its own. Nodes
whose inputs are ready run at the same time, each on a machine that already keeps its data, and each is re-run
before the answer is sent:
{"op":"graph","nodes":[
{"id":"x","code":"<a stored program's id>","input":"<hex>"},
{"id":"top","code":"<id>","after":["x"],"input":"<weights' id>","data":["<weights' id>"]},
{"id":"bottom","code":"<id>","after":["x"],"input":"<id>","data":["<id>"]},
{"id":"y","code":"<id>","after":["top","bottom"]}]}
The answer is the last nodes’ outputs, with every node’s receipt and signed verdict, and the SDK’s verifyGraph
checks all of it without trusting the bridge (runGraph sends a graph, follows it and checks it in one call). "check": 16 re-runs one node in 16 instead of every one; the answer
then says sampled. A node with "when":"<id>" runs only if that node’s output has a line that is its id, so a
router picks a layer’s experts in the same request; the others are skipped. A data blob named with its size, {"cid":"<id>","bytes":<size>}, is read by the machines
straight from the stores, so large weights never pass through the bridge. Nor do the outputs in the middle: each
stays on the machine that made it, and the nodes after it read it there; only the last nodes’ outputs, and a
router’s, come to the bridge. A last node with "stay":true keeps its output on its machine too: the answer names
it as cid:<id>, with its run’s bytes and epicenter, and a later graph that names it in data as
{"cid":"<id>","bytes":<bytes>,"at":"<epicenter>"} runs where it is (state that lasts from one request to the
next, such as an attention cache). A graph holds at most 256 nodes. It is
answered within 90 seconds, or with "follow":true at once with its id, and {"op":"graph_status","graph":"<id>"}
gives the answer when it ends. examples/graph has the programs of a two-layer network run this way.
Limits
- 20 requests a second from one address. A request is at most 1 MB, so an upload is at most about 750 KB sent
as base64 (
"data64"in place of"data"), 500 KB as hex. One address may store 8 MiB, then 4 KiB a second. - A program gets 50 million units of fuel unless you send
"fuel"(at most 5 billion), and 256 MiB of memory. - A question is at most 500 bytes, an answer at most 96 tokens.
Is it up
https://api.versemesh.org/status: every five minutes the bridge sends a small program to one computer and
has a second re-run it. It lists the newest results and the share that passed over the last 1, 7 and 90 days;
a time nothing was checked counts as down.
Check it yourself
receipt is signed by the machine that ran the job and signed_verdict by the one that re-ran it, both
with ed25519. On this network the second one’s key is
599808ac51782a0bee5360804836ac4fcdae3da30891a0cbc2f8a6c6ff6b111d. What is checked and what is still
trusted: Security.