How it works
- You sign a voucher on your device: who pays, who gets it, how much, a tip and a random nonce.
- Any phone nearby can take it. Before it does, it checks the signature.
- It passes it to the next phone it meets, and so on.
- The first device with signal lands it on chain.
- The tip splits: 40% to the device that landed it, 60% evenly to everyone who carried it.
Sign a voucher
import { wallet, voucher } from "./secant.mjs";
const w = await wallet();
const v = await voucher(w, {
to: "7cVfgArCheMR6Cs4t6vz5rfnqd56vZq4ndaBrY5xkxXy",
lamports: 250_000_000, // 0.25 SOL
tip: 5_000
});| Field | Meaning |
|---|---|
v | Format version, 1. |
from | Address of the signer, derived from its public key. |
to | Who gets it. |
lamports | Amount. 1 SOL = 1,000,000,000 lamports. |
tip | What the carriers and the lander share. |
nonce | Random, so the same payment cannot land twice. |
signedAt | When it was signed, by the signer’s own clock. |
Carry it
carry() walks a voucher along a list of devices. Each one checks the signature. A voucher that was changed on the way stops at the first honest device.
import { carry } from "./secant.mjs";
const r = await carry(v, ["subway", "basement", "stairwell", "café wifi"], { online: 3 });
r.landed // true
r.tips // { "café wifi": 2000, subway: 1000, basement: 1000, stairwell: 1000 }Try it with a tampered voucher on the secant.js page.
How to know it landed
Until a device with signal lands it, a voucher is a signed promise, not money. The person getting paid should treat it that way: wait until the transfer shows up on chain before handing anything over.
WARNINGTwo vouchers can spend the same balance while both are offline. Only the first one to land goes through. This is the same trade-off every offline payment makes.