Ltc Transfers Raw Sql
ltc_transfers_raw_sqlLAST RESORT — arbitrary READ-ONLY SQL against the Litecoin transfers data. The ltc_* tools are
the PRIORITY; use this ONLY when none of them can answer. No query optimizer here: filter on
the per-key tables and NEVER JOIN big tables (use IN (SELECT …), the only way to "follow"
across txs).
Runs read-only ClickHouse SQL. SQL reference: https://clickhouse.com/docs/reference/home
This data runs on an older release of the engine: some functions and syntax in that reference
(map() and toJSONString() among them) do not exist here — when a statement is refused for an
unknown function or setting, use the forms shown in this description.
Every table has a blockchain_id column and also holds rows of other blockchain_id values:
filter blockchain_id = 6 (Litecoin) on EVERY table you read, inside each IN (SELECT …) as
well — block numbers are not unique across blockchain_id values, so an unfiltered read mixes
in rows that are not Litecoin's. Query the plain names of db altcoin, NEVER a _storage
table (each holds only part of the data).
Tables (db altcoin): altcoin.inputs_by_address / outputs_by_address (by address),
altcoin.inputs_by_tx (by tx; cols address, tx_id_bin, value, output_tx_id_bin, output_index)
and altcoin.outputs_by_tx (by tx; cols address, tx_id_bin, output_index, value and
direction, an Enum
unknown/not_change/change/likely_not_change/likely_change/mining/fee/minting/genesis),
altcoin.transactions (one row per tx: tx_date, input_value, output_value, fee_value,
is_coinbase; look a hash's tx_date up here first). Every altcoin table is partitioned by
month on tx_date — add a tx_date bound whenever you can: a read by address or tx alone
probes every month since the chain began. Db altcoin_flow: address_transfers (keyed by
blockchain_id, address; AggregateFunction → -Merge; its count / sum totals hold a few
duplicated and missing records — take exact totals from the altcoin tables),
outputs_to_address (by address), tx_inputs / tx_outputs (by block, tx_index; a few whole
blocks are missing).
Addresses & tx ids: address is a plain string (L… / M… base58, ltc1… bech32 lowercase; m-… /
d-… placeholders for bare multisig / non-standard scripts; empty for coinbase inputs and fee
rows); tx_id_bin = unhex('<64hex>'), output hex(tx_id_bin); value is Decimal(18,8),
already in LTC (a JSON number: above about 1e8 it loses its last decimals - return
toString(value) when every decimal matters). Date-times come back as 'YYYY-MM-DD hh:mm:ss'
UTC; select formatDateTime(tx_time, '%FT%TZ') for ISO-8601 (2026-09-21T15:04:18Z), the shape
the other tools return. Address labels: none in this data — use
labels_for_addresses(chain='litecoin'). Read-only; JSONEachRow. A result of more than 25,000
rows is not cut off - the whole query fails with an error - so aggregate (GROUP BY, count) or
add a LIMIT of at most 25,000. 64-bit integers come back as JSON numbers, exact only up to
2^53: return a hash such as cityHash64(...) or any other 64-bit id as toString(x).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"sql": "<sql>"
},
"name": "ltc_transfers_raw_sql"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | A single read-only SELECT on the altcoin / altcoin_flow tables, with blockchain_id = 6 on every table read. Use indexed (*_by_address / *_by_tx) filters; no JOINs over big tables. | |
| format | No | Shape of the returned data. "rows" (the default) returns one item per row. "columnar" returns a single item, {"columns":[...],"rows":[[value,...],...]}, naming the columns once and listing each row's values in that order; it is more compact for large results and carries the same values. | rows |