{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/sochain-com/json-schema/sochain-com-transaction-schema.json",
  "title": "Transaction",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/sochain-com-openapi.json#/components/schemas/Transaction",
  "type": "object",
  "required": [
    "hash",
    "confirmations",
    "size",
    "vsize",
    "weight",
    "version",
    "locktime",
    "block_hash",
    "block_height",
    "time",
    "inputs_n",
    "outputs_n",
    "inputs_value",
    "outputs_value",
    "fee",
    "price",
    "kind",
    "heuristic",
    "inputs",
    "outputs"
  ],
  "properties": {
    "hash": {
      "type": "string"
    },
    "confirmations": {
      "type": "integer",
      "description": "0 while in the mempool."
    },
    "size": {
      "type": "integer"
    },
    "vsize": {
      "type": "integer"
    },
    "weight": {
      "type": "integer"
    },
    "version": {
      "type": "integer"
    },
    "locktime": {
      "type": "integer"
    },
    "block_hash": {
      "type": [
        "string",
        "null"
      ]
    },
    "block_height": {
      "type": [
        "integer",
        "null"
      ]
    },
    "time": {
      "type": "integer"
    },
    "inputs_n": {
      "type": "integer"
    },
    "outputs_n": {
      "type": "integer"
    },
    "inputs_value": {
      "$ref": "#/$defs/Amount"
    },
    "outputs_value": {
      "$ref": "#/$defs/Amount"
    },
    "fee": {
      "$ref": "#/$defs/Amount"
    },
    "price": {
      "anyOf": [
        {
          "$ref": "#/$defs/Price"
        },
        {
          "type": "null"
        }
      ],
      "description": "The price at the time, as Price; null where there's no price: before the network's price history (Bitcoin's starts 13 Jul 2010), or a block stamped ahead of the clock. Testnets: always 0."
    },
    "facts": {
      "type": "object",
      "properties": {
        "bridge": {
          "type": "string"
        },
        "protocol": {
          "type": "string"
        }
      },
      "description": "Only for a bridge's or a protocol's transaction: the name of its bridge (sBTC, Liquid, …) or protocol (babylon, counterparty, …)."
    },
    "kind": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "payment",
        "batch_payout",
        "consolidation",
        "coinjoin",
        "inscription",
        "data",
        "lightning_close",
        "fee_bumped",
        "mweb_peg_in",
        "large_script",
        "transparent",
        "shielding",
        "deshielding",
        "shielded",
        "rune",
        "bridge",
        "token",
        "staking",
        "anchoring",
        "other",
        null
      ],
      "description": "What kind of transaction it is (inscription, rune, …), named as in a block's kinds (BlockKinds says what each is); null when not classified."
    },
    "heuristic": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "true when the kind is a guess (a CoinJoin, a cooperative Lightning close, a child paying its parent's fee); null with no kind."
    },
    "inputs": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/TransactionInput"
      }
    },
    "outputs": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/TransactionOutput"
      }
    },
    "mweb": {
      "enum": [
        "hogex",
        "pegin"
      ],
      "description": "Litecoin only: hogex for each block's MWEB transaction (its first output is the pool), pegin when it moves coins into MWEB. Absent otherwise."
    },
    "shielded": {
      "type": "object",
      "description": "Zcash only: the value each shielded pool released into the transparent side (positive) or took from it (negative). Shielded inputs and outputs themselves are private: inputs and outputs list the transparent side only, and fee already accounts for this.",
      "required": [
        "sprout",
        "sapling",
        "orchard",
        "ironwood",
        "net"
      ],
      "properties": {
        "sprout": {
          "$ref": "#/$defs/Amount"
        },
        "sapling": {
          "$ref": "#/$defs/Amount"
        },
        "orchard": {
          "$ref": "#/$defs/Amount"
        },
        "ironwood": {
          "$ref": "#/$defs/Amount"
        },
        "net": {
          "$ref": "#/$defs/Amount",
          "description": "Their sum: outputs_value + fee − inputs_value."
        }
      }
    }
  },
  "$defs": {
    "Amount": {
      "type": "string",
      "pattern": "^-?[0-9]+\\.[0-9]{8}$",
      "description": "An exact decimal amount of coins with 8 decimals. Signed amounts may start with '-'. Parse as an integer of the smallest unit, not a float."
    },
    "Outpoint": {
      "type": "object",
      "required": [
        "hash",
        "index"
      ],
      "properties": {
        "hash": {
          "type": "string",
          "description": "Transaction ID."
        },
        "index": {
          "type": "integer"
        }
      }
    },
    "Price": {
      "type": "object",
      "required": [
        "value",
        "currency"
      ],
      "description": "Price per coin, 8 decimals: in US dollars, or in the currency asked for. Always 0.00000000 on testnets.",
      "properties": {
        "value": {
          "$ref": "#/$defs/Amount"
        },
        "currency": {
          "type": "string",
          "description": "USD, or the currency asked for."
        }
      }
    },
    "Script": {
      "type": "object",
      "required": [
        "hex",
        "asm"
      ],
      "properties": {
        "hex": {
          "type": "string"
        },
        "asm": {
          "type": "string"
        }
      }
    },
    "TransactionInput": {
      "type": "object",
      "required": [
        "index",
        "value",
        "address",
        "scriptSig",
        "witness",
        "previous_output"
      ],
      "properties": {
        "index": {
          "type": "integer"
        },
        "value": {
          "$ref": "#/$defs/Amount"
        },
        "address": {
          "type": [
            "string",
            "null"
          ],
          "description": "Null for a coinbase or a script without an address."
        },
        "scriptSig": {
          "$ref": "#/$defs/Script"
        },
        "witness": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Witness items, hex."
        },
        "previous_output": {
          "oneOf": [
            {
              "$ref": "#/$defs/Outpoint"
            },
            {
              "type": "null"
            }
          ],
          "description": "Null for a coinbase."
        },
        "sequence": {
          "type": "integer",
          "description": "The input's nSequence: 4294967295 is final; below 4294967294 signals replace-by-fee where the network allows it, and it can set a relative timelock (BIP 68)."
        },
        "mweb": {
          "enum": [
            "pool",
            "pegin"
          ],
          "description": "Litecoin only: pool when it spends the MWEB pool, pegin when it spends a peg-in. Absent otherwise."
        }
      }
    },
    "TransactionOutput": {
      "type": "object",
      "required": [
        "index",
        "value",
        "address",
        "type",
        "script",
        "spent",
        "is_change"
      ],
      "properties": {
        "index": {
          "type": "integer"
        },
        "value": {
          "$ref": "#/$defs/Amount"
        },
        "address": {
          "type": [
            "string",
            "null"
          ],
          "description": "\"op_return\" for an OP_RETURN (nulldata) output, as v3 always said; null for other nonstandard scripts."
        },
        "type": {
          "type": "string",
          "description": "pubkeyhash, scripthash, witness_v0_keyhash, witness_v0_scripthash, witness_v1_taproot, nulldata, …"
        },
        "script": {
          "$ref": "#/$defs/Script"
        },
        "spent": {
          "oneOf": [
            {
              "$ref": "#/$defs/Outpoint"
            },
            {
              "type": "null"
            }
          ],
          "description": "The spending input; null while unspent."
        },
        "is_change": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "true when it pays one of the transaction's own input addresses; otherwise null (never false)."
        },
        "mweb": {
          "enum": [
            "pegin",
            "pool",
            "pegout"
          ],
          "description": "Litecoin only: pegin (moves coins into MWEB), pool (the MWEB pool, carried to the next block) or pegout (coins leaving MWEB). Absent otherwise."
        }
      }
    }
  }
}