{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "AbstractTransaction",
  "description": "Anchored transaction metadata. All mined/anchored Stacks transactions have these properties.",
  "type": "object",
  "allOf": [
    {
      "$ref": "./base-transaction.schema.json"
    },
    {
      "required": [
        "tx_index",
        "block_hash",
        "block_height",
        "burn_block_time",
        "burn_block_time_iso",
        "parent_burn_block_time",
        "parent_burn_block_time_iso",
        "canonical",
        "tx_status",
        "tx_result",
        "events",
        "event_count",
        "parent_block_hash",
        "is_unanchored",
        "microblock_hash",
        "microblock_sequence",
        "microblock_canonical",
        "execution_cost_read_count",
        "execution_cost_read_length",
        "execution_cost_runtime",
        "execution_cost_write_count",
        "execution_cost_write_length"
      ],
      "additionalProperties": false,
      "properties": {
        "block_hash": {
          "type": "string",
          "description": "Hash of the blocked this transactions was associated with"
        },
        "block_height": {
          "type": "integer",
          "description": "Height of the block this transactions was associated with"
        },
        "burn_block_time": {
          "type": "integer",
          "description": "Unix timestamp (in seconds) indicating when this block was mined"
        },
        "burn_block_time_iso": {
          "type": "string",
          "description": "An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this block was mined."
        },
        "parent_burn_block_time": {
          "type": "integer",
          "description": "Unix timestamp (in seconds) indicating when this parent block was mined"
        },
        "parent_burn_block_time_iso": {
          "type": "string",
          "description": "An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this parent block was mined."
        },
        "canonical": {
          "type": "boolean",
          "description": "Set to `true` if block corresponds to the canonical chain tip"
        },
        "tx_index": {
          "type": "integer",
          "description": "Index of the transaction, indicating the order. Starts at `0` and increases with each transaction"
        },
        "tx_status": {
          "description": "Status of the transaction. Can be included in a block with a success or aborted status. Or pending in the mempool. Or dropped from the mempool from being replaced by a transaction with the same nonce but a higher fee, replaced by a transaction with the same nonce but in the canonical fork, the transaction is too expensive to include in a block, or because it became stale.",
          "$ref": "./transaction-status.schema.json"
        },
        "tx_result": {
          "type": "object",
          "required": ["hex", "repr"],
          "description": "Result of the transaction. For contract calls, this will show the value returned by the call. For other transaction types, this will return a boolean indicating the success of the transaction.",
          "additionalProperties": false,
          "properties": {
            "hex": {
              "type": "string",
              "description": "Hex string representing the value fo the transaction result"
            },
            "repr": {
              "type": "string",
              "description": "Readable string of the transaction result"
            }
          }
        },
        "event_count": {
          "type": "integer",
          "description": "Number of transaction events"
        },
        "parent_block_hash": {
          "type": "string",
          "description": "Hash of the previous block."
        },
        "is_unanchored": {
          "type": "boolean",
          "description": "True if the transaction is included in a microblock that has not been confirmed by an anchor block."
        },
        "microblock_hash": {
          "type": "string",
          "description": "The microblock hash that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be an empty string."
        },
        "microblock_sequence": {
          "type": "integer",
          "description": "The microblock sequence number that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be 2147483647 (0x7fffffff, the max int32 value), this value preserves logical transaction ordering on (block_height, microblock_sequence, tx_index)."
        },
        "microblock_canonical": {
          "type": "boolean",
          "description": "Set to `true` if microblock is anchored in the canonical chain tip, `false` if the transaction was orphaned in a micro-fork."
        },
        "execution_cost_read_count": {
          "type": "integer",
          "description": "Execution cost read count."
        },
        "execution_cost_read_length": {
          "type": "integer",
          "description": "Execution cost read length."
        },
        "execution_cost_runtime": {
          "type": "integer",
          "description": "Execution cost runtime."
        },
        "execution_cost_write_count": {
          "type": "integer",
          "description": "Execution cost write count."
        },
        "execution_cost_write_length": {
          "type": "integer",
          "description": "Execution cost write length."
        },
        "events" : {
          "type": "array",
          "description": "List of transaction events",
          "items": {
            "$ref": "../transaction-events/transaction-event.schema.json"
          }
        }
      }
    }
  ]
}
