Skip to content

marinom2/lightnode-examples

Repository files navigation

lightnode-examples

Runnable, copy-pasteable LightChain AI examples built on lightnode-sdk.

This repo is deliberately tiny so cloud IDEs (StackBlitz, Codespaces) can clone it in seconds. The SDK source and the rest of the project live in marinom2/lightnode.

Pick by what you want to build

Inference (paid encrypted AI calls)

Folder What Open it
quickstart-inference/ 30-line Node script. Auto-generates a testnet key on first run; supports --key 0x... to reuse one. StackBlitz
multi-turn-chat/ Interactive terminal chat. Uses the SDK's Conversation class so the model sees prior turns. StackBlitz
nextjs-api-route/ Drop route.ts into app/api/inference/route.ts. POST a prompt, get JSON back. Wallet stays on the server. snippet
hono-server/ Hono /inference endpoint. Same shape as Next.js, runs on Bun / Cloudflare Workers / Node. snippet

Operator / network ops

Folder What Needs
worker-preflight/ preflight runs one real test inference and reports verdict. watch <addr> streams worker status events. PRIVATE_KEY for preflight; none for watch

Ecosystem (bridge, governance, model registry)

Folder What Needs
bridge-transfer/ Bridge LCAI between Ethereum mainnet and LightChain mainnet (Hyperlane Warp Route). Quote, approve, deposit, withdraw. PRIVATE_KEY
dao-vote/ Read LCAI Governor proposals and cast votes (For / Against / Abstain). PRIVATE_KEY for votes; none for reads
model-registry-read/ Read AIVMModelRegistry + BenchmarkRegistry. List models, variants, access policies. Registry contract address (BYO)

Quickstart

git clone https://github.com/marinom2/lightnode-examples
cd lightnode-examples/quickstart-inference
npm install
npm start

The first npm start generates a fresh testnet key, writes it to .env, and tells you where to fund it. Send the address some free testnet LCAI at https://lightfaucet.ai, then npm start again to fire one real encrypted inference.

Common env

Var Default Used by
PRIVATE_KEY none Inference, bridge, dao-vote, preflight
NETWORK testnet Inference, chat, preflight
MODEL llama3-8b Inference, chat
ETH_RPC https://ethereum-rpc.publicnode.com dao-vote
REGISTRY / BENCHMARKS / RPC none / none / mainnet model-registry-read

Get LCAI

Docs

License

MIT.

About

Runnable LightChain AI inference examples (lightnode-sdk)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors