TrustLayer-AMM

Testnet

ZK credit-score-weighted AMM combining Aleo privacy with Uniswap V4 hooks. Users prove their creditworthiness tier (basic, pro, whale) without revealing their actual score, receiving preferential fees and higher trading limits. Demonstrates the credential-based ZK pattern that also underlies InsuranceX.

AleoLeoSolidityUniswap V4ZK-SNARKs

The problem

Off-chain, a lender or broker gives better terms to a customer with a good credit history. On-chain, everyone pays the same fee, because the only way to prove you are creditworthy is to publish the number itself — and a credit score written to a public chain is attached to your address forever, readable by every counterparty, employer and competitor who cares to look. That is the trade-off TrustLayer removes: the pool learns which tier you qualify for, and nothing else.

How it works

The system spans two chains. On Aleo, a Leo program issues an encrypted credential holding the actual credit score; only the owner can decrypt it, using their view key. When a trader wants to trade, a second function proves that the hidden score falls inside a tier band — a mathematical proof that the number is between, say, 700 and 799, without ever disclosing it. A Node.js backend generates that proof through the snarkos CLI (one to three minutes), verifies it, and registers the trader's Ethereum address with the proven tier. From then on, a Uniswap V4 hook does the enforcement: on every swap, beforeSwap looks up the registered tier and applies that tier's fee and maximum trade size. The Ethereum side never sees a score — only a tier number.

The tiers

  • Below 600 — no access to the pool.
  • 600–699 (basic) — 0.5% fee, trades capped at 10K.
  • 700–799 (pro) — 0.3% fee, trades capped at 100K.
  • 800 and up (whale) — 0.1% fee, trades capped at 1M.

Status and my role

The full flow runs end to end on Aleo testnet and Arbitrum Sepolia: issue a credential, prove a tier, register an Ethereum wallet, and swap under that tier's terms. I built all three layers — the Leo circuits that issue credentials and prove tier membership, the Solidity Uniswap V4 hook that enforces fees and limits at swap time, and the Node relayer that carries a proof from one chain to the other — plus a React front end that talks to Leo Wallet and MetaMask side by side. The credential pattern here is the same one that underlies InsuranceX: prove a property, reveal nothing else.