Spaces:
Running
Running
File size: 3,493 Bytes
2ea4dbd 5fa19ab 2ea4dbd c96bdb8 5fa19ab 2ea4dbd 80aaaaf 5fa19ab 2ea4dbd 6414ff6 2ea4dbd 6414ff6 2ea4dbd 6414ff6 2ea4dbd 6414ff6 2ea4dbd 6414ff6 2ea4dbd 5fa19ab | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | ---
title: Light Rider Quantum Entropy
emoji: ⚛️
colorFrom: yellow
colorTo: red
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**
```bash
export LR_API_KEY="lr_live_YOUR_KEY"
```
**32 bytes from one source**
```bash
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**
```powershell
$env:LR_API_KEY = "lr_live_YOUR_KEY"
```
**32 bytes from one source**
```powershell
$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)**
```bash
pip install -U lightrider
```
**entropy_demo.py**
```python
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)**
```bash
python entropy_demo.py
```
### Google Colab
**Cell 1: install**
```python
!pip install -q -U lightrider
```
**Cell 2: your key, from Colab Secrets (key icon, name LR_API_KEY, notebook access on)**
```python
import os
from google.colab import userdata
os.environ["LR_API_KEY"] = userdata.get("LR_API_KEY")
```
**Cell 3: draw and verify**
```python
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](https://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. |