A Python Flask backend for a decentralised ISA (Income Share Agreement) platform built on Solana devnet. Every transaction is a real on-chain blockchain transaction — click any Explorer link to verify.
- Python + Flask — REST API backend
- Supabase — PostgreSQL database (contracts, investments, transactions)
- Solana devnet — Real blockchain transactions via
solana-py+solders - No Rust, no Anchor — Pure Python Solana integration
pip install -r requirements.txt- Go to supabase.com and create a new project
- Open the SQL Editor and paste the contents of
supabase_schema.sql - Run the SQL to create the
contracts,transactions, andinvestmentstables
cp .env.example .envFill in your Supabase credentials:
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_KEY=your-anon-key
python app.pycurl -X POST http://localhost:5000/api/setup/escrowCopy the public_key and secret_key from the response into your .env file:
ESCROW_PUBLIC_KEY=<public_key from response>
ESCROW_SECRET_KEY=<secret_key JSON array from response>
python app.pyThe server is now fully configured and ready to use.
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/setup/escrow |
Create escrow wallet (one-time) |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/contracts/create |
Create a new ISA contract |
| POST | /api/contracts/fund |
Fund a contract (investor) |
| POST | /api/contracts/repay |
Make income-based repayment |
| GET | /api/contracts |
List all contracts |
| GET | /api/contracts/<id> |
Get contract + investments |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/ledger |
Last 20 transactions |
| GET | /api/escrow/balance |
Live escrow SOL balance |
curl -X POST http://localhost:5000/api/contracts/create \
-H "Content-Type: application/json" \
-d '{
"student_name": "Alice Johnson",
"course": "Computer Science BSc",
"amount_needed": 15000,
"income_share_pct": 10,
"repayment_cap": 25000,
"income_threshold": 25000
}'curl -X POST http://localhost:5000/api/contracts/fund \
-H "Content-Type: application/json" \
-d '{
"contract_id": "ISA-XXXXXXXX",
"investor_name": "Bob Smith",
"amount": 15000,
"return_pct": 5
}'curl -X POST http://localhost:5000/api/contracts/repay \
-H "Content-Type: application/json" \
-d '{
"contract_id": "ISA-XXXXXXXX",
"monthly_income": 3500
}'curl http://localhost:5000/api/escrow/balancecurl http://localhost:5000/api/ledger- Student creates a contract — A Solana wallet is generated, 1 SOL airdropped, ISA terms stored in Supabase
- Investor funds the contract — A new wallet is created, 3 SOL airdropped, real SOL transferred to escrow on-chain
- Student graduates and earns — If income exceeds the threshold, a percentage is transferred from escrow back to the student wallet
- Every step is verifiable — Each response includes a Solana Explorer link to the real devnet transaction
- Amount scaling: All GBP amounts are divided by 1000 when converting to SOL (demo purposes on devnet)
- Real transactions: Every fund and repayment is a real Solana devnet transaction with a verifiable Explorer link
- Escrow model: A single platform escrow wallet holds funds between investors and students
- Income threshold: Repayments only trigger when annual income exceeds the contract's threshold (protects low earners)
- Repayment cap: Total repayments are capped — the student never pays more than the agreed maximum