{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://thehiveryiq.com/.well-known/schemas/corpus-commitment-v1.json",
  "title": "Corpus Commitment Receipt, v1",
  "description": "Canonical schema for the Hive training corpus commitment receipt, canonical type corpus.commitment. The instrument answers one point query about one work against a sparse Merkle accumulator over salted per item content commitments that the trainer anchored before training. The answer is either a membership witness with the item salt opening or a non membership witness, both recomputed against the root that the weights commitment for the named model run references.",
  "type": "object",
  "required": [
    "receipt_id",
    "payload_sha256",
    "sig_b64u",
    "key_id",
    "algorithm",
    "ts",
    "signed_body"
  ],
  "additionalProperties": false,
  "properties": {
    "receipt_id": {
      "type": "string",
      "pattern": "^r_corpus[.]commitment_[0-9]{10,}_[0-9a-f]{12}$"
    },
    "payload_sha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "sig_b64u": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{86}$"
    },
    "key_id": {
      "type": "string",
      "pattern": "^did:(hive|web|key):[A-Za-z0-9._:%-]+$"
    },
    "algorithm": {
      "type": "string",
      "const": "Ed25519"
    },
    "ts": {
      "type": "integer",
      "minimum": 1000000000
    },
    "signed_body": {
      "type": "object",
      "required": [
        "receipt_type",
        "schema",
        "answer_id",
        "corpus_root",
        "weights_binding",
        "query",
        "answer",
        "witness",
        "disclosure",
        "verdict",
        "boundary"
      ],
      "additionalProperties": false,
      "properties": {
        "receipt_type": {
          "type": "string",
          "const": "corpus.commitment"
        },
        "schema": {
          "type": "string",
          "const": "r1.0.0"
        },
        "answer_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,255}$"
        },
        "corpus_root": {
          "type": "object",
          "required": [
            "model_run_id",
            "root",
            "schema_hash",
            "salt_commitment",
            "item_count",
            "normalization_schema_version",
            "assembly_instant",
            "prior_receipt"
          ],
          "additionalProperties": false,
          "properties": {
            "model_run_id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,255}$"
            },
            "root": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            "schema_hash": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            "salt_commitment": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            "item_count": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000000000
            },
            "normalization_schema_version": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$"
            },
            "assembly_instant": {
              "type": "object",
              "required": [
                "utc",
                "drift_seconds"
              ],
              "additionalProperties": false,
              "properties": {
                "utc": {
                  "type": "string",
                  "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]{1,9})?Z$"
                },
                "drift_seconds": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 86400
                }
              }
            },
            "prior_receipt": {
              "type": "object",
              "required": [
                "receipt_id",
                "receipt_type",
                "envelope_sha256",
                "issuance_instant"
              ],
              "additionalProperties": false,
              "properties": {
                "receipt_id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "receipt_type": {
                  "type": "string",
                  "const": "corpus.root"
                },
                "envelope_sha256": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{64}$"
                },
                "issuance_instant": {
                  "type": "object",
                  "required": [
                    "utc",
                    "drift_seconds"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "utc": {
                      "type": "string",
                      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]{1,9})?Z$"
                    },
                    "drift_seconds": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 86400
                    }
                  }
                }
              }
            }
          }
        },
        "weights_binding": {
          "type": "object",
          "required": [
            "weights_digest",
            "referenced_root",
            "referenced_corpus_root_envelope_sha256",
            "prior_receipt"
          ],
          "additionalProperties": false,
          "properties": {
            "weights_digest": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            "referenced_root": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            "referenced_corpus_root_envelope_sha256": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            "prior_receipt": {
              "type": "object",
              "required": [
                "receipt_id",
                "receipt_type",
                "envelope_sha256",
                "issuance_instant"
              ],
              "additionalProperties": false,
              "properties": {
                "receipt_id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "receipt_type": {
                  "type": "string",
                  "const": "corpus.weights"
                },
                "envelope_sha256": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{64}$"
                },
                "issuance_instant": {
                  "type": "object",
                  "required": [
                    "utc",
                    "drift_seconds"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "utc": {
                      "type": "string",
                      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]{1,9})?Z$"
                    },
                    "drift_seconds": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 86400
                    }
                  }
                }
              }
            }
          }
        },
        "query": {
          "type": "object",
          "required": [
            "query_commitment",
            "query_salt_hex",
            "received_instant",
            "opened_instant",
            "normalization"
          ],
          "additionalProperties": false,
          "properties": {
            "query_commitment": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            "query_salt_hex": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            "received_instant": {
              "type": "object",
              "required": [
                "utc",
                "drift_seconds"
              ],
              "additionalProperties": false,
              "properties": {
                "utc": {
                  "type": "string",
                  "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]{1,9})?Z$"
                },
                "drift_seconds": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 86400
                }
              }
            },
            "opened_instant": {
              "type": "object",
              "required": [
                "utc",
                "drift_seconds"
              ],
              "additionalProperties": false,
              "properties": {
                "utc": {
                  "type": "string",
                  "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]{1,9})?Z$"
                },
                "drift_seconds": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 86400
                }
              }
            },
            "normalization": {
              "type": "object",
              "required": [
                "schema_version",
                "schema_hash",
                "segment_digests",
                "norm_hash"
              ],
              "additionalProperties": false,
              "properties": {
                "schema_version": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$"
                },
                "schema_hash": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{64}$"
                },
                "segment_digests": {
                  "type": "array",
                  "minItems": 1,
                  "maxItems": 4096,
                  "items": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  }
                },
                "norm_hash": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{64}$"
                }
              }
            }
          }
        },
        "answer": {
          "type": "object",
          "required": [
            "answer_type",
            "answer_type_commitment",
            "answer_type_salt_hex",
            "committed_instant",
            "item_key"
          ],
          "additionalProperties": false,
          "properties": {
            "answer_type": {
              "type": "string",
              "enum": [
                "membership",
                "non_membership"
              ]
            },
            "answer_type_commitment": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            "answer_type_salt_hex": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            "committed_instant": {
              "type": "object",
              "required": [
                "utc",
                "drift_seconds"
              ],
              "additionalProperties": false,
              "properties": {
                "utc": {
                  "type": "string",
                  "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]{1,9})?Z$"
                },
                "drift_seconds": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 86400
                }
              }
            },
            "item_key": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            "item_commitment": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            "item_salt_hex": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            "leaf_hash": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            }
          }
        },
        "witness": {
          "type": "object",
          "required": [
            "depth",
            "sibling_bitmap",
            "siblings",
            "witness_root"
          ],
          "additionalProperties": false,
          "properties": {
            "depth": {
              "type": "integer",
              "const": 256
            },
            "sibling_bitmap": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            "siblings": {
              "type": "array",
              "minItems": 0,
              "maxItems": 256,
              "items": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$"
              }
            },
            "witness_root": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            }
          }
        },
        "disclosure": {
          "type": "object",
          "required": [
            "disclosed_item_count",
            "disclosed_item_keys"
          ],
          "additionalProperties": false,
          "properties": {
            "disclosed_item_count": {
              "type": "integer",
              "minimum": 0,
              "maximum": 256
            },
            "disclosed_item_keys": {
              "type": "array",
              "minItems": 0,
              "maxItems": 256,
              "items": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$"
              }
            }
          }
        },
        "verdict": {
          "type": "string",
          "enum": [
            "in_corpus",
            "not_in_corpus"
          ]
        },
        "boundary": {
          "type": "string",
          "const": "This receipt attests only that one queried work, normalized under the pinned normalization schema version, is present at or absent from the position that work occupies in a sparse Merkle accumulator whose root the trainer signed before the weights commitment for the named model run, and that the disclosed witness recomputes to that root. A verdict of in_corpus means only that the item commitment for the queried work sits under the committed root. A verdict of not_in_corpus means only that the position for the queried work is empty under that same committed root. Neither verdict establishes that the committed corpus is the only data the model was trained on, that the trainer did not train on a second uncommitted corpus, that the item count is truthful about works never committed, that any work was used lawfully or unlawfully, that any licence, permission, exception, or exhaustion applies, or that the normalization schema captures every form in which a work may appear. It does not establish authorship, ownership, originality, or subsistence of any right in the queried work, and it says nothing about any work other than the one queried. This receipt decides no contractual, statutory, regulatory, evidentiary, or legal consequence, allocates no risk, fault, responsibility, liability, loss, or remedy, and authorizes no action, payment, sanction, denial, or remedy."
        }
      }
    }
  }
}
