SDKs
Create an API key in TraceFast →
The official TraceFast SDKs call the REST API from TypeScript, Python and Rust. They are generated from the OpenAPI catalogue, so every method of the catalogue a release was built from is there, typed, under the name and in the group it has in these docs. The case methods came after 0.1.0 and are not in it yet. They are open source under the MIT licence: github.com/datanestllc/tracefast-sdk.
| Language | Install | Runs on |
|---|---|---|
| TypeScript / JavaScript | npm install @tracefast_xyz/sdk | Node.js 20.19+ or 22.12+, Bun, Deno, edge runtimes |
| Python | pip install tracefast | Python 3.10+, with a sync and an asyncio client |
| Rust | cargo add tracefast | Rust 1.88+, on Tokio |
Each package's README is its full reference: TypeScript, Python, Rust.
Before you start
- A key. The SDKs call the API with an API key,
sent in the
x-api-keyheader and nowhere else — never in a URL, a log or an error. - Your server, not a browser. The key is a secret: anyone who opens a page that holds it can read it.
- A plan per method. Each method needs Enriched Data, Intelligence or Investigation, and every higher plan includes it — see Plans. Each method's doc comment names its plan and links to its page here.
Quick start
The newest block and one transaction, with the key in TRACEFAST_API_KEY:
import { TraceFast } from '@tracefast_xyz/sdk'
const tf = new TraceFast({ apiKey: process.env.TRACEFAST_API_KEY! })
const { data: block } = await tf.blocks.latest()
console.log(block.number, block.hash)
const { data: tx } = await tf.transactions.get('0x6bb3103eec4ca8f4a324bbab71dc84f533af7e6be11ab8b13d0d10333bb9abc5')
console.log(tx.from, '→', tx.to, tx.valueWei, 'wei')import os
from tracefast import TraceFast
with TraceFast(api_key=os.environ["TRACEFAST_API_KEY"]) as tf:
block = tf.blocks.latest()["data"]
print(block["number"], block["hash"])
tx = tf.transactions.get("0x6bb3103eec4ca8f4a324bbab71dc84f533af7e6be11ab8b13d0d10333bb9abc5")["data"]
print(tx["from"], tx.get("to"), tx["valueWei"])use tracefast::Client;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new(std::env::var("TRACEFAST_API_KEY")?)?;
let latest = client.blocks().latest().await?;
println!("block {} {}", latest.data.number, latest.data.hash);
let tx = client
.transactions()
.get("0x6bb3103eec4ca8f4a324bbab71dc84f533af7e6be11ab8b13d0d10333bb9abc5", &tracefast::TransactionsGetParams::new())
.await?;
println!("{} sent {} wei", tx.data.from, tx.data.value_wei);
Ok(())
}What every SDK does
The three SDKs follow one behaviour contract:
- The whole answer. A method returns the
{ data, meta }envelope of Conventions;meta.asOfBlocksays which block the answer is true at. - Absent is not
null. The types keep a missing field,nulland a value apart, as the API does. A fact that is absent is not proven — it is not a "no". - Errors to branch on. Every failure is one error type whose kind follows
the status — authentication, plan, not found, the data cannot answer, rate
limit and so on — and carries the API's
code,reason,details,retryAfterand the request id to quote to support. Branch oncodeandreason, never on the message — see errors. - Careful retries. Only answers that say "try again" are retried: a
429with a shortRetry-After, a503, and a connection that broke. A429that waits longer is returned at once, with the real wait. A timeout is not retried. - Pagination. Each paged method has two walkers: one gives whole pages,
one gives rows, each with a limit. A walker follows
nextCursoruntil it is absent — see pagination. - Nothing extra. No telemetry and no caching; a redirect is never followed.
For example, a plan refusal and a walk over an address's transactions in TypeScript:
import { PermissionDeniedError } from '@tracefast_xyz/sdk'
try {
for await (const tx of tf.addresses.transactionsItems(
'0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
{ limit: 100 },
{ maxItems: 500 },
)) {
console.log(tx.hash)
}
} catch (e) {
if (e instanceof PermissionDeniedError && e.reason === 'plan_scope_missing') {
console.log('needs', e.details?.minimumPlan, '— this key has', e.details?.currentPlan)
} else throw e
}In Python the walkers are <method>_pages and <method>_items; in Rust,
<method>_pages and <method>_items on the method's group.
Versions
The three packages share one version and one changelog. Before 1.0, a minor version may change a package's API; from 1.0 they follow semantic versioning. Each version is generated from one version of the API catalogue; methods marked Beta may still change on the API side — see stability.
Questions and bugs go to the repository's issues; for a failed call, include the error's request id.
Related pages
- API keys — the key, plans and refusals
- Conventions — the envelope, errors and pagination
- All methods — every method on one page
- Using AI — what to give an AI assistant or agent
Last updated 26 Nov 2026, 13:29 UTC · verified against TraceFast v1.0.367 · Markdown