Skip to main content
Create a seamless DeFi lending experience with Privy’s embedded wallets and Aave protocol. This guide shows you how to build an app where users can supply tokens directly to Aave, deploy yield-bearing vaults, and manage deposits—all without external wallets or complex onboarding.

Resources


Integrate with Aave protocol

There are two ways to integrate Aave into your application:
  • Supply directly to Aave: Directly supply tokens into Aave’s liquidity pools to earn interest. Your tokens become available for borrowers and you earn yield from interest payments.
  • Create a managed Aave vault: Create ERC-4626 compliant vaults that hold aTokens (Aave’s interest-bearing tokens). Vaults allow applications to manage supplied tokens on behalf of users and earn a percentage of the yield generated.
For this walkthrough, we’ll demonstrate using Base Sepolia and the WETH lending pool. The same patterns work across all Aave-supported networks and assets—explore the complete list of available pools and addresses in the BGD Labs Address Book.

Install and configure the Aave SDK

Key integration tips

  1. In NodeJS: the sendWith method from the Aave SDK is feature-rich and streamlines complex transaction flows. It automatically handles token approvals when required and then sends the main Aave transaction, making the overall process more seamless.
  2. Handle transaction plans: The Aave SDK returns various plan types (actions) like TransactionRequest and ApprovalRequired which can be used to handle different transaction scenarios accordingly. This allows for flexible handling of different approval and execution patterns.
  3. Add error handling: Production applications should wrap all async functions in try/catch blocks to handle common blockchain errors like user rejection, insufficient funds, network issues, and contract failures. Consider implementing user-friendly error messages and retry mechanisms for failed transactions.

Conclusion

With Privy and the Aave, building powerful DeFi lending experiences becomes seamless and secure. Users can interact with Aave protocol seamlessly through embedded wallets without needing external wallet management.