Skip to content

CQL ​

CQL is heto's query language, which reads state and events from EVM chains with one short query.

It is a pipeline language: you name a contract, say which blocks you want, and then shape the rows with a handful of operators. You do not run a node or search for an ABI first, and you write no scripts. This page explains one query, shows the rows that it returns, and tells you where to read next.

One query ​

cql
let stETH = ethereum:0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84;

from stETH at latest-21600..latest every 7200 as s
| project { block: $block, time: $timestamp, ethPerShare: format(s.getPooledEthByShares(1e18), 18) }

Open in workbench →

blocktimeethPerShare
260280002026-09-21T19:34:47Z1.24455806764908769
260352002026-09-22T19:45:47Z1.244633419602089156
260424002026-09-23T19:56:23Z1.244710915700866902
260426752026-09-23T20:51:59Z1.244710915700866902
ethPerShare by timeA step line of ethPerShare over time, from all 4 rows the query returned.1.244601.244651.24470ethPerShare00:002026-09-2212:0000:002026-09-2312:00time (UTC)2026-09-21T19:34:47Z ethPerShare 1.244558067649087692026-09-22T19:45:47Z ethPerShare 1.2446334196020891562026-09-23T19:56:23Z ethPerShare 1.2447109157008669022026-09-23T20:51:59Z ethPerShare 1.244710915700866902
ethPerShare by timeA step line of ethPerShare over time, from all 4 rows the query returned.1.244601.244651.24470ethPerShare2026-09-222026-09-23time (UTC)2026-09-21T19:34:47Z ethPerShare 1.244558067649087692026-09-22T19:45:47Z ethPerShare 1.2446334196020891562026-09-23T19:56:23Z ethPerShare 1.2447109157008669022026-09-23T20:51:59Z ethPerShare 1.244710915700866902

How it reads ​

let stETH = ethereum:0xae7a…; gives a name to a contract — here Lido's stETH, the liquid staking token. An address always carries its chain in front of it, so an ethereum: address is never mistaken for a base: address. Every let ends with a semicolon.

from stETH at latest-21600..latest every 7200 as s is the source. at says which blocks to read. Here it is a range from 21 600 blocks before the newest block to the newest block, which is about three days on Ethereum. every 7200 reads the contract once in every 7 200 of those blocks — roughly once a day. as s calls the contract s for the rest of the query.

Nothing in the query says which ABI to use. CQL finds the contract's verified ABI for you, and it follows a proxy to its implementation if it has to. stETH is such a proxy.

| project { … } is an operator. Each | adds one step to the pipeline, and project keeps only the columns you list. $block and $timestamp are system columns that every row carries. s.getPooledEthByShares(1e18) calls a function on the contract at that row's block and gives you its return value. That value is the ETH that one share is worth: the share rate. format(…, 18) moves the decimal point eighteen places so that the value reads as ETH rather than wei.

The result is one row for each sampled block, plus one row for the end of the range: four rows for three days. stETH is a rebasing token. Its share rate increases once a day, in one step, when Lido's oracle reports. The column shows this. The value climbs between rows that are a day apart. It holds still between the last two rows, which fall on the same day.

Five shapes ​

Almost every query is one of these, with stETH as above and router naming Lido's staking router:

  • A value now. from stETH as s | project { ethPerShare: format(s.getPooledEthByShares(1e18), 18) }
  • A value over time. from stETH at 25_800_000..26_000_000 every 7200 as s | project { block: $block, ethPerShare: format(s.getPooledEthByShares(1e18), 18) }
  • A total. from router as r | expand r.getStakingModuleIds() as moduleId | extend validators = r.getStakingModuleActiveValidatorsCount(moduleId) | summarize total = sum(validators), modules = count()
  • A time range. from stETH at time '2026-09-20'..'2026-09-23' every 1d as s | project { day: $sampleAt, ethPerShare: format(s.getPooledEthByShares(1e18), 18) }
  • A storage read. from stETH as s | project { kernel: s.$storage[keccak256('aragonOS.appStorage.kernel')] as address }

Where next ​

  • Quick start runs the query above in the workbench, and then changes it to compute an average daily change and an annualised rate.
  • How a query is put together explains rows, sources and operators from the writer's side.
  • Guides are the questions people arrive with, one query each, with real output.
  • The Reference lists everything: syntax, types, operators, functions, options, diagnostics.
  • In the workbench, Results shows how the grid draws each type.