This week I attended the LinkLab Masterclass: “Intro to Chainlink Runtime Environment (CRE) with x402”, hosted by
@andrej_dev with the
@chainlink and
@CoinbaseDev teams. Here’s what I learned and built:
⬡ CRE - Chainlink Runtime Environment
CRE is
@chainlink's all-in-one orchestration layer for institutional-grade smart contracts.
CRE Key points:
🔹Workflows: Developers build sequences of operations using the CRE SDK (Go/TypeScript), compile with the CRE CLI, simulate, and deploy.
🔹Workflow DON (Decentralised Oracle Network): Orchestrates workflow execution. Can call specialised Capability DONs.
🔹Node execution: Tasks are run independently, results cryptographically verified and aggregated via BFT consensus, guaranteeing a single consistent outcome.
CRE Key concepts:
🔹Workflow: Connects smart contracts to external data, APIs, cloud services, AI systems, or other blockchains.
🔹DON: Trustless, decentralised network of nodes executing logic, ensuring consensus, bridging on-chain & off-chain systems.
🔹BFT (Byzantine Fault Tolerance): Distributed system property that reaches consensus even if some nodes fail or act maliciously.
Why it matters:
🔹Enables complex off-chain logic & computations in a decentralised, verifiable way. This unlocks use cases that were previously impractical for hybrid smart contracts.
💸 x402 -
@coinbase Payment Protocol
🔹Enables instant and frictionless stablecoin payments over HTTP.
🔹Repurposes 402 “Payment Required" status code for on-chain, pay-per-use access to APIs & digital content.
🛠 Hands-on build: Complete price alert system using CRE x402
Phase 1⃣: Alert Creation (x402 CRE HTTP Trigger)
1. User submits request: e.g. “Alert me when BTC is greater than 60,000”
2. LLM (Gemini AI) parses intent: Converts to structured JSON
3. x402 payment:
🔹Server responds with 402 Payment Required
🔹Client (LLM server) generates EIP-712 payment authorisation
🔹Client resubmits with PAYMENT-SIGNATURE header, validated via Facilitator’s /verify endpoint
🔹Server processes request and payment settles on-chain ($0.01 USDC)
4. CRE Workflow:
🔹Client sends HTTP POST to CRE workflow with alert data
🔹 Workflow encodes data as ABI parameters, generates CRE report
🔹Writes report to RuleRegistry contract (on Base Sepolia)
Phase 2⃣: Price Monitoring (CRE Cron Trigger)
5. Cron trigger fires hourly
6. Fetch current prices via Chainlink Price Feeds, consensus verified across multiple nodes
7. Read active rules from RuleRegistry contract -> evaluate conditions -> skip expired rules (TTL 30 mins)
8. Send notifications if conditions met (via Pushover -> mobile alert)
Want to try it yourself? Follow the workshop:
smartcontractkit.github.io/x…