{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://receiz.com/standards/receiz.groth16.real.schema.v1.json",
  "title": "Receiz Real Groth16 Envelope v1",
  "description": "Canonical schema for decoded g16 payload envelopes stored in receiz.proof_bundle.groth16Proof.",
  "type": "object",
  "additionalProperties": false,
  "required": ["v", "proof", "publicSignals"],
  "$defs": {
    "fieldElement": {
      "type": "string",
      "pattern": "^[0-9]+$"
    }
  },
  "properties": {
    "v": {
      "const": "receiz.g16.real.v1"
    },
    "proof": {
      "type": "object",
      "additionalProperties": true,
      "required": ["pi_a", "pi_b", "pi_c", "protocol", "curve"],
      "properties": {
        "pi_a": {
          "type": "array",
          "minItems": 3,
          "maxItems": 3,
          "items": {
            "$ref": "#/$defs/fieldElement"
          }
        },
        "pi_b": {
          "type": "array",
          "minItems": 3,
          "maxItems": 3,
          "items": {
            "type": "array",
            "minItems": 2,
            "maxItems": 2,
            "items": {
              "$ref": "#/$defs/fieldElement"
            }
          }
        },
        "pi_c": {
          "type": "array",
          "minItems": 3,
          "maxItems": 3,
          "items": {
            "$ref": "#/$defs/fieldElement"
          }
        },
        "protocol": {
          "const": "groth16"
        },
        "curve": {
          "const": "bn128"
        }
      }
    },
    "publicSignals": {
      "type": "array",
      "minItems": 2,
      "items": {
        "$ref": "#/$defs/fieldElement"
      }
    }
  }
}
