{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/sqd-dev/json-schema/sqd-dev-data-query-schema.json",
  "title": "DataQuery",
  "description": "What to read and which fields to return. `type` selects the chain family and must match\nthe dataset; the item filters below (`logs`, `transactions`, `traces`, `stateDiffs`) are the\nEVM set. Other families take their own item filters: Solana `instructions`, Bitcoin\n`transactions`, Hyperliquid `fills`, documented per chain in the SQD docs.\n\nUnknown keys are rejected with 400, and the error message lists what was accepted, so a\nclient can discover the exact per-chain shape from the API itself.",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/sqd-dev-openapi.json#/components/schemas/DataQuery",
  "type": "object",
  "required": [
    "type",
    "fromBlock"
  ],
  "additionalProperties": true,
  "properties": {
    "type": {
      "type": "string",
      "description": "Chain family of the dataset being queried.",
      "enum": [
        "evm",
        "solana",
        "substrate",
        "bitcoin",
        "fuel",
        "tron",
        "hyperliquidFills",
        "hyperliquidReplicaCmds"
      ]
    },
    "fromBlock": {
      "type": "integer",
      "format": "int64",
      "minimum": 0,
      "description": "First block to read, inclusive. Must be >= the dataset `start_block`."
    },
    "toBlock": {
      "type": "integer",
      "format": "int64",
      "minimum": 0,
      "description": "Last block to read, inclusive. Omit to stream until the dataset height, then keep following the chain."
    },
    "parentBlockHash": {
      "type": "string",
      "description": "Expected parent hash of the first requested block. When it disagrees with the chain, the request fails with 409 instead of returning orphaned data."
    },
    "includeAllBlocks": {
      "type": "boolean",
      "default": false,
      "description": "Return blocks in range even when nothing in them matches the filters."
    },
    "fields": {
      "type": "object",
      "description": "Field selector. Only requested fields are returned, which is what keeps responses small. The `block` selector below is the EVM set.",
      "additionalProperties": true,
      "properties": {
        "block": {
          "type": "object",
          "description": "EVM block header fields. Note `number`, not `height`.",
          "additionalProperties": false,
          "properties": {
            "number": {
              "type": "boolean",
              "default": false
            },
            "hash": {
              "type": "boolean",
              "default": false
            },
            "parentHash": {
              "type": "boolean",
              "default": false
            },
            "timestamp": {
              "type": "boolean",
              "default": false
            },
            "transactionsRoot": {
              "type": "boolean",
              "default": false
            },
            "receiptsRoot": {
              "type": "boolean",
              "default": false
            },
            "stateRoot": {
              "type": "boolean",
              "default": false
            },
            "logsBloom": {
              "type": "boolean",
              "default": false
            },
            "sha3Uncles": {
              "type": "boolean",
              "default": false
            },
            "extraData": {
              "type": "boolean",
              "default": false
            },
            "miner": {
              "type": "boolean",
              "default": false
            },
            "nonce": {
              "type": "boolean",
              "default": false
            },
            "mixHash": {
              "type": "boolean",
              "default": false
            },
            "size": {
              "type": "boolean",
              "default": false
            },
            "gasLimit": {
              "type": "boolean",
              "default": false
            },
            "gasUsed": {
              "type": "boolean",
              "default": false
            },
            "difficulty": {
              "type": "boolean",
              "default": false
            },
            "totalDifficulty": {
              "type": "boolean",
              "default": false
            },
            "baseFeePerGas": {
              "type": "boolean",
              "default": false
            },
            "uncles": {
              "type": "boolean",
              "default": false
            },
            "withdrawals": {
              "type": "boolean",
              "default": false
            },
            "withdrawalsRoot": {
              "type": "boolean",
              "default": false
            },
            "blobGasUsed": {
              "type": "boolean",
              "default": false
            },
            "excessBlobGas": {
              "type": "boolean",
              "default": false
            },
            "parentBeaconBlockRoot": {
              "type": "boolean",
              "default": false
            },
            "requestsHash": {
              "type": "boolean",
              "default": false
            },
            "l1BlockNumber": {
              "type": "boolean",
              "default": false
            },
            "mainBlockGeneralGasLimit": {
              "type": "boolean",
              "default": false
            },
            "sharedGasLimit": {
              "type": "boolean",
              "default": false
            },
            "timestampMillisPart": {
              "type": "boolean",
              "default": false
            }
          }
        }
      }
    },
    "logs": {
      "type": "array",
      "description": "EVM log filters. Entries are OR-ed; keys within an entry are AND-ed.",
      "items": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "address": {
            "type": "array",
            "description": "Contract addresses, lowercase hex.",
            "items": {
              "type": "string"
            }
          },
          "topic0": {
            "type": "array",
            "description": "Event signature hashes.",
            "items": {
              "type": "string"
            }
          },
          "topic1": {
            "type": "array",
            "description": "First indexed argument.",
            "items": {
              "type": "string"
            }
          },
          "topic2": {
            "type": "array",
            "description": "Second indexed argument.",
            "items": {
              "type": "string"
            }
          },
          "topic3": {
            "type": "array",
            "description": "Third indexed argument.",
            "items": {
              "type": "string"
            }
          },
          "transaction": {
            "type": "boolean",
            "description": "Also return the transaction that produced each matching log."
          }
        }
      }
    },
    "transactions": {
      "type": "array",
      "description": "EVM transaction filters. Entries are OR-ed.",
      "items": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "from": {
            "type": "array",
            "description": "Sender addresses.",
            "items": {
              "type": "string"
            }
          },
          "to": {
            "type": "array",
            "description": "Recipient addresses.",
            "items": {
              "type": "string"
            }
          },
          "sighash": {
            "type": "array",
            "description": "Function selectors.",
            "items": {
              "type": "string"
            }
          },
          "logs": {
            "type": "boolean",
            "description": "Also return the logs each match emitted."
          },
          "traces": {
            "type": "boolean",
            "description": "Also return the traces each match produced."
          }
        }
      }
    },
    "traces": {
      "type": "array",
      "description": "EVM trace filters, for internal calls and contract creations.",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "stateDiffs": {
      "type": "array",
      "description": "EVM storage state-diff filters.",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    }
  }
}