Quantum-Entropy / README.md
LightRiderInc's picture
Update README.md
c96bdb8 verified
|
Raw History Blame Contribute Delete
3.5 kB
metadata
title: Light Rider Quantum Entropy
emoji: ⚛️
colorFrom: red
colorTo: yellow
sdk: gradio
sdk_version: 6.30.0
app_file: app.py
pinned: false
tags:
  - quantum
  - randomness
  - entropy
  - quantum-computing
license: apache-2.0
short_description: Quantum random bytes with signed, verifiable receipts
datasets:
  - LightRiderInc/random-quantum-circuits

Light Rider Quantum Entropy

Draw random bytes from a named quantum source: a quantum random number generator or a quantum processor. Every draw comes with a receipt, signed by Light Rider, that records which source produced the bytes and when. The app checks the signature and shows you the result.

It's an alternative entropy source you can verify, not a claim that quantum randomness beats a good classical generator. If a source can't serve, the app says so; no other source is used in its place.

Use it from your code

macOS / Linux

For this terminal

export LR_API_KEY="lr_live_YOUR_KEY"

32 bytes from one source

curl -s https://entropy.lightriderinc.com/api/v1/entropy \
  -H "Authorization: Bearer $LR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid)" \
  -d '{"bytes": 32, "mode": "source", "id": "anu"}'

Windows PowerShell

For this window

$env:LR_API_KEY = "lr_live_YOUR_KEY"

32 bytes from one source

$headers = @{ Authorization = "Bearer $env:LR_API_KEY"; "Idempotency-Key" = [guid]::NewGuid().ToString() }
$body = @{ bytes = 32; mode = "source"; id = "anu" } | ConvertTo-Json
$r = Invoke-RestMethod -Method Post -Uri https://entropy.lightriderinc.com/api/v1/entropy -Headers $headers -ContentType "application/json" -Body $body
$r.bytes_hex
$r.receipt.contributing_sources

Python

Install (in a terminal)

pip install -U lightrider

entropy_demo.py

import os
from getpass import getpass

if not os.environ.get("LR_API_KEY"):
    os.environ["LR_API_KEY"] = getpass("Light Rider API key: ")

import lightrider as lr

for s in lr.entropy.sources():
    print(s.alias or s.id, s.state, s.bytes_available)

r = lr.entropy.get(32, source="anu")
print(r.hex)
print(r.sources, r.request_id)

pool = lr.entropy.get(64, sources=["anu", "cisco"])
print(pool.sources)

assert lr.entropy.verify(r.receipt)
assert lr.entropy.verify_commitment(r)
print("Receipt verified")

Run it (in a terminal)

python entropy_demo.py

Google Colab

Cell 1: install

!pip install -q -U lightrider

Cell 2: your key, from Colab Secrets (key icon, name LR_API_KEY, notebook access on)

import os
from google.colab import userdata

os.environ["LR_API_KEY"] = userdata.get("LR_API_KEY")

Cell 3: draw and verify

import lightrider as lr

for s in lr.entropy.sources():
    print(s.alias or s.id, s.state, s.bytes_available)

r = lr.entropy.get(32, source="anu")
print(r.hex)
print(r.sources, r.request_id)

pool = lr.entropy.get(64, sources=["anu", "cisco"])
print(pool.sources)

assert lr.entropy.verify(r.receipt)
assert lr.entropy.verify_commitment(r)
print("Receipt verified")

Create your API key at entropy.lightriderinc.com/developers. It gives full access to your account, so keep it out of public code. Sources: anu, cisco, qispace, rigetti, iqm, iqm-qec. Price: 1 credit ($0.01) per 256 bytes.