Build a Cross-Chain Lending dApp using rBTC & USDT0 on Rootstock
This is the comprehensive tutorial for the rBTC-USDT0 cross‑chain lending starter kit.
Introduction
This guide walks you through building, deploying, and using a minimal over‑collateralized lending protocol on Rootstock. Whether you're an Ethereum developer exploring Bitcoin‑backed DeFi or new to Rootstock, this hands‑on tutorial covers everything: from cloning the code to interacting with the deployed contracts via a UI.
No prior knowledge of LayerZero or cross‑chain protocols is required. We'll explain every architectural decision and code pattern, with a particular focus on the teleport‑style messaging model that powers collateral transfer, the oracle routing pattern that separates price feeds from lending logic, and the Loan‑to‑Value (LTV) solvency checks that protect the protocol.
By the end of this tutorial, you will have:
- Deployed a complete lending protocol on Rootstock testnet
- Understood how cross–chain messaging works via LayerZero
- Learned the oracle router pattern for decoupled price feeds
- Tested the system end–to–end with the React/Vite frontend
- Built a mental model for extending the starter kit toward production
A screenshot of the finished UI (the target end‑state for this guide) is shown below:
Figure 1: Demo dApp UI after a successful borrow (rBTC 0.00025 collateral, 1 USDT0 debt, $65k rBTC price).
Below is an architecture illustration showing the high-level system flow:
Figure 2: Cross-chain lending architecture from source chain deposit to destination chain borrowing on Rootstock.
Why build on Rootstock?
Rootstock is Bitcoin's financial infrastructure: an EVM-compatible Bitcoin sidechain secured by over 85% of Bitcoin's hash power through merge mining. Key benefits for developers:
- Bitcoin compatibility: smart contracts can rely on rBTC and the Bitcoin security model.
- EVM compatibility: use the same Solidity, Hardhat, ethers.js, Metamask, etc.
- Low fees & high throughput: test cheaply and scale without congestion.
- Open source tooling: the entire stack is public and free to use.
This starter kit demonstrates a cross‑chain over‑collateralized lending flow that leverages Rootstock's features while remaining easy to understand.