bitsig

A verifiable randomness API.

Random values, scheduled drawings and daily seeds over plain HTTP, each one recomputable from the public drand beacon and signed by bitsig. No key, no account, CORS open.

curl bitsig.net/d20
curl bitsig.net/pick?red,green,blue
curl bitsig.net/today
curl bitsig.net/draw -d choices=a,b,c -d winners=1 -d in=60

What comes back

Plain text by default, so curl bitsig.net/d20 prints a number. Add ?json or send Accept: application/json for the full record:

{
  "kind": "result",
  "v": 1,
  "result": 4,
  "op": "d20",
  "round": 34182798,
  "seed": "9167074b0ee20bdb131624451af42cb7",
  "randomness": "2f7afdba9cba761738b640db480d03bdc227aecff0f39ad537f3fe308ea582ac",
  "signature": "a8febb15…623e755d",
  "beacon": "drand quicknet",
  "verify": "https://bitsig.net/verify?op=d20&round=34182798&seed=9167074b0ee20bdb131624451af42cb7",
  "bitsig": { "alg": "Ed25519", "key": "2907723a1e0413bb", "sig": "ckApy5CK…qOzeDQ" }
}

round is the drand quicknet round the result came from, and signature and randomness are that round as drand published it. seed separates this result from every other result drawn from the same round. bitsig is bitsig’s Ed25519 signature over the rest of the record.

Check a result yourself

A result is only worth something if you don’t have to trust bitsig for it. Three checks cover it, and none of them calls bitsig except to fetch its public key:

  1. The round is genuine. drand publishes a new round every 3 seconds, signed by the League of Entropy’s threshold key. Fetch the round from drand itself, check its BLS signature against the quicknet public key, and check that randomness is SHA-256 of the signature.
  2. The result follows from the round. Every operation reads from one byte stream, block(i) = SHA-256(R ‖ seed ‖ uint32_be(i)), with a fixed rule for turning bytes into a die roll, a pick, a shuffle or groups. The rules and test vectors are in the specification.
  3. bitsig said so. The bitsig field is an Ed25519 signature over the record’s canonical JSON (keys sorted, no whitespace, UTF-8). The public key is at /key and pinned in the project README.

JavaScript (browser or Deno)

import { fetchBeacon, parseOp, runOp } from "https://bitsig.net/random.js";
import { verifyBeacon } from "https://bitsig.net/drand.js";
import { verifyRecord } from "https://bitsig.net/sign.js";

const r = await (await fetch("https://bitsig.net/d20?json")).json();

// 1. Fetch the round from drand and check its BLS signature.
const beacon = await fetchBeacon(r.round, undefined, {}, verifyBeacon);

// 2. Recompute the result from the round and the seed.
const again = await runOp(parseOp(r.op), beacon.randomness, r.seed);

// 3. Check bitsig's signature.
const { public_key } = await (await fetch("https://bitsig.net/key")).json();
console.log(again.value === r.result, beacon.verified, await verifyRecord(public_key, r));

Python

bitsg.py is one file, standard library only, plus cryptography for bitsig’s signature and py_ecc for drand’s.

import bitsg
d = bitsg.draw(["alice", "bob", "carol"], at="2026-12-01T09:00", tz="Asia/Singapore")
print(d["url"])
r = bitsg.get(d["id"])      # after the drawing time
bitsg.verify_draw(r)        # drand round checked, result recomputed
bitsg.verify_signature(r)   # signed by bitsig

The verify page runs the same checks in the browser for anyone who doesn’t write code.

Instant results and scheduled drawings

An instant result such as /d20 uses a round that is already public, so whoever asked for it could have asked again until they liked the answer. That’s fine for picking a lunch spot and wrong for a prize.

When the result has to be fair to other people, make a scheduled drawing. POST /draw fixes the entry list, the seed and a future round, and returns a link and a signed creation receipt straight away. bitsig refuses a round less than two rounds ahead. Nobody, bitsig included, can know the result until drand publishes that round, and the list can’t change after the link exists. Add callback=https://… and bitsig posts the signed result to your server when it arrives. Check it against drand rather than trusting the callback.

To show you didn’t make several drawings and keep the one you liked, create an organizer with POST /organizer and pass its token on every drawing. Each drawing becomes the next numbered entry in a public, hash-chained log at /o/<id>.

Why not call drand directly?

If you need 32 public random bytes every 3 seconds, call drand directly. It’s free, and its documentation covers the HTTP API. bitsig is a layer on top for the parts drand leaves to you:

The randomness itself still comes from drand. bitsig’s signature shows what bitsig published and when; it adds no randomness, and it doesn’t ask you to trust bitsig for the result.

What not to use it for

Never use bitsig output, or any public beacon output, for passwords, keys or anything that must stay secret. Every value is public the moment its round is published. Lists are capped at 1,000,000 entries of up to 200 characters each when picking winners, and at 10,000 entries for full orders, groups and weighted lotteries.

Reference