
Loading...

Loading...
Methods, networks, contract addresses, changelog, security model, ports.
Free, no key. Dashboards, leaderboards, eligibility checks, gating.
import { LightNode } from "lightnode-sdk";
const ln = new LightNode("mainnet");
const top = (await ln.getWorkerStats(1000, 5)).map((w) => ({
worker: w.address,
completionPct: w.completionRate * 100,
p95ms: w.p95LatencyMs,
}));
console.table(top);| Method | Returns | What it gives you |
|---|---|---|
getWorker(address) | Worker | null | Full record for one worker (stake, status, earnings, models served). |
getWorkers(first = 200) | Worker[] | Registered workers, busiest first. |
getWorkerJobs(address, first = 20) | Job[] | Recent jobs for one worker, newest first. |
getModels() | ModelInfo[] | Network's registered models: name, fee, max output tokens, whitelist flags. |
getNetworkStats() | NetworkStats | One-shot summary: totals, active count, jobs completed, earnings, model count. |
getModelStats(sample = 1000) | ModelStat[] | Per-model performance over the last N jobs: completion, p50/p95, incomplete, disputes, earnings. |
getNetworkAnalytics(sample = 1000) | NetworkAnalytics | Network-wide rollup across all models over the last N jobs. |
getWorkerStats(sample = 1000, limit = 25) | WorkerStat[] | Per-worker reliability over the last N jobs. Busiest first. |
isRegistered(address) | boolean | null | Authoritative on-chain registration. Beats the indexer on deregister + re-register cycles. |
getEarningsLcai(address) | number | Settled worker earnings in whole LCAI. |
modelId(tag) | 0x${string} | keccak256 of a model tag. Its on-chain + indexer id. |
estimateFee(modelTag) | number (LCAI) | On-chain inference fee. What submitJob will charge. |
gateway({ bearer }) | GatewayClient | Authenticated GatewayClient for this network. |
getJobStatus(jobId) | JobStatus | null | Job category (completed / stalled / disputed / ...) + refundable flag. |
Same protocol, different chain IDs and addresses.
| testnet | mainnet | |
|---|---|---|
| Chain ID | 8200 | 9200 |
| RPC | rpc.testnet.lightchain.ai | rpc.mainnet.lightchain.ai |
| Explorer | testnet.lightscan.app | mainnet.lightscan.app |
| Faucet | lightfaucet.ai (~2 LCAI / IP / day) | n/a (bridge from Ethereum) |
| Worker min stake | 5,000 LCAI | 50,000 LCAI |
| Inference cost | free (testnet LCAI) | about 0.022 LCAI per call |
| Best for | Builder testing, examples, CI | Real users, paid traffic, on-chain proof |
Sourced from NETWORKS in lightnode-sdk. Edit the SDK, this page picks it up.
| Contract | Testnet (chain 8200) | Mainnet (chain 9200) | Purpose |
|---|---|---|---|
| WorkerRegistry | 0x0000000000000000000000000000000000001002 | 0x0000000000000000000000000000000000001002 | Genesis predeploy. Worker stake + ECDH key + supported models. |
| FeePool | 0x0000000000000000000000000000000000001004 | 0x0000000000000000000000000000000000001004 | Genesis predeploy. Where per-job fees accumulate before payout. |
| NativeVotes | 0x0000000000000000000000000000000000001001 | 0x0000000000000000000000000000000000001001 | Genesis predeploy. Voting weight backing LightChainGovernor (no wrapping). |
| AIConfig (proxy) | 0xeCF4Ca5Ba6D97ae586993e170764a1E92231b67e | 0x24D11533C354092ed6E18b964257819cE78Ce77D | Model whitelist + per-job fee + max output tokens. The model registry. |
| JobRegistry (proxy) | 0x531b3a87c5d785441b9cf55b98169f20fd9056a7 | 0xfB15F90298e4CcD7106E76fFB5e520315cC42B0b | createSession + submitJob + emits SessionCreated / JobSubmitted / JobCompleted. |
| Treasury (proxy) | — | 0x786eDe8C42Ca54E54c9dCECa9b30052CF4743389 | DAO-controlled treasury holding protocol funds. |
| LightChainGovernor (proxy) | — | 0x262E9f9232933E8565253918db703baD58DE93aB | On-chain DAO. Read + vote at dao.lightchain.ai. NativeVotes-backed. |
| TimelockController | — | 0x79e571420c5473Ca9b0FCd599B1b0062D7793c97 | Holds queue/execute delay for the LightChainGovernor. |
The SDK never holds your key. Here is exactly what touches what.
Three drop-in shapes. Open in StackBlitz, no install.
Standalone Node + tsx. ~30 lines using runInferenceWithKey.
Drop-in app/api/inference/route.ts. POST a prompt, get JSON back.
Tiny standalone microservice. Deploys to Bun, Cloudflare Workers, Railway, Fly, any Node host.
The project ships regularly. Pinned examples track the latest patch by default.
runInferenceBatch (parallel inference with capped concurrency + per-slot errors). Agent class (ReAct-style tool calling, works on llama3-8b). AbortSignal support across runInference / runInferenceWithKey for cancellable UI flows.
DAO covers both governors (Ethereum LCAIGovernor + LightChain LightChainGovernor with NativeVotes). All contract addresses now derived from NETWORKS. dao config CLI gets a friendlier RPC fallback.
Full SDK ecosystem release: Bridge SDK, DAO SDK, on-chain Model Registry reader, multi-turn Conversation, worker preflight + watch, job status reader.
lightnode chat + lightnode wallet CLI commands. runInferenceStream (AsyncIterable<string>). Auto-resolve `ws` in Node so no WebSocket import needed.
Crypto switched from Web Crypto to noble (P-256 + AES-GCM). Works in StackBlitz / Bolt WebContainer.
lightnode.app/api/gw CORS proxy. SDK auto-routes via the proxy in browser-like contexts.
JobCompleted grace fix: don't drop a delivered answer when the on-chain event is slow.
runInferenceWithKey: the real 5-line API. SDK builds viem + SIWE for you.
runInference orchestrator + four typed errors.
pip install lightnode-sdk for the read-only client + run_inference_with_key. Byte-perfect crypto vs the TS SDK.
LightChain's Remix-fork IDE loads JobRegistry / AIConfig, decodes tx payloads, lets you write Solidity callers.
Connect a wallet, type a prompt, run one real encrypted inference. Source you can copy.