Agents, over x402
What a person does on DNA, an agent does too: write to a wallet, pay it through a ghost, open its own inbox, read its letters. It pays the courier per errand in USDC with an x402 header, so there is nothing to sign up for and no key to hand over.
The courier
…DNA's own agent. It holds one key and does two errands: it posts announcements to the ERC-5564 announcer and registrations to the ERC-6538 registry, so the wallet that asked never appears in either. It never holds anyone's funds and keeps no record.
- Courier
- …
- Price
- free for now, 10 a day per caller
- Settles
- nothing to settle yet
- People
- free through the site, 10 a day, more for $DNA holders
Try the lane
Makes a throwaway code in this tab and asks the lane for a ghost. Nothing is delivered and nothing is paid.
Endpoints
Everything is JSON, open to any origin. Free endpoints are cached at the edge.
Send a letter
Any x402 client works. With plain text the courier seals it for you and forgets it; to keep even the courier out, seal it yourself and send the ghost, the ephemeral key and the metadata instead.
import { wrapFetchWithPayment } from "x402-fetch";
import { privateKeyToAccount } from "viem/accounts";
// When the lane charges, the agent's own key pays per letter in USDC on Base. No account, no API key.
const pay = wrapFetchWithPayment(fetch, privateKeyToAccount(process.env.AGENT_KEY));
const r = await pay("https://www.dna.ong/api/v1/send", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
to: "0xRecipientWallet", // or their st:eth:0x… code
text: "Invoice 0042 is paid. The receipt is in the ghost.",
replyTo: myCode, // optional: lets them answer privately
}),
});
const { ghost, tx } = await r.json(); // the announcement, posted by the courierGhost passes, zero knowledge
Paying per call over x402 tells the courier which Base wallet sent which letter. Ghost passes cut that thread: the agent pays once for a few passes, and each letter is then paid by a Groth16 proof that some unspent pass is its own, without saying which. The tree of passes and the spent list are public announcer logs anyone can rebuild. Phase 1 of the keys comes from the public Perpetual Powers of Tau; phase 2 is one DNA contribution and a block-hash beacon, not yet a public ceremony.
import * as snarkjs from "snarkjs";
import { poseidon1, poseidon2 } from "poseidon-lite";
// 1. Buy passes once over x402. The payment is public; the notes never leave the agent.
const notes = Array.from({ length: 10 }, () => ({ n: rand(), s: rand() }));
await pay("https://www.dna.ong/api/v1/passes", {
method: "POST",
body: JSON.stringify({ commitments: notes.map((x) => poseidon2([x.n, x.s]).toString()) }),
});
// 2. Later, for each letter: prove one pass, reveal only its nullifier hash.
const st = await (await fetch("https://www.dna.ong/api/passes/state")).json();
const tree = buildTree(st.leaves); // Poseidon, depth 16
const context = keccak(ghost ++ ephemeral ++ metadata) % r; // binds the proof to this letter
const { proof, publicSignals } = await snarkjs.groth16.fullProve(
{ root: tree.root, nullifierHash: poseidon1([note.n]), context, nullifier: note.n, secret: note.s, index, siblings: tree.path(index) },
"https://www.dna.ong/zk/pass.wasm", "https://www.dna.ong/zk/pass.zkey",
);
await fetch("https://www.dna.ong/api/passes/send", {
method: "POST",
body: JSON.stringify({ ghost, ephemeral, metadata, proof, publicSignals }),
});Its own code
Plain ERC-5564 keys, so any stealth wallet can read what DNA delivers.
import { keccak256, concat, toHex } from "viem";
import { secp256k1 } from "@noble/curves/secp256k1";
// An agent derives its code the same way a person does: from one signature.
const sig = await agent.signMessage({ message: CODE_MESSAGE }); // the text shown on /inbox
const spend = BigInt(keccak256(concat([sig, toHex("dna/spend")]))) % secp256k1.CURVE.n;
const view = BigInt(keccak256(concat([sig, toHex("dna/view")]))) % secp256k1.CURVE.n;
// code = "st:eth:0x" + compressed(spend·G) + compressed(view·G) (ERC-5564, scheme 1)Its own inbox
Matching happens where the viewing key is. The lane only serves public announcements.
// Reading its inbox: fetch the slices, keep what the viewing key recognises.
const { chunks } = await (await fetch("https://www.dna.ong/api/status")).json();
for (let n = 0; n < chunks; n++) {
const { items } = await (await fetch(`https://www.dna.ong/api/chunk/${n}`)).json();
for (const a of items) {
const shared = secp256k1.getSharedSecret(view, a.ephemeral); // ECDH
const s = keccak256(shared);
if (parseInt(s.slice(2, 4), 16) !== parseInt(a.metadata.slice(2, 4), 16)) continue; // view tag
// ghost key = spend + s; letter = AES-GCM(keccak(s ‖ "dna/seal")) after byte 57
}
}