NeuroLedger
ZK-gated, policy-aware lending protocol using Chainlink CRE and AI for risk orchestration.
What it is
What it is: NeuroLedger is an institutional-grade, policy-aware DeFi lending protocol. It completely separates dynamic risk policy computation from on-chain execution by bridging Zero-Knowledge proofs, Chainlink CRE, and AI.
The Problem: Traditional DeFi lending is open (exposing borrower positions/identity), static (relying purely on hardcoded LTV math instead of external market context), and reactive (delegating liquidations to blind third-party bot wars). This prevents institutional capital from adopting decentralized credit rails.
How it works: We split the protocol into three layers:
- Private Eligibility: Borrowers generate an off-chain Groth16 ZK proof binding their amount, nullifier, and root. BorrowGate verifies this on-chain without exposing identity.
- Off-Chain Policy (CRE): A Chainlink CRE workflow intercepts the BorrowRequested event, reads protocol state, fetches external market sentiment (Fear & Greed index), and prompts a Gemini AI agent for a credit risk score.
- On-Chain Enforcement: The AI acts as an advisor but is constrained by deterministic protocol guardrails (automatically rejecting if riskScoreBp > 8000). If approved, the CRE writes the decision to the BorrowApprovalRegistry, and the smart contracts enforce the final execution.
A second cron-driven CRE workflow continuously sweeps the protocol for solvency, computing exact repayment amounts off-chain and triggering partial or full liquidations deterministically on-chain.
How it Works
NeuroLedger utilizes a modular, three-tiered architecture to strictly separate off-chain policy from on-chain execution:
- Zero-Knowledge Privacy Layer: We implemented Groth16 ZK-SNARKs to create a private "ZK-Pass." This allows users to cryptographically prove their borrowing eligibility on-chain without exposing sensitive identity or financial parameters to the public.
- Off-Chain Policy Engine (Chainlink CRE): Built with TypeScript using the CRE SDK, this acts as the protocol's decentralized brain. We engineered two distinct workflows: an event-driven "Borrow Risk Orchestrator" that intercepts loan requests, and a cron-driven "Solvency Sweep" that autonomously calculates optimal liquidation repay amounts.
CRE Borrow Workflow: https://github.com/hashimh399/zk-private-nl/blob/main/workflows/zkpass-risk-orchestrator/index.ts
Liquidation Workflow: https://github.com/hashimh399/zk-private-nl/blob/main/workflows/liquidation-orchestrator/index.ts - Decentralized AI & Data Integrations: We built a custom Gemini AI risk agent and integrated external market sentiment (Alternative.me Fear & Greed API). Crucially, we utilized CRE's ConsensusAggregationByFields to fetch a median AI risk score across multiple decentralized nodes, preventing a single point of failure before writing the decision.
- On-Chain Execution Layer (Solidity): Deployed on Ethereum Sepolia, our custom smart contract suite (LendingPool, BorrowGate, BorrowApprovalRegistry, and CRE Receivers) serves as the ultimate deterministic enforcer, ensuring no AI decision bypasses hardcoded protocol solvency limits.
Links
Created by
- Hashim Ali Mir