18+ only. Gambling can be addictive. National Responsible Gambling Programme 0800 006 008.

Open source

Fair Draw is open source

Everything that decides a draw is published under the MIT licence: the library that runs in your browser, the API on this domain, its OpenAPI description and the written specification with test vectors. Nothing about a draw depends on trusting BetTip.

What is published

  • The library, @bettip/fair-draw: commitment, beacon fetch and BLS verification, the draw rule, proof encoding. It is the same code this site runs; the site vendors it unchanged.
  • The API at https://bettip.co.za/api/v1/fair-draw/: round, commit, draw and verify. Free, no key, no account. The API and library page has the calls.
  • The OpenAPI 3.1 description, served at /api/v1/fair-draw/openapi.json and at /fair-draw/openapi.json; the two files are identical.
  • The specification, FAIR-DRAW v1: how a draw description is canonicalised and hashed, how the seed is made from the beacon output and the commitment, how the shuffle and rejection sampling work, with test vectors you can reproduce in any language.

Where it lives

The source repository is github.com/bettip-co-za/fair-draw, published by BetTip. The package is @bettip/fair-draw on npm. If either address does not answer yet, the code is still on this site: every Fair Draw page loads the library from /_astro/, and the specification is reproduced on how it works.

The licence

MIT. You may use, copy, change and redistribute the library, the API client code and the specification, commercially or not, with the copyright notice kept. There is no warranty. The randomness itself comes from drand, a public beacon run by independent organisations, and is not BetTip's to license.

Check a draw without trusting us

  1. Take any result link. The part after # is the whole proof: the draw description, its commitment, the beacon round and signature, and the winners.
  2. Recompute the commitment: SHA-256 of the canonical JSON of the description.
  3. Verify the beacon signature for that round under drand's quicknet public key.
  4. Derive the seed as SHA-256 of the randomness followed by the commitment, run the published shuffle, and compare the winners.

The verify page does these steps in your browser; the library does them in yours or on a server.

Contributing

Issues and pull requests go to the repository. Changes to the draw rule itself would change every existing proof, so the rule is versioned: FAIR-DRAW v1 stays valid for every proof that names it, and a new rule would be v2.