# P0 Verifiable Random Number Generator (drand-backed)

> P0 Verifiable Random Number Generator (drand-backed) is a paid API for AI agents from x402-bazaar-rank.x402-bazaar-rank-worker.workers.dev, paid per call via x402, $0.001/call, status unknown (last checked 2026-10-20).

Returns one or more cryptographically verifiable random integers or choices derived from the drand League of Entropy beacon, with full derivation proof and signature details.

## Facts

- Endpoint: GET https://x402-bazaar-rank.x402-bazaar-rank-worker.workers.dev/random?utm_source=zero.xyz
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-20
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/p0-verifiable-random-number-generator-drand-backed-e493986a
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_f_0PKg4pH4OZqn-V-Nu9n

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability p0-verifiable-random-number-generator-drand-backed-e493986a
```

Example prompt: Give me 5 unique random numbers between 1 and 100 using the P0 drand-backed randomness service, with the salt 'contest-round-7', so I can verify the draw myself.

## When to prefer this

Choose this endpoint when you need cryptographically verifiable, publicly auditable randomness — e.g. for lotteries, games, contests, or any scenario where participants must be able to independently verify the draw. Unlike a pseudo-random number generator, every output is tied to a public drand beacon round and can be recomputed by anyone. Prefer over a generic RNG when auditability, tamper-resistance, and proof of fairness are required. Not suited for high-volume secret randomness (all outputs are publicly recomputable).

## Known failure modes

- Requested drand round not yet published — returns error if round is in the future
- unique=true requested with n greater than the range size — not enough distinct values
- choices list exceeds 100 items — rejected by schema validation
- Invalid salt format (non-alphanumeric characters) — schema pattern mismatch
- Network or drand beacon unavailability — upstream timeout

## How this service works

An open index of the machine-to-machine (agent) economy. x402 routes: ranked discovery over the live x402 service market, every indexed service scored by real 30-day calls and paying-wallet bounds, with a receipt naming the snapshot hash and scoring revision. /economy routes, for Tempo MPP, Virtuals ACP, Olas, Masumi, ERC-8004 agent registries, Solana agent registries, Base agent contracts and MCP servers (Official MCP Registry): each protocol's published figures (agent or server counts, transactions or payment events; payers and USD volume only where the source publishes them: payers for x402 and Tempo MPP, USD volume for x402 and Virtuals ACP), each with its unit, window and source; units differ, so totals are not summed. L402 and per-service MPP listings are not covered.

## Output

A JSON object containing the sampled values array, the n/min/max/choices parameters echoed back, the full drand beacon metadata (round, randomness hex, BLS signature, chain hash, public key, source URL), verification check results (whether randomness matches sha256 of signature), the salt used, the step-by-step derivation formula, attribution, and a generated_at timestamp. The caller can independently recompute all values from the public drand beacon data.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET",
      "HEAD"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [],
     "properties": {
      "n": {
       "type": "integer",
       "default": 1,
       "maximum": 100,
       "minimum": 1,
       "description": "how many values"
      },
      "max": {
       "type": "integer",
       "default": 100,
       "description": "largest integer (inclusive)"
      },
      "min": {
       "type": "integer",
       "default": 1,
       "description": "smallest integer (inclusive)"
      },
      "salt": {
       "type": "string",
       "pattern": "^[A-Za-z0-9._-]{0,64}$",
       "description": "your label mixed into the derivation"
      },
      "round": {
       "type": "integer",
       "minimum": 1,
       "description": "a drand quicknet round that has already been published; default latest"
      },
      "unique": {
       "type": "boolean",
       "default": false,
       "description": "no repeated values (draw without replacement)"
      },
      "choices": {
       "type": "string",
       "description": "comma-separated items to pick from instead of min/max (up to 100)"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "required": [
      "values",
      "n",
      "unique",
      "salt",
      "drand",
      "checks",
      "derivation",
      "note"
     ],
     "properties": {
      "n": {
       "type": "integer"
      },
      "max": {
       "type": [
        "integer",
        "null"
       ]
      },
      "min": {
       "type": [
        "integer",
        "null"
       ]
      },
      "note": {
       "type": "string"
      },
      "salt": {
       "type": "string"
      },
      "drand": {
       "type": "object",
       "required": [
        "beacon_id",
        "chain_hash",
        "round",
        "randomness",
        "signature",
        "source_url"
       ],
       "properties": {
        "round": {
         "type": "integer"
        },
        "scheme": {
     
… (truncated)
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "n": 3,
  "max": 100,
  "min": 1,
  "note": "Values are derived from a public drand beacon round, so anyone can recompute them. P0 checks that randomness = sha256(signature) but does not verify the BLS signature itself: verify it with a drand client against chain_hash and public_key. For draws that must not be pre-computable, commit to a future round and a salt first, then call with round=.",
  "salt": "",
  "drand": {
   "round": 1000,
   "scheme": "bls-unchained-g1-rfc9380",
   "info_url": "https://api.drand.sh/52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971/info",
   "beacon_id": "quicknet",
   "signature": "b44679b9a59af2ec876b1a6b1ad52ea9b1615fc3982b19576350f93447cb1125e342b73a8dd2bacbe47e4b6b63ed5e39",
   "chain_hash": "52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971",
   "public_key": "83cf0f2896adee7eb8b5f01fcad3912212c437e0073e911fb90022d3e760183c8c4b450b6a0a6c3ac6a5776a2d1064510d1fec758c921cc22b0e17e63aaf4bcb5ed66304de9cf809bd274ca73bab4af5a6e9c76a4bc09e76eae8991ef5ece45a",
   "randomness": "fe290beca10872ef2fb164d2aa4442de4566183ec51c56ff3cd603d930e54fdd",
   "source_url": "https://api.drand.sh/52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971/public/1000",
   "genesis_time": 1692803367,
   "period_seconds": 3,
   "round_time_utc": "2023-08-23T15:59:24.000Z"
  },
  "checks": {
   "bls_signature_verified_by_p0": false,
   "randomness_is_sha256_of_signature": true
  },
  "unique": false,
  "values": [
   60,
   11,
   15
  ],
  "choices": null,
  "derivation": "For output slot i (0-based) try j = 0,1,2...: h = sha256(utf8(randomness_hex + \":\" + salt + \":\" + i + \":\" + j)); x = first 8 bytes of h as big-endian uint64; r = max - min + 1; accept x if x < floor(2^64 / r) * r (no modulo bias), value = min + (x mod r); else next j. unique=true also skips a value already drawn. choices: index into the list with min=0, max=len-1.",
  "attribution": "Randomness: drand quicknet beacon run by the League of Entropy (https://drand.love/).",
  "generated_at": "2026-10-05T12:00:00.000Z"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/p0-verifiable-random-number-generator-drand-backed-e493986a/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-bazaar-rank.x402-bazaar-rank-worker.workers.dev](https://www.zero.xyz/host/x402-bazaar-rank.x402-bazaar-rank-worker.workers.dev/llms.txt)
