Docs.
What it does
bit.sg makes random results that other people can trust without having to trust you, or bit.sg.
An ordinary randomizer runs on one computer, and nobody else can tell whether it was rerun until the preferred answer came up. bit.sg takes its randomness from drand, a public beacon run jointly by independent organizations. It publishes a new value every 3 seconds, and no single party can predict or steer it. Every result names the beacon round and seed it used, so anyone can recompute it, and bit.sg signs each one so a copy can’t be edited.
Because beacon rounds are fixed to the clock, you can commit before the randomness exists: announce a draw for Friday at noon, and nobody, including you, can know the winner until then. An organizer log shows whether anyone made extra draws.
Instant results (a coin flip on the home page, say) use a round that is already public, so they can be checked but could have been retried. For anything that matters, set the time first with a draw or a seed.
Typical uses: giveaways and raffles, picking who goes first, assigning reviewers or audit samples, tie-breaks, games, and research randomization.
Functions
- Random
- Bits, coins, dice, numbers, picks and shuffles from a public randomness beacon. Each result names its round and seed, so anyone can recompute it.
- Fair draw
- Pick winners at a time set in advance. Share the link before the draw; nobody, including you, can know the result until then.
- Organizers
- A public, numbered log of every draw you make, so a redone draw can’t be hidden.
- Seeds
- One random number per moment, named by its time. Announce the time first, use the seed after. Today’s seed.
- Callbacks
- bit.sg sends the result to your server when it arrives.
- Sign
- A receipt signed by bit.sg showing a file or text existed at a time. Only its fingerprint leaves your device.
- Signatures
- Every result and receipt is signed by bit.sg’s key, so a copy can’t be altered unnoticed.
- Verify
- Check any result or receipt yourself, on the verify page or with a few lines of Python.
- The shared bit
- The square in the corner is one bit shared by everyone on the site. Tap it to flip it.
Random
bit.sg | 0 or 1 |
bit.sg/256 | 256 bits (max 4096) |
bit.sg/coin | heads or tails |
bit.sg/d20 | die, any sides |
bit.sg/1-100 | integer, inclusive |
bit.sg/hex/32 | bytes as hex (max 1024) |
bit.sg/pick?a,b,c | one item |
bit.sg/shuffle?a,b,c | items in random order |
bit.sg/today | today’s seed (round at 00:00 UTC) |
bit.sg/day/2026-12-01 | the seed for any date |
bit.sg/seed?at=2026-12-01T09:00Z | the seed for a moment, past or future |
POST bit.sg/sign | signed receipt for a SHA-256 |
bit.sg/key | bit.sg’s public key |
POST bit.sg/draw | make a fair draw |
bit.sg/draw/ID | its status or result |
POST bit.sg/organizer | start a public draw log |
bit.sg/o/ID | an organizer’s log |
bit.sg/state | the shared bit |
POST bit.sg/flip | flip it |
Options: seed=, round=, json. Joined with &.
Fair draw
$ curl bit.sg/draw -d choices=alice,bob,carol -d in=60
https://bit.sg/draw/k3x9m2pq7a
draws 2026-11-17T03:10:00.000Z
$ curl bit.sg/draw/k3x9m2pq7a
bob
Fields: choices, title, mode (winners, order or groups) with winners or groups, and one of in (seconds), at (ISO time; add tz=Asia/Singapore to give a local time without an offset) or round. JSON in, JSON out with Accept: application/json. The seed is the draw ID. Share the link before the draw time.
Organizers
An organizer is a public, numbered log of every draw made with its token. Nobody can make a draw under your name and hide it, including you, so a redone draw shows up as #2. Announce your log link once; a draw without an organizer proves nothing about how many others were made.
$ curl bit.sg/organizer -d name='Acme giveaways'
id q7h2m4x9ka
token bsg_…
page https://bit.sg/o/q7h2m4x9ka
$ curl bit.sg/draw -H 'Authorization: Bearer bsg_…' -d choices=a,b,c -d in=60
$ curl 'bit.sg/o/q7h2m4x9ka?json'
The token is shown once and bit.sg stores only its hash. Each entry links to the one before it: entry = SHA-256 of the canonical JSON of {organizer, seq, prev, draw, title, op, winners, round, created_at} (plus groups for a draw split into groups), with prev = the previous entry, or 64 zeros for #1. The log is signed by bit.sg, so a saved copy shows later tampering.
Seeds
A seed is the 32-byte randomness of one drand round, named by time. Announce the time first, use the seed after. Add as=u32 or as=u64 for an integer. A future time answers 425 with Retry-After until it arrives.
$ curl bit.sg/today
$ curl 'bit.sg/seed?at=2026-12-01T09:00:00Z&as=u32'
Callbacks
Add callback=https://… to POST /seed or POST /draw and bit.sg posts the JSON result to that URL when it arrives. Up to three tries. Check the result against drand rather than trusting the callback.
$ curl bit.sg/seed -d at=2026-12-01T09:00:00Z -d callback=https://example.com/hook
Sign
Send a SHA-256 and get back a receipt signed by bit.sg: the fingerprint, the time, and the latest drand round, which proves the receipt was made after that round. bit.sg keeps nothing.
$ curl bit.sg/sign -d hash=$(sha256sum file.pdf | cut -d' ' -f1)
$ curl bit.sg/sign -d text='hello' -d label='note'
Signatures
Results, seeds, draws, draw receipts and sign receipts carry a bitsig: an Ed25519 signature by bit.sg over the record’s canonical JSON (the record without bitsig, keys sorted, no whitespace, UTF-8). Public key: /key, /key.pem. Key id 2907723a1e0413bb.
import base64, json, sys, urllib.request
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PublicKey
rec = json.load(open(sys.argv[1])); sig = rec.pop("bitsig")
key = json.load(urllib.request.urlopen("https://bit.sg/key"))
assert sig["key"] == key["key_id"]
pub = Ed25519PublicKey.from_public_bytes(base64.urlsafe_b64decode(key["public_key"] + "=="))
msg = json.dumps(rec, sort_keys=True, separators=(",", ":"), ensure_ascii=False).encode()
pub.verify(base64.urlsafe_b64decode(sig["sig"] + "=="), msg)
print("signed by bit.sg")
Clients
Python: bitsg.py, one file, standard library only (signature checks need cryptography). It makes draws and recomputes results from drand.
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 draw time
bitsg.verify_draw(r) # recomputed from the public beacon
bitsg.verify_signature(r) # signed by bit.sg
JavaScript: /random.js (derivation and beacon checks) and /sign.js (signature checks) are plain ES modules you can import in a browser or Deno.
Method
- R = SHA-256 of the signature on drand quicknet round N. The League of Entropy signs each round with a threshold BLS key.
- Block i = SHA-256(R ‖ seed ‖ i as uint32 big-endian).
- Bits and hex: read from the front, MSB first. Coin: first bit, 1 = heads.
- Ranges: 4-byte words, rejection-sampled.
- Shuffle: Fisher–Yates, last item down.
Source: /random.js
Check in Python
import hashlib, json, sys, urllib.request
chain = "52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971"
rnd, seed = sys.argv[1], sys.argv[2]
b = json.load(urllib.request.urlopen(f"https://api.drand.sh/{chain}/public/{rnd}"))
r = bytes.fromhex(b["randomness"])
print(hashlib.sha256(r + seed.encode() + bytes(4)).digest()[0] >> 7)