{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://xcim.org/schemas/0.1/chain-anchor.schema.json",
  "title": "XCIM 0.1 Chain Anchor Reference",
  "type": "object",
  "additionalProperties": false,
  "required": ["network", "contract", "batch_sequence", "batch_manifest_hash", "status", "transaction_hash", "block_number", "block_hash", "confirmations"],
  "properties": {
    "network": { "type": "string", "pattern": "^eip155:[1-9][0-9]*$" },
    "contract": { "type": "string", "pattern": "^0x[0-9a-fA-F]{40}$" },
    "batch_sequence": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
    "batch_manifest_hash": { "$ref": "#/$defs/hash" },
    "status": { "enum": ["pending", "submitted", "confirmed", "finalized", "reorged", "replaced", "unavailable"] },
    "transaction_hash": { "oneOf": [{ "$ref": "#/$defs/hex32" }, { "type": "null" }] },
    "block_number": { "oneOf": [{ "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, { "type": "null" }] },
    "block_hash": { "oneOf": [{ "$ref": "#/$defs/hex32" }, { "type": "null" }] },
    "confirmations": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }
  },
  "$defs": {
    "hash": { "type": "string", "minLength": 43, "maxLength": 43, "pattern": "^[A-Za-z0-9_-]+$" },
    "hex32": { "type": "string", "pattern": "^0x[0-9a-fA-F]{64}$" }
  }
}
