{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/bitview-space/json-schema/bitview-space-block-template-schema.json",
  "title": "BlockTemplate",
  "description": "The next block's template in BIP 22/23 form, as Bitcoin Core's `getblocktemplate` answers\n(`rules: [\"segwit\"]`): what pools and mining software read. Complete once a miner adds a\ncoinbase paying `coinbasevalue` and carrying `default_witness_commitment`. Returned by\n`GET /api/block-template`.",
  "x-generated": "2026-11-16",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/bitview-space-openapi.json#/components/schemas/BlockTemplate",
  "type": "object",
  "properties": {
    "version": {
      "description": "The block version: BIP 9 version bits, no deployment signaled.",
      "type": "integer",
      "format": "int32"
    },
    "rules": {
      "description": "The rules the template follows: `!` marks one a client must understand.",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "vbavailable": {
      "description": "BIP 9 deployments the client may signal: none.",
      "type": "object",
      "additionalProperties": {
        "type": "integer",
        "format": "uint32",
        "minimum": 0
      }
    },
    "vbrequired": {
      "description": "Version bits the client must set: none.",
      "type": "integer",
      "format": "uint32",
      "minimum": 0
    },
    "previousblockhash": {
      "$ref": "#/$defs/BlockHash"
    },
    "transactions": {
      "description": "The transactions, every parent before its children.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/BlockTemplateTransaction"
      }
    },
    "coinbaseaux": {
      "description": "Data to put in the coinbase's script: none.",
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "coinbasevalue": {
      "description": "What the coinbase may pay: the subsidy at `height` plus every transaction's fee (sats).",
      "allOf": [
        {
          "$ref": "#/$defs/Sats"
        }
      ]
    },
    "target": {
      "description": "The proof-of-work target, as 64 hex digits.",
      "type": "string"
    },
    "mintime": {
      "description": "The earliest valid `curtime`: the median time past plus one second.",
      "allOf": [
        {
          "$ref": "#/$defs/Timestamp"
        }
      ]
    },
    "mutable": {
      "description": "What the client may change: the time, the transactions, the previous block.",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "noncerange": {
      "type": "string"
    },
    "sigoplimit": {
      "description": "Consensus limits for the whole block, coinbase included.",
      "type": "integer",
      "format": "uint32",
      "minimum": 0
    },
    "sizelimit": {
      "type": "integer",
      "format": "uint32",
      "minimum": 0
    },
    "weightlimit": {
      "type": "integer",
      "format": "uint32",
      "minimum": 0
    },
    "curtime": {
      "description": "The block time to use: now, or `mintime` if later.",
      "allOf": [
        {
          "$ref": "#/$defs/Timestamp"
        }
      ]
    },
    "bits": {
      "description": "The compact target, as 8 hex digits.",
      "type": "string"
    },
    "height": {
      "$ref": "#/$defs/Height"
    },
    "default_witness_commitment": {
      "description": "The coinbase output committing to the transactions' witnesses (BIP 141), as script hex.",
      "type": "string"
    }
  },
  "required": [
    "version",
    "rules",
    "vbavailable",
    "vbrequired",
    "previousblockhash",
    "transactions",
    "coinbaseaux",
    "coinbasevalue",
    "target",
    "mintime",
    "mutable",
    "noncerange",
    "sigoplimit",
    "sizelimit",
    "weightlimit",
    "curtime",
    "bits",
    "height",
    "default_witness_commitment"
  ],
  "$defs": {
    "BlockHash": {
      "description": "Double-SHA256 block-header hash, serialized in Bitcoin's conventional\nhexadecimal byte order.",
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "BlockTemplateTransaction": {
      "description": "One transaction of a [`BlockTemplate`].",
      "type": "object",
      "properties": {
        "data": {
          "description": "The transaction serialized with its witness, as hex.",
          "type": "string"
        },
        "txid": {
          "$ref": "#/$defs/Txid"
        },
        "hash": {
          "description": "The witness transaction id.",
          "type": "string"
        },
        "depends": {
          "description": "The 1-based positions in `transactions` of the ones it spends.",
          "type": "array",
          "items": {
            "type": "integer",
            "format": "uint32",
            "minimum": 0
          }
        },
        "fee": {
          "description": "Its fee (sats).",
          "allOf": [
            {
              "$ref": "#/$defs/Sats"
            }
          ]
        },
        "sigops": {
          "description": "Its signature-operation cost.",
          "allOf": [
            {
              "$ref": "#/$defs/SigOps"
            }
          ]
        },
        "weight": {
          "$ref": "#/$defs/Weight"
        }
      },
      "required": [
        "data",
        "txid",
        "hash",
        "depends",
        "fee",
        "sigops",
        "weight"
      ]
    },
    "Height": {
      "description": "A block height: how many blocks came before it.",
      "type": "integer",
      "format": "uint32",
      "minimum": 0
    },
    "Sats": {
      "description": "An amount in satoshis (100,000,000 to a bitcoin).",
      "type": "integer",
      "format": "uint64",
      "minimum": 0
    },
    "SigOps": {
      "description": "BIP-141 signature-operation cost: legacy and P2SH-redeem sigops count four and witness sigops\none. Sums over many transactions or blocks use the full 64 bits.",
      "type": "integer",
      "format": "uint64",
      "minimum": 0
    },
    "Timestamp": {
      "description": "A Unix timestamp, in seconds.",
      "type": "integer",
      "format": "uint32",
      "minimum": 0
    },
    "Txid": {
      "description": "A transaction ID: its hash.",
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "Weight": {
      "description": "Weight in weight units (WU): non-witness bytes count four and witness bytes one. A block holds\nat most 4,000,000 WU; sums over many blocks use the full 64 bits.",
      "type": "integer",
      "format": "uint64",
      "minimum": 0
    }
  }
}