Our centralized P2P lending platform allows users to borrow Bitcoin by using gold or property as collateral. The platform is built on the Stacks blockchain using Clarity smart contracts, ensuring transparency and security
To mitigate Bitcoin's price volatility, our repayment system employs a risk-adjusted model that splits the loan into fixed and variable BTC portions based on a risk percentage (α).
The borrower receives a BTC loan, and its USD equivalent is determined at issuance. Interest is compounded monthly over the loan period.
The repayment amount is divided into:
Fixed BTC Portion (α% of the loan in USD) This portion is locked in BTC at the original BTC/USD price. Interest is applied in BTC terms, keeping the borrower’s obligation stable. Variable BTC Portion ((1-α)% of the loan in USD) This portion accrues interest in USD terms and is converted to BTC at the repayment-time BTC/USD rate.
- Protects lenders from BTC price drops by maintaining a USD-pegged portion.
- Gives borrowers stability with a fixed BTC obligation while allowing them to benefit from BTC price appreciation.
- Ensures fair interest application on both fixed and variable portions.
This approach creates a balanced and secure lending system, making Bitcoin-backed loans more practical and sustainable. 🚀
- 🏦 Borrow Bitcoin against physical collateral (Gold and Property)
- 💰 Lend Bitcoin and earn interest
- 📊 Real-time loan management and tracking
- 🔐 Secure wallet integration
- 💱 Automatic EMI calculations
- 📈 Real-time BTC price integration
- 🏠 Property and Gold valuation system
- Frontend: React.js with TailwindCSS
- Backend: Node.js with Express
- Smart Contracts: Clarity (Stacks blockchain)
- Database: MongoDB
- APIs:
- CoinMarketCap for BTC prices
- Metal Price API for gold rates
- Custom property valuation system
- Node.js (v22 or higher)
- MongoDB
- Rust (for EMI calculator module)
- Clarinet (for Clarity smart contract development)
- Docker (for running Clarinet Devnet)
- API Keys:
- CoinMarketCap API key
- Metal Price API key
- Clone the repository:
git clone https://github.com/jayeshy14/bitcoin-loan-bank.git
cd bitcoin-loan-bank- Install dependencies:
# Install backend dependencies
cd backend
npm install
# Install frontend dependencies
cd ../frontend
npm install- Set up environment variables:
Create a .env file in the backend directory:
PORT=3000
MONGODB_URI=your_mongodb_uri
JWT_SECRET=your_jwt_secret
COINMARKETCAP_API_KEY=your_coinmarketcap_api_key
METAL_PRICE_API_KEY=your_metal_price_api_key- Set up the smart contract:
cd contracts
npm install
clarinet devnet startclarinet deployments apply --devnet
//(agree for both deployments)
node scripts/token-setup.js- Start the backend server:
cd backend
npm run dev- Start the frontend development server:
cd frontend
npm run dev- Access the application at
http://localhost:5173
deposit: Deposit BTC into the contractloan: Issue a loan with collateralrepay: Make loan repaymentswithdraw: Withdraw BTC from the contractclose-loan: Close an active loanopen-loan: Reopen a closed loan
POST /api/auth/register: Register a new userPOST /api/auth/login: Login userGET /api/auth/me: Get current user
POST /api/loans/apply: Create loan applicationGET /api/loans/my-applications: Get user's pending applicationsGET /api/loans/my-active-loans: Get user's active loansGET /api/loans/my-closed-loans: Get user's closed loansPOST /api/loans/calculate_emi/:id: Calculate EMI for a loan
POST /api/collateral/create: Create new collateralGET /api/collateral/my-collaterals: Get user's collateralsDELETE /api/collateral/remove/:id: Remove collateral