Lagrange State Proofs Case Study #2: Cross-chain Credit Scores
October 6, 2022
Lagrange State Proofs are a new cryptographic primitive that enables trustless, non-interactive and aggregatable verifications of cross-chain states. In this multi-part series, we‘ll explore how Lagrange State Proofs can unlock new use cases for cross-chain DApps with improved functionalities, user experience and security.
In our previous article, we outlined how Lagrange State Proof can enable DApps to easily verify cross-chain Decentralized Identities (DIDs) within a single transaction, without requiring messaging protocols, bridges, oracles or intermediary protocols. In the context of DIDs, we focused on how Lagrange State Proofs can improve UX by enabling non-interactive cross-chain state verification.
In this article, we’ll consider cross-chain credit for undercollateralized lending protocols as a use case for Lagrange State Proofs. This use case brings to the fore a principal feature of Lagrange State Proofs — aggregatability.
Lagrange State Proofs are designed to be aggregatable to enable state verifications across n chains simultaneously within a single proof. In other words, the simultaneous verification of any number of Lagrange State Proofs can be combined into a single transaction that will always have a fixed cost. This enables a single Lagrange State Proof to prove the simultaneous state across a vector of n chains in real-time to the nth+1 chain.
Current Landscape of On-Chain Lending
Most popular DeFi lending protocols today, such as Aave, MakerDAO and Compound, require loans to be overcollateralized. This means that their Loan to Value ratio (LTV) is below 100% and is generally between 30%-70%. As such, a user must provide more collateral than the loan value that they’re receiving.
Additionally, unlike banking practices off-chain, the interest rates charged to the borrower don’t consider the borrower’s ability to pay back the loan. This is due to the pseudonymous nature of the on-chain wallets that the loans are tied to. For the same reason, unsecured and undercollateralized loans are not provided by leading on-chain platforms.
To enable personalized interest rates and unsecured loans, two technologies are needed: a DID and a credit rating associated with that DID. There are currently multiple platforms that are trying to provide both of these. Protocols such as Civic, Proof Of Humanity, and Fractal are tackling DIDs, while platforms such as Spectral Finance, Cred Protocol, and Credora are focusing on credit scores. Credit protocols generally mint a credit NFT (cNFT) based on a combination of on-chain and off-chain financial history that represents the creditworthiness of a user and a particular wallet.
Take for instance, Spectral Finance, which leverages proprietary and verifiable machine learning models to create Non-Fungible Credit (NFC) tokens from users’ unique transaction histories. Their proprietary Multi-Asset Credit Risk Oracle (MACRO) score provides insights into the creditworthiness of wallets and is used to underwrite loans with variable interest rates. Multiple Ethereum wallets can be bundled to create a single Spectral MACRO score.
In short, to underwrite an undercollateralized loan, an on-chain lending protocol needs to verify that a user has a wallet that owns two NFTs: a DID and a cNFT.
Aggregating Cross-Chain State Verification
Verifying that a user owns a DID and a cNFT is trivial to accomplish on a single chain with smart contract function calls. The problem arises when an application must verify that a user owns multiple NFTs on multiple different chains. Contracts on one chain can’t just call contracts on another.
Consider the example of a user with a cNFT on Ethereum and a DID on Polygon, where the user wants to use their credit information and identity to take out a cross-chain loan on Avalanche.
With existing cross-chain messaging protocols (Axelar, LayerZero, CCIP, etc), this process would require 3 separate distinct steps:
- The user submits a Polygon transaction to the DID contract. The contract emits an event that triggers an intermediary messaging protocol to relay proof of their DID to the lending contract on Avalanche.
- The user submits an Ethereum transaction to the cNFT contract. The contract emits an event that triggers an intermediary messaging protocol to relay proof of their cNFT to the lending contract on Avalanche.
- The user submits a transaction to the lending contract on Avalanche that underwrites a loan based on their cNFT and DID.
The total cost to the end user for this process is: three Avalanche transactions, one Ethereum transaction, one Polygon transaction and two intermediary messaging protocol fees.
In terms of latency, the end user is required to wait for six separate L1 transactions to be confirmed and for both intermediary protocol relays to occur. The security also becomes a minimum function across all three chains and the intermediary protocols.
Lagrange State Proofs in contrast are aggregatable. Rather than requiring six L1 transactions and two messaging protocol relays, the user can submit a single Lagrange State Proof to the Avalanche lending protocol that proves both of their cross-chain DID and cNFT states at once.
Within the above example, a single Lagrange State Proof generated by the user proves four properties simultaneously:
- The Polygon state root supplied by the user was generated correctly by the Lagrange Attestation Network.
- The Polygon state root contains a valid DID that is owned by the user.
- The Ethereum state root supplied by the user was generated correctly by the Lagrange Attestation Network.
- The Ethereum state root contains a cNFT with a specified credit score that is owned by the user.
The aggregated state proof can then be verified in one transaction on Avalanche.
Such a cross-chain mode of interaction is beneficial to all parties involved. From the perspective of the users, apart from any financial savings, the transaction is much simpler than having to use multiple intermediary messaging protocols. From the perspective of the lending protocol, a simple single transaction for its users makes the lender’s platform much more attractive to potential users and to liquidity providers. From the perspective of the credit rating protocol and DID protocol, the reach of their solution is expanded beyond the single chain they natively operate on.
In the next article, we’ll explore how Lagrange State Proofs will unlock new functionalities for multi-chain DAOs by enabling trustless cross-chain voting and proposal executions.