/query/json would return.
They also do the things every production client needs:
- Pagination: follow
next_blockover any range, reusing the prepared query and re-sending it if it expired. - Retries: rate limits (
429), busy servers (503), server errors and dropped connections, honoringRetry-After. - Integrity: a response that ends early or carries fewer rows than announced is an error and is retried, never returned as a short result.
- Types: field names are checked. In TypeScript, each row is typed with exactly the fields you selected.
Install
BLOKLAKE_API_KEY environment variable, or pass it to the constructor.
Your first query
chain ("eth", "rh"), or pass a full baseUrl / base_url. One client
talks to one chain; create one per chain.
Reading a whole range
paginate follows next_block until toBlock (or the chain head if you leave toBlock out),
one page at a time, so memory stays flat however long the range is. collect returns all pages
merged into one, for ranges that fit in memory.
What you get back
A page haslogs, transactions and blocks (empty when not requested) and meta:
fromBlock, toBlock, nextBlock, objects, archiveHeight, finalizedBlock,
toBlockHash, queryId and unavailableFields (snake_case in Python and Rust). See
Response metadata.
Each client names fields in its own language’s style:
In Python, every query key may be written in snake_case (
"from_block", "address_set",
"block_number") or in the API’s camelCase; the client sends camelCase either way. Give each key
one way only.
Values follow the JSON encoding:
In Rust,
query returns typed structs (Log, Transaction, Block, every field an
Option); query_raw returns the rows as serde_json objects exactly as /query/json would.
Sets
client.create_set("address", tokens, None), then LogFilter::new().address_set(&set.set_id).
See Sets.
Errors
Errors that retrying can’t fix are raised at once, with the API’sstatus and code (see
Errors) and the response’s request id:
0 and code network, timeout or truncated (after the
retries ran out).