{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/randnext/main/json-schema/randnext-draw-schema.json",
  "title": "Draw",
  "description": "Fields needed to verify a draw are documented at https://randnext.com/draws/how-it-works.",
  "x-generated": "2026-10-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/randnext-openapi.json#/components/schemas/Draw",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "seq": {
      "type": "integer",
      "description": "Public draw number."
    },
    "title": {
      "type": [
        "string",
        "null"
      ],
      "description": "null when removed by moderation."
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "scheduled",
        "drawn",
        "cancelled",
        "removed"
      ]
    },
    "algorithm": {
      "type": "string",
      "enum": [
        "randnext-draw-v1",
        "randnext-draw-v2",
        "randnext-draw-v3"
      ]
    },
    "entry_count": {
      "type": "integer"
    },
    "winner_count": {
      "type": "integer"
    },
    "duplicates": {
      "type": "string",
      "enum": [
        "keep",
        "merge"
      ]
    },
    "entries_visibility": {
      "type": "string",
      "enum": [
        "hidden",
        "public"
      ]
    },
    "entries_hash": {
      "type": "string",
      "description": "SHA-256 (hex) of the normalized entry list."
    },
    "commitment": {
      "type": "string",
      "description": "SHA-256 (hex) of the server seed, published when the draw was locked."
    },
    "server_seed": {
      "type": [
        "string",
        "null"
      ],
      "description": "Revealed at the draw time; null before."
    },
    "params": {
      "type": "string",
      "description": "id, winners and entries, bound into the final seed."
    },
    "final_seed": {
      "type": [
        "string",
        "null"
      ]
    },
    "beacon": {
      "type": [
        "object",
        "null"
      ],
      "description": "randnext-draw-v2: the drand quicknet round fixed at lock time. randomness and signature (BLS, G1) appear after the reveal.",
      "properties": {
        "chain_hash": {
          "type": "string"
        },
        "round": {
          "type": "integer"
        },
        "randomness": {
          "type": [
            "string",
            "null"
          ]
        },
        "signature": {
          "type": [
            "string",
            "null"
          ]
        },
        "url": {
          "type": "string",
          "format": "uri"
        }
      }
    },
    "prizes": {
      "type": [
        "array",
        "null"
      ],
      "description": "randnext-draw-v3 prize draws: prize tiers in locked order, drawn live by the host one by one. Each tier has its own drand round; winners of earlier tiers are excluded. Null for single draws.",
      "items": {
        "type": "object",
        "properties": {
          "tier": {
            "type": "integer"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "winner_count": {
            "type": "integer"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "drawing",
              "drawn"
            ]
          },
          "beacon": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "chain_hash": {
                "type": "string"
              },
              "round": {
                "type": "integer"
              },
              "randomness": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "signature": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "url": {
                "type": "string"
              }
            }
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "drawn_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "params": {
            "type": [
              "string",
              "null"
            ]
          },
          "final_seed": {
            "type": [
              "string",
              "null"
            ]
          },
          "winners": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "object",
              "properties": {
                "rank": {
                  "type": "integer"
                },
                "index": {
                  "type": "integer"
                },
                "entry": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          },
          "signatures": {
            "type": "object",
            "properties": {
              "start": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "result": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        }
      }
    },
    "signatures": {
      "type": "object",
      "description": "Ed25519 signatures (hex) over the lock and result statements; null on v1 records. Public key: /api/v1/draws/signing-keys.",
      "properties": {
        "key_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "lock": {
          "type": [
            "string",
            "null"
          ]
        },
        "result": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "winners": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "object",
        "properties": {
          "rank": {
            "type": "integer"
          },
          "index": {
            "type": "integer",
            "description": "0-based position in the normalized entry list."
          },
          "entry": {
            "type": [
              "string",
              "null"
            ],
            "description": "null when removed by moderation."
          }
        }
      }
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "When the entry list was locked."
    },
    "draw_at": {
      "type": "string",
      "format": "date-time"
    },
    "drawn_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "cancelled_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "pre_announced": {
      "type": "boolean",
      "description": "false when the draw happened less than 10 minutes after locking."
    },
    "listed": {
      "type": "boolean",
      "description": "Whether the organizer shows this record in the public list."
    },
    "entries_purged": {
      "type": "boolean"
    },
    "entries_url": {
      "type": [
        "string",
        "null"
      ],
      "format": "uri"
    },
    "url": {
      "type": "string",
      "format": "uri"
    },
    "verify_url": {
      "type": "string",
      "format": "uri"
    }
  }
}