{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "$id": "https://balance0014.github.io/post-quantum-blockchains/data/schema/chain-v1.json",
 "title": "One chain in the Post-Quantum Blockchains API (data/chains/{id}.json)",
 "description": "Version 1 of the chain file. Within version 1 fields are only ever added, never removed or renamed; a breaking change gets a new schema (chain@2) and a new file name. Field definitions: https://balance0014.github.io/post-quantum-blockchains/method/#fields",
 "type": "object",
 "required": [
  "schema",
  "version",
  "data_checked",
  "id",
  "name",
  "zh_name",
  "ticker",
  "stage",
  "stage_name",
  "category",
  "group",
  "market_cap_rank",
  "algorithm",
  "schemes",
  "coverage",
  "migration",
  "audit",
  "post_quantum_mainnet_since",
  "basis",
  "basis_source",
  "last_reviewed",
  "page",
  "badge",
  "card",
  "attribution",
  "license"
 ],
 "additionalProperties": true,
 "properties": {
  "schema": {
   "const": "post-quantum-blockchains/chain@1"
  },
  "version": {
   "type": "string",
   "pattern": "^\\d+\\.\\d+\\.\\d+$",
   "description": "Release of the dataset (data/release.json)."
  },
  "data_checked": {
   "type": "string",
   "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
   "description": "Day of the network check behind this build (UTC)."
  },
  "id": {
   "type": "string",
   "pattern": "^[a-z0-9-]+$",
   "description": "Stable chain ID, also the file name."
  },
  "name": {
   "type": "string",
   "minLength": 1
  },
  "zh_name": {
   "type": [
    "string",
    "null"
   ],
   "description": "Chinese name where one is in common use; null otherwise."
  },
  "ticker": {
   "type": "string",
   "minLength": 1
  },
  "stage": {
   "type": "integer",
   "minimum": 0,
   "maximum": 5,
   "description": "0 nothing public, 1 research, 2 proposal, 3 testnet, 4 mainnet opt-in, 5 post-quantum by default."
  },
  "stage_name": {
   "type": "object",
   "description": "The stage in words.",
   "required": [
    "en",
    "zh"
   ],
   "additionalProperties": false,
   "properties": {
    "en": {
     "type": "string",
     "minLength": 1
    },
    "zh": {
     "type": "string",
     "minLength": 1
    }
   }
  },
  "category": {
   "enum": [
    "needs_upgrade",
    "native",
    "pre_mainnet"
   ],
   "description": "needs_upgrade: mainnet launched with classical signatures (stage 0 to 4, or 5 once post-quantum becomes the default). native: post-quantum by default since the current mainnet's genesis (always 5). pre_mainnet: testnet or devnet only, built post-quantum (0 to 3)."
  },
  "group": {
   "enum": [
    "top",
    "optin",
    "native",
    "early"
   ],
   "deprecated": true,
   "description": "Old field, kept so existing readers do not break; use category."
  },
  "market_cap_rank": {
   "type": [
    "integer",
    "null"
   ],
   "minimum": 1,
   "description": "CoinGecko market-cap rank when the chain needs upgrading and is in the top TOP_N (now 200); null otherwise."
  },
  "algorithm": {
   "type": "object",
   "description": "The post-quantum signature in use or proposed, in words.",
   "required": [
    "en",
    "zh"
   ],
   "additionalProperties": false,
   "properties": {
    "en": {
     "type": "string",
     "minLength": 1
    },
    "zh": {
     "type": "string",
     "minLength": 1
    }
   }
  },
  "schemes": {
   "type": "array",
   "minItems": 1,
   "items": {
    "type": "object",
    "required": [
     "scheme",
     "status"
    ],
    "additionalProperties": false,
    "properties": {
     "scheme": {
      "enum": [
       "mldsa",
       "slhdsa",
       "falcon",
       "xmss",
       "wots",
       "other",
       "none"
      ]
     },
     "status": {
      "enum": [
       "std",
       "sel",
       "var",
       "hash",
       "nonstd",
       "custom",
       "none"
      ],
      "description": "std NIST standard, sel selected by NIST and not yet a standard, var a variant NIST has not reviewed, hash stateful hash-based, nonstd a published scheme outside the NIST and IETF standards, custom the project's own construction, none no scheme."
     }
    }
   }
  },
  "coverage": {
   "enum": [
    "default",
    "optin",
    "testnet",
    "none"
   ],
   "description": "Where holders can use post-quantum signatures today."
  },
  "migration": {
   "enum": [
    "native",
    "available",
    "testnet",
    "planned",
    "none",
    "unknown",
    null
   ],
   "description": "How coins under classical keys move (recorded from stage 2); null when not recorded."
  },
  "audit": {
   "enum": [
    "audited",
    "partial",
    "none_found",
    "unknown",
    null
   ],
   "description": "Audit of the post-quantum code (recorded from stage 3); null when not recorded."
  },
  "post_quantum_mainnet_since": {
   "anyOf": [
    {
     "type": "string",
     "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    {
     "type": "null"
    }
   ],
   "description": "Day post-quantum signatures became usable on the current mainnet (stage 4 and 5 only)."
  },
  "basis": {
   "type": "object",
   "description": "The sentence the stage rests on.",
   "required": [
    "en",
    "zh"
   ],
   "additionalProperties": false,
   "properties": {
    "en": {
     "type": "string",
     "minLength": 1
    },
    "zh": {
     "type": "string",
     "minLength": 1
    }
   }
  },
  "basis_source": {
   "anyOf": [
    {
     "type": "string",
     "format": "uri",
     "pattern": "^https://"
    },
    {
     "type": "null"
    }
   ],
   "description": "The one source that sentence cites."
  },
  "last_reviewed": {
   "type": "string",
   "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
   "description": "Day this chain's sources were last checked."
  },
  "page": {
   "type": "object",
   "description": "The chain page.",
   "required": [
    "en",
    "zh"
   ],
   "additionalProperties": false,
   "properties": {
    "en": {
     "type": "string",
     "format": "uri",
     "pattern": "^https://"
    },
    "zh": {
     "type": "string",
     "format": "uri",
     "pattern": "^https://"
    }
   }
  },
  "badge": {
   "type": "object",
   "description": "Badge SVG (live).",
   "required": [
    "en",
    "zh"
   ],
   "additionalProperties": false,
   "properties": {
    "en": {
     "type": "string",
     "format": "uri",
     "pattern": "^https://"
    },
    "zh": {
     "type": "string",
     "format": "uri",
     "pattern": "^https://"
    }
   }
  },
  "card": {
   "type": "object",
   "description": "Card SVG (live).",
   "required": [
    "en",
    "zh"
   ],
   "additionalProperties": false,
   "properties": {
    "en": {
     "type": "string",
     "format": "uri",
     "pattern": "^https://"
    },
    "zh": {
     "type": "string",
     "format": "uri",
     "pattern": "^https://"
    }
   }
  },
  "attribution": {
   "type": "object",
   "required": [
    "text",
    "site",
    "repo"
   ],
   "properties": {
    "text": {
     "type": "string"
    },
    "text_zh": {
     "type": "string"
    },
    "site": {
     "type": "string",
     "format": "uri",
     "pattern": "^https://"
    },
    "author": {
     "type": "string",
     "format": "uri",
     "pattern": "^https://"
    },
    "repo": {
     "type": "string",
     "format": "uri",
     "pattern": "^https://github\\.com/"
    },
    "handle": {
     "type": "string",
     "pattern": "^@"
    }
   },
   "description": "The credit to show: text (English) and text_zh name the site, the repository and the X handle; site, repo and author are the three links."
  },
  "license": {
   "type": "object",
   "required": [
    "name",
    "url",
    "terms"
   ],
   "properties": {
    "name": {
     "type": "string"
    },
    "url": {
     "type": "string",
     "format": "uri",
     "pattern": "^https://"
    },
    "commercial_use": {
     "type": "string"
    },
    "terms": {
     "type": "string",
     "format": "uri",
     "pattern": "^https://"
    }
   }
  }
 }
}
