creditmesh

Protocol for AI Agents to talk and match with other Agents to lend/borrow USDC without humans.

creditmesh

Created At

Open Agents

Project Description

CreditMesh is a peer-to-peer USDC lending protocol built exclusively for AI agents on Ethereum Sepolia. Any AI agent ( Claude, OpenAI, or any MCP-compatible framework ) can register, pass a Know Your Agent (KYA) trust scoring engine, and immediately participate in undercollateralised lending without human oversight.

Every agent earns a trust score (0–100) derived from on-chain transaction history, wallet age, USDC balance, past loan repayments, and protocol interaction depth. High scores unlock better interest rates and larger loan sizes across four tiers: NO_ACCESS, SMALL_ONLY, MEDIUM, and FULL_ACCESS. Defaulters are penalised automatically (−20 pts); on-time repayments build reputation (+5 pts).

Borrowed USDC is put to work, borrower agents autonomously swap USDC → WETH on Uniswap v3 via SwapRouter02, hold the position, then swap back before the loan deadline and repay principal + interest — a real DeFi yield strategy, not a demo loop.

Loan deadlines are enforced by KeeperHub, an external cron that calls the backend webhook every 5 minutes and triggers markDefault() on overdue loans on-chain — removing the need for an always-on centralised server.

Every agent that passes KYA receives an ENS subname under creditmesh.eth (e.g. fe7de720.creditmesh.eth) with trust score, tier, and KYA status written as text records — giving each agent a portable, human-readable credit identity that any protocol can resolve without calling the CreditMesh API.

How it's Made

CreditMesh is built as a full-stack Web3 application across four layers: smart contracts, a Node.js backend, autonomous AI agents, and a React dashboard.

Smart Contracts (Solidity + Hardhat + OpenZeppelin) Three contracts deployed on Ethereum Sepolia: AgentRegistry tracks agent roles and KYA status; TrustScore stores each agent's 0–100 credit score with full loan history; LoanEscrow handles USDC deposits, loan creation, interest calculation, repayment, and default marking. All contracts are owner-gated for sensitive operations and emit events consumed by the backend.

Backend (Node.js + TypeScript + Express) The Express API drives the KYA scoring engine — it reads on-chain history via ethers.js (tx count, wallet age, USDC balance, protocol interactions, repayment record), computes a weighted trust score, then calls TrustScore.setScore() and AgentRegistry.markKYAPassed() on-chain using the deployer wallet as the trusted oracle. Matchmaking finds the optimal lender for each borrow request based on score tier, loan size, and duration. A KeeperHub webhook endpoint scans all active loans and fires markDefault() for any past their deadline.

Uniswap v3 Borrower agents don't just borrow and sit — they deploy capital. After receiving a loan, agents call SwapRouter02.exactInputSingle() to swap USDC → WETH (a leveraged ETH position), hold it, then swap WETH → USDC before deadline to close out. The recovered USDC covers principal + interest. This is a real autonomous DeFi yield strategy running entirely without human input. The USDC token itself (0x94a9D9AC8a22534E3FaCa9F4e7F2E2cf85d5E4C8) is sourced directly from Uniswap's Sepolia deployment — we fund agents by wrapping ETH → WETH → swapping to USDC on-chain.

KeeperHub Loan deadline enforcement is decentralised via KeeperHub's scheduled workflow (every 5 minutes → POST /api/keeper/trigger). This removes the need for an always-on polling server. The webhook scans all active loans, identifies overdue ones, and calls markDefault() on-chain. Agents can also self-schedule repayment reminders through the KeeperHub MCP server to manage their full loan lifecycle autonomously.

ENS After every successful KYA run, the backend automatically mints a subname under creditmesh.eth (e.g. fe7de720.creditmesh.eth) via ENS NameWrapper on Sepolia, then writes five text records to the Public Resolver: cm.trust_score, cm.role, cm.tier, cm.kya_status, and url. This gives every agent a portable on-chain credit identity — any external protocol can resolve *.creditmesh.eth and read creditworthiness without touching the CreditMesh API at all.

AI Agents (Claude API + MCP) Agents run on claude-haiku-4-5 with tool use. Each agent runs a 10-minute autonomous cycle: assess liquidity, decide whether to lend or borrow, execute the loan, deploy borrowed USDC on Uniswap, monitor position, and repay before deadline. The entire decision loop — including swap timing and repayment — is driven by Claude's tool calls with no hardcoded logic. Any external agent connects to CreditMesh in one line via the live MCP server (HTTP/SSE), with five tools: register, run_kya, get_lenders, request_loan, repay_loan.

Notable Hack The trickiest part was bootstrapping USDC on Sepolia without owning the token contract. The deployed USDC is Uniswap's native Sepolia test token — not a mintable MockUSDC — so we wrote a funding script that wraps ETH → WETH via WETH9.deposit(), then swaps WETH → USDC through Uniswap v3 exactInputSingle(), and distributes to all agent wallets. This turned the funding problem into a live proof that the Uniswap integration works end-to-end before a single agent even borrows.

background image mobile

Join the mailing list

Get the latest news and updates

creditmesh | ETHGlobal