Cross-Chain Lending Protocol between Stacks and EVM Networks
StackLend is a revolutionary decentralized finance (DeFi) protocol that enables seamless cross-chain lending by using STX as collateral on Stacks blockchain to borrow tokens on EVM-compatible networks. The protocol bridges Bitcoin's security through Stacks with the liquidity of Ethereum-based ecosystems.
- Cross-Chain Lending: Use STX as collateral to borrow tokens on multiple EVM networks
- Stacks Integration: Leverage Bitcoin's security through Stacks blockchain
- Multi-Network Support: Currently supports Scroll Sepolia with plans for more networks
- Real-Time Relayer: Automated cross-chain transaction processing
- User-Friendly Interface: Modern React frontend with wallet integration
- Secure Smart Contracts: Audited and battle-tested contract architecture
The protocol consists of four main components:
graph TB
A[Frontend dApp] --> B[Stacks Contracts]
A --> C[EVM Contracts]
B --> D[Cross-Chain Relayer]
D --> C
B --> E[STX Collateral]
C --> F[Token Borrowing]
D --> G[Event Processing]
- Frontend (
stacklend-fe): React-based user interface with Stacks and EVM wallet integration - Stacks Contracts (
stacklend-stacks): Clarity smart contracts for collateral management - EVM Contracts (
stacklend-evm): Solidity contracts for token borrowing and lending - Relayer (
stacklend-relayer): Node.js service for cross-chain event processing
| Contract | Address |
|---|---|
| Collateral V1 | STBGS8Y6KHWQ3D2P9BTQ83VBD3ZCK7BDTWMGJY5Z.collateral-v1 |
| Lending V1 | STBGS8Y6KHWQ3D2P9BTQ83VBD3ZCK7BDTWMGJY5Z.lending-v1 |
| Contract | Address | Explorer |
|---|---|---|
| BorrowController | 0xD2b0838ff0818E9aa185a712576Cb3EE0885deda |
View on Scrollscan |
| MockUSDC | 0x953E5610c73C989fE7C75D3D67bE0A1e44a8e797 |
View on Scrollscan |
| MockUSDT | 0x13cF4E3e284d34C575CeeCCb0791Ca535A657da2 |
View on Scrollscan |
| MockWBTC | 0xf12cd252CA50781EC88c2d8832cA4f9c4bF11D82 |
View on Scrollscan |
- Stacks Testnet Collateral-V1: Stacks Explorer
- Stacks Testnet Lending-V1: Stacks Explorer
- Scroll Sepolia: Scrollscan Testnet
- Node.js 18+ and npm/pnpm
- Git
- Stacks wallet (Hiro Wallet, Leather, etc.)
- MetaMask or compatible EVM wallet
-
Clone the repository
git clone https://github.com/xfajarr/stacklend.git cd stacklend -
Install dependencies for each component
# Frontend cd stacklend-fe npm install # Relayer cd ../stacklend-relayer npm install # Stacks contracts (optional, for development) cd ../stacklend-stacks npm install
-
Configure environment variables
# In stacklend-relayer/ cp .env.example .env # Edit .env with your RPC URLs and private keys
-
Start the development servers
# Terminal 1: Start relayer cd stacklend-relayer npm start # Terminal 2: Start frontend cd stacklend-fe npm run dev
-
Access the application
- Frontend: http://localhost:5173
- Relayer API: http://localhost:3000
- Deposit Collateral: Users deposit STX tokens as collateral on Stacks blockchain
- Request Borrow: Users specify the token and amount they want to borrow on EVM networks
- Cross-Chain Processing: The relayer monitors Stacks events and processes requests
- Token Minting: EVM contracts mint/transfer requested tokens to user's EVM address
- Repayment: Users repay borrowed tokens on EVM to unlock their STX collateral
cd stacklend-fe
npm run dev # Start development server
npm run build # Build for production
npm run lint # Run lintingStacks Contracts:
cd stacklend-stacks
clarinet check # Check contract syntax
clarinet test # Run tests
clarinet deploy # Deploy to testnetEVM Contracts:
cd stacklend-evm
forge build # Compile contracts
forge test # Run tests
forge script script/Deploy.s.sol --rpc-url $RPC_URL --broadcast # Deploycd stacklend-relayer
npm run dev # Start with hot reload
npm test # Run tests
npm run docker # Build Docker image-
Get Testnet Tokens
- STX: Stacks Testnet Faucet
- Scroll Sepolia ETH: Scroll Faucet
-
Connect Wallets
- Configure Stacks wallet for testnet
- Add Scroll Sepolia network to MetaMask
- Network Details:
- Name: Scroll Sepolia
- RPC URL: https://sepolia-rpc.scroll.io/
- Chain ID: 534351
- Currency: ETH
- Explorer: https://sepolia.scrollscan.com/
-
Test Flow
- Deposit STX collateral
- Request token borrow
- Verify token receipt on EVM
- Test repayment flow
We welcome contributions! Please read our contributing guidelines and submit pull requests for any improvements.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
- All smart contracts have been tested extensively
- Cross-chain transactions are validated by the relayer
- Multi-signature support for critical operations
- Regular security audits and updates
This project is licensed under the MIT License - see the LICENSE file for details.
- Website: [Coming Soon]