{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/blockvectra/json-schema/blockvectra-block-traces-envelope-schema.json",
  "title": "BlockTracesEnvelope",
  "description": "Unpaginated; `next_cursor` is never present.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/blockvectra-traces-api-openapi.yml#/components/schemas/BlockTracesEnvelope",
  "type": "object",
  "required": [
    "data",
    "meta"
  ],
  "properties": {
    "data": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/BlockTraceItem"
      }
    },
    "meta": {
      "$ref": "#/$defs/Meta"
    }
  },
  "$defs": {
    "Address": {
      "type": "string",
      "description": "20-byte address, canonical form always `0x` + 40 lowercase hex digits.",
      "pattern": "^0x[0-9a-f]{40}$"
    },
    "BlockTraceItem": {
      "type": "object",
      "required": [
        "txHash",
        "result"
      ],
      "properties": {
        "txHash": {
          "$ref": "#/$defs/Hash32"
        },
        "result": {
          "$ref": "#/$defs/CallFrame"
        }
      }
    },
    "CallFrame": {
      "type": "object",
      "description": "A single `callTracer` call frame in standard Ethereum `callTracer` format; `value`/`gas`/`gasUsed` are `0x`-prefixed hex quantities. Any additional fields in the call frame are preserved (`additionalProperties: true`).",
      "required": [
        "type",
        "from",
        "gas",
        "gasUsed",
        "input"
      ],
      "properties": {
        "type": {
          "type": "string",
          "description": "e.g. `CALL`, `DELEGATECALL`, `STATICCALL`, `CREATE`, `CREATE2`, `SELFDESTRUCT`."
        },
        "from": {
          "$ref": "#/$defs/Address"
        },
        "to": {
          "$ref": "#/$defs/Address",
          "description": "Absent for a `CREATE`/`CREATE2` frame's target (the address does not exist yet at call time in the node's own output)."
        },
        "value": {
          "$ref": "#/$defs/HexQuantity",
          "description": "Absent for a `STATICCALL` frame (no value can move)."
        },
        "gas": {
          "$ref": "#/$defs/HexQuantity"
        },
        "gasUsed": {
          "$ref": "#/$defs/HexQuantity"
        },
        "input": {
          "$ref": "#/$defs/HexBytes"
        },
        "output": {
          "$ref": "#/$defs/HexBytes",
          "description": "Absent when the call returned no data."
        },
        "error": {
          "type": "string",
          "description": "Absent on a successful call."
        },
        "revertReason": {
          "type": "string",
          "description": "Absent unless the call reverted with `Error(string)` data."
        },
        "calls": {
          "type": "array",
          "description": "Nested sub-calls, in call order. Absent for a leaf frame.",
          "items": {
            "$ref": "#/$defs/CallFrame"
          }
        }
      },
      "additionalProperties": true
    },
    "Hash32": {
      "type": "string",
      "description": "32-byte hash/topic, canonical form always `0x` + 64 lowercase hex digits.",
      "pattern": "^0x[0-9a-f]{64}$"
    },
    "HexBytes": {
      "type": "string",
      "description": "Raw bytes of any length, `0x` + an even number of lowercase hex digits (`\"0x\"` alone for zero bytes).",
      "pattern": "^0x([0-9a-f]{2})*$"
    },
    "HexQuantity": {
      "type": "string",
      "description": "`0x`-prefixed hexadecimal integer in standard Ethereum `callTracer` format; `value`/`gas`/`gasUsed` are `0x`-prefixed hex quantities.",
      "pattern": "^0x[0-9a-f]+$"
    },
    "Meta": {
      "type": "object",
      "description": "Metadata present on every success response.",
      "required": [
        "chain",
        "chain_slug",
        "chain_external_id",
        "as_of_block",
        "safe_block",
        "finalized_block",
        "coverage",
        "refreshed_at"
      ],
      "properties": {
        "chain": {
          "type": "string",
          "description": "Chain identifier; the value of the `{chain}` path parameter."
        },
        "chain_slug": {
          "type": "string",
          "description": "Canonical uppercase chain slug; `chain` is always its lowercase form."
        },
        "chain_external_id": {
          "type": "string",
          "description": "CAIP-2 formatted external chain identifier (`eip155:{chain_id}`)."
        },
        "as_of_block": {
          "type": "integer",
          "format": "int64",
          "description": "The newest fully written block (the `blocks` table's maximum height); the only serving bound for block-scoped endpoints. For snapshot endpoints (balances, holders, nfts, dex prices, stocks) it is the service's current indexed head, not the block height of the snapshot: read the snapshot time from `meta.refreshed_at`, and treat the data as stale when `refreshed_at` is `null`."
        },
        "safe_block": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int64",
          "description": "A marker only: the node's consensus `safe` block. Always present; `null` while no value is known (the node has no such tag, or the indexer has not read one yet). Only grows, never below `finalized_block`, and may be above or below `as_of_block`. It never truncates, rejects or bounds a response; see Finality in the API description."
        },
        "finalized_block": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int64",
          "description": "A marker only: the node's consensus `finalized` block. Always present; `null` while no value is known (the node has no such tag, or the indexer has not read one yet). Only grows, and may be above or below `as_of_block`. It never truncates, rejects or bounds a response; see Finality in the API description."
        },
        "coverage": {
          "type": "string",
          "enum": [
            "full",
            "partial"
          ],
          "description": "`\"partial\"` appears only from `GET /{chain}/addresses/{address}/transactions` and `GET /{chain}/addresses/{address}/transfers`, when `clamp=true` narrowed the served window, and from those two, `GET /{chain}/tokens/{token}/transfers` and `GET /{chain}/dex/swaps` when the block window starts before the lower bound of the dataset the endpoint reads -- the chain's first indexed block, or higher while that dataset is still being backfilled (see Coverage in the API description and each endpoint's window description). Every other endpoint reports `\"full\"`."
        },
        "refreshed_at": {
          "description": "When the data behind this response was last updated (UTC): the timestamp of `as_of_block` for block-based endpoints, the latest snapshot time for snapshot endpoints, and the last update time for token metadata and status. `null` means the snapshot's update time is currently unknown: treat the data as stale; it never means \"just refreshed\".",
          "oneOf": [
            {
              "$ref": "#/$defs/Timestamp"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "Timestamp": {
      "type": "string",
      "format": "date-time",
      "description": "`YYYY-MM-DDTHH:MM:SSZ`, UTC, second precision."
    }
  }
}