Stables
Stablecoin mint and burn with Rate guard for AI agents through x402 payment with World ID KYC.
What it is
Stablecoin mint and burn with Rate-guarded values that are used by AI agents (AI agents consuming CRE workflows), which AI Agents pay for stable coin logged rates using the x402 payment in Chainlink Runtime Environment (CRE) with World ID KYC.
How It Works
Stables is a two-stage Chainlink Runtime Environment (CRE) workflow that orchestrates stablecoin mint/burn operations with real-time rate validation:
User submits request → React frontend sends mint/burn request with oracle rate
HTTP trigger → CRE writes OperationRequested event on-chain via httpCallback.ts
EVM log trigger → CRE detects the event, fetches live ExchangeRate API data via logCallback.ts
Rate guard check → Compares API rate vs. oracle rate; rejects if difference exceeds 1000 bps (10%)
Settlement → If valid, finalizes operation on-chain; if invalid, rejects
Live streaming → Browser streams real CRE execution logs via local bridge ( creBridge.mjs)
Optional World ID KYC for operations ≥$100 USD equivalent.
What Problem It Solves
Oracle Manipulation Protection
Prevents users from exploiting stale or manipulated oracle prices by cross-validating with an independent external API before finalizing operations.Transparent Decentralized Execution
Uses CRE's event-driven architecture instead of centralized backend servers, making the rate-checking logic auditable and trustless.Developer Experience Gap
Demonstrates how to connect CRE workflows to a live frontend with real-time terminal streaming—solving the "black box" problem where developers can't see CRE execution in the browser.Compliance-Ready KYC
Integrates World ID zero-knowledge proofs for privacy-preserving identity verification on high-value transactions.
Core innovation: Combines on-chain finality with off-chain consensus (ExchangeRate API) while maintaining full transparency through live browser streaming.
How it Works
Stables uses a three-layer architecture: a React 19 frontend with Vite and World ID integration communicates with Chainlink Runtime Environment (CRE) workflows written in TypeScript, which are compiled to WebAssembly via a custom Rust-based Javy plugin. The compilation pipeline transforms TypeScript workflows through JavaScript into WASM binaries targeting wasm32-wasip1, enabling sandboxed off-chain execution. The workflows leverage the @chainlink/cre-sdk to interact with HTTP APIs (ExchangeRate), read EVM logs, and manage secrets.
Smart contracts are built with Foundry and emit events that trigger the CRE workflows, which validate exchange rates and settle operations on-chain. A custom Node.js bridge ( creBridge.mjs) streams real-time CRE execution logs to the browser, solving the visibility problem in decentralized workflow orchestration. The entire stack runs on Bun for fast TypeScript execution and uses Protocol Buffers for CRE message serialization. Development involves compiling workflows to WASM, deploying contracts to a Tenderly-forked Sepolia testnet via Anvil, and running the Vite dev server alongside the CRE bridge for live log streaming. This architecture combines on-chain finality with off-chain consensus validation while maintaining full transparency through browser-based execution monitoring.
Links
Created by
- Mike Nsereko