Skip to content

robertwbattle/LoanMe

Repository files navigation

Solana Loan Platform

A decentralized lending platform built on Solana that enables peer-to-peer loans with customizable terms.

🏗 Project Structure

The project consists of three main components: # LoanMe

LoanMe is a decentralized lending platform built on Solana, enabling users to create, manage, and repay loans in a trustless environment. The platform leverages Anchor for Solana smart contracts, Flask for backend APIs, and SQLite for lightweight data storage.

Features

  • Loan Management: Borrowers can request loans, and lenders can fund them.
  • Solana Smart Contracts: Powered by Anchor to ensure security and transparency.
  • Wallet Integration: Users can generate and manage Solana wallets.
  • Payment Processing: Borrowers can make repayments via smart contracts.
  • API-Driven: Exposes RESTful APIs for frontend integration.

Installation

1. Clone the Repository

git clone https://github.com/robertwbattle/LoanMe.git
cd LoanMe

2. Install Dependencies

Backend Requirements

pip install -r requirements.txt

Solana & Anchor (For Smart Contracts)

Ensure you have Anchor & Solana CLI installed:

sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
npm install -g @coral-xyz/anchor-cli

Verify installation:

solana --version
anchor --version

Configuration

1. Set Up Environment Variables

Create a .env file inside the backend/ directory and configure:

SOLANA_RPC_URL="https://api.devnet.solana.com"
WALLET_PRIVATE_KEY="[YOUR_SOLANA_PRIVATE_KEY]"
PROGRAM_ID="[YOUR_DEPLOYED_PROGRAM_ID]"
TATUM_API_KEY="[YOUR_TATUM_API_KEY]"
TATUM_API_URL="[TATUM_API_ENDPOINT]"

2. Set Up SQLite Database

cd backend
python setup_db.py  # Initializes the database

Running the Project

1. Start the Flask Backend

cd backend
python app.py

The API will be available at http://127.0.0.1:5000

2. Deploy the Smart Contract

cd anchor
anchor build
anchor deploy

API Endpoints

User Management

  • POST /api/account - Create a new user account
  • POST /api/generate-wallet/<user_id> - Generate a Solana wallet for a user

Loan Management

  • GET /api/loans/<loan_pda> - Get loan details
  • POST /api/loans - Create a new loan
  • POST /api/loans/<loan_pda>/payments - Make a payment on a loan

Deployment & Debugging

  • POST /api/deploy - Deploy smart contract
  • GET /api/deploy/<signature> - Get deployment status

Debugging

Check Solana Logs

solana logs

Check Transaction Details

solana transaction <SIGNATURE> --verbose

Run Local Tests

anchor test

Roadmap

  • Frontend React Integration
  • WalletConnect Support
  • Multi-currency Loan Support
  • Enhanced Smart Contract Security

Security & Auditing

LoanMe uses Solana’s security best practices, but as an open-source project, we encourage audits and contributions to improve the platform.

Contributing

Contributions are welcome! Please create an issue or submit a pull request.

License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •