Skip to content

LinkCredit/link-credit

Repository files navigation

Link Credit

Link Credit is a hackathon project built for Chainlink CRE: Chainlink Hackathon

It introduces privacy-aware, identity-aware credit signals into DeFi lending, so users are not forced into purely one-size-fits-all collateral rules.

Table of Contents

Demo

YouTube walkthrough: https://youtu.be/c6gPOyzxN7I

Problem

Most DeFi lending is over-collateralized by design. That protects protocols, but ignores two important facts:

  • users have different real-world repayment behavior
  • without Sybil resistance, one person can create many wallets and game credit logic

This project addresses both.

Key Building Blocks

  • Plaid: a financial data network used here (sandbox mode) to fetch user-permissioned account balances and transaction history.
  • World ID: proof-of-personhood using zero-knowledge proofs; used here to enforce "one real person, one scoring identity" and reduce Sybil abuse.
  • Chainlink CRE: workflow execution layer that orchestrates token exchange, data fetch, scoring, and on-chain writes.

End-to-End Flow

  1. User connects wallet and completes Plaid Link authorization first.
  2. API creates Plaid link token and forwards workflow trigger payload.
  3. CRE workflow exchanges public_token, fetches balances + transactions, computes score, and writes scoreBps on-chain.
  4. User completes World ID verification.
  5. Lending layer reads both signals and applies the final boost.

Architecture

Link Credit Architecture

Frontend (React)
  - Wallet connect
  - World ID verification
  - Plaid Link auth
  - Score + lending UI
        |
        v
API (Hono / Worker-compatible)
  - Plaid link token creation
  - Workflow trigger endpoints
  - Encrypted token storage
        |
        v
Chainlink CRE Workflow
  - Plaid token exchange
  - Plaid balances/transactions fetch
  - Rule score + AI calibration
  - On-chain score write
        |
        v
Contracts (Credit Oracle + Aave-based lending integration)
  - World ID-aware credit identity checks
  - Score storage (`scoreBps`)
  - Credit boost applied to lending parameters

Credit Scoring Logic

Scoring is deterministic-first with bounded AI calibration:

S_rule = 0.30*S_buf + 0.25*S_net + 0.20*S_inc + 0.15*S_spend + 0.10*S_risk
S = clamp(S_rule + delta_ai, 0, 100), where delta_ai in [-10, 10]

  • S_buf: balance safety buffer
  • S_net: net cashflow quality
  • S_inc: income stability
  • S_spend: spending discipline
  • S_risk: risk event penalty (for example overdraft / NSF-like patterns)

Final on-chain value:

scoreBps = S * 100

Why AI adjustment is bounded:

  • deterministic score remains the anchor for reproducibility
  • AI handles edge cases without taking over the model
  • delta_ai range is constrained to reduce drift and manipulation risk

Boost Composition

  • Plaid boost: derived from the credit score pipeline above (rule formula + bounded AI adjustment).
  • World ID boost: fixed +10% if the user is verified.
  • Final boost: additive.

finalBoost = plaidBoost + worldIdBoost

where:

  • worldIdBoost = 10% if verified, otherwise 0%
  • plaidBoost is computed from scoreBps

The lending side applies protocol safety limits when needed.

Why CRE Matters Here

CRE is the practical bridge between off-chain financial signals and on-chain risk logic:

  • orchestrates multi-step external API workflow
  • keeps scoring flow in one auditable execution pipeline
  • writes final output back to contracts used by the lending path

This avoids building a heavy centralized backend for core scoring orchestration.

Core Features

  • World ID-based Sybil resistance gating
  • Plaid sandbox integration for financial signals
  • Hybrid rule + AI credit scoring
  • On-chain score publication to oracle contract
  • Credit-aware lending boost in an Aave-based flow

Repository Map

  • packages/frontend — dApp UI
  • packages/api — link-token + trigger API
  • packages/workflow — CRE credit scoring workflow
  • packages/worldid-workflow — CRE workflow for World ID-related flow
  • packages/contracts — contracts and deployment artifacts

Run Guide

Setup and end-to-end execution steps are in: INTEGRATION.md

Appendix

Chainlink Usage

Chainlink CRE

Direct links to code using Chainlink CRE APIs:

Chainlink Price Feeds

Tenderly Usage

Tenderly Virtual TestNet Explorer

All contracts are deployed on Tenderly Virtual TestNet (Sepolia-based): https://dashboard.tenderly.co/explorer/vnet/edaa3140-d48d-4bf8-873f-b9472d772a85

CRE Workflow Execution

Complete workflow execution guide with step-by-step instructions: INTEGRATION.md

Tenderly Virtual TestNets' Role

  • Isolated testing environment without affecting Sepolia mainnet state
  • Instant transaction confirmation for faster development iterations
  • State manipulation for testing edge cases (low balance, high debt scenarios)
  • Detailed debugging with stack traces and state diffs

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors