Skip to main content

Sortes — true ECVRF verifiable-randomness oracle

Sortes draws lots you can verify. It is a true Verifiable Random Function implementing ECVRF-EDWARDS25519-SHA512-TAI exactly per RFC 9381 (suite octet 0x03, over the edwards25519 curve).

For a fixed (public_key, alpha) there is exactly one valid output beta. The oracle's secret key selects it deterministically, so — unlike a trusted randomness beacon — the oracle cannot grind or bias the result, and anyone holding the VRF public key can verify the draw offline from the 80-byte proof.

Capabilities

capability price what it does
sortes.draw@v1 $0.006 Draw verifiable randomness for alpha. Returns public_key, proof (gamma, c, s, pi), beta, and output (uniform num_bytes). The secret key is never returned.
sortes.verify@v1 $0.001 Verify (public_key, alpha, pi) offline and trustlessly → {valid, beta}.

alpha is UTF-8 by default; prefix with hex: to pass raw bytes.

Why it is correct

The implementation is pure Python (hashlib + integer math) — the edwards25519 group arithmetic (RFC 8032 §5.1) and the ECVRF construction (RFC 9381 §5) are written from scratch, no external crypto libraries. Correctness is proven by the RFC 9381 Appendix B.3 test vectors: the tests assert that our implementation reproduces the published SK→PK, the hash-to-curve point H, the proof commitment Gamma, the VRF output beta, and the full 80-byte proof pi byte-for-byte for all three vectors. The full-pi check pins the little-endian c || s encoding mandated by RFC 9381 §5.5, so the proofs are byte-interoperable with a conformant verifier (e.g. libsodium), not merely self-consistent; the tests also confirm the RFC's own published pi bytes verify under our verifier. See tests/test_sortes.py.

VRF keypair

The oracle holds one VRF keypair. The 32-byte secret key is resolved from SORTES_VRF_SK (64 hex chars), else a persisted key at SORTES_VRF_SK_PATH (default data/sortes_vrf_sk), else generated once and persisted so the public key stays stable across restarts. The secret key never leaves the process; the public key is published in every draw and in the manifest description.

Run

# tests (from the monorepo root)
PYTHONPATH="oracles/core:oracles/oracles/sortes" \
  platon/backend/.venv/bin/python -m pytest oracles/oracles/sortes/tests/ -q

# serve (port 9310 by default)
PYTHONPATH="oracles/core:oracles/oracles/sortes" python -m sortes.main

Environment

var default meaning
SORTES_PORT 9310 listen port
SORTES_PUBLIC_URL http://localhost:9310 advertised base URL
SORTES_SIGNING_KEY data/sortes_signing_key manifest/receipt signing key path
SORTES_VRF_SK (unset) explicit 32-byte VRF secret key (hex)
SORTES_VRF_SK_PATH data/sortes_vrf_sk persisted VRF secret key path
SORTES_CORS_ORIGINS * allowed CORS origins

Metadata

Release files for aimarket-oracle-sortes 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aimarket-oracle-sortes 0.1.2
File Size Uploaded Provenance Actions
aimarket_oracle_sortes-0.1.2.tar.gz 20.8 kB Without provenance Details for aimarket_oracle_sortes-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aimarket-oracle-sortes 0.1.2
File Interpreter ABI Platform Actions
aimarket_oracle_sortes-0.1.2-py3-none-any.whl Python 3 none any Details for aimarket_oracle_sortes-0.1.2-py3-none-any.whl

Total release size: 36.2 kB

Release files / aimarket_oracle_sortes-0.1.2.tar.gz

Download URL aimarket_oracle_sortes-0.1.2.tar.gz
Size 20.8 kB
Tags Source
SHA-256 checksum
How to use checksums
5efaba3c5c74e81a65bf76a2a95b96ef51ed97f0d16f6e54be8e6a4280508ba1
BLAKE2b-256 checksum
How to use checksums
3b6181492c8b27a58882e6b7454ff037df4aae373ee15cc8190da2a638f294ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / aimarket_oracle_sortes-0.1.2-py3-none-any.whl

Download URL aimarket_oracle_sortes-0.1.2-py3-none-any.whl
Size 15.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c5103cfad3d333ce97b9b3e316d2362f45581f3552c36759feb76907349d2505
BLAKE2b-256 checksum
How to use checksums
d542b5058fd12eacd873e347161d19673ee07f5c4bb9645907c658293477e93d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for aimarket-oracle-sortes 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page