The Solana layer is now fully integrated with the backend authentication and database.
┌─────────────────────────────────────────────────────────────────────┐
│ FRONTEND (React + Vite) │
│ ┌───────────────┐ ┌───────────────┐ ┌───────────────────────┐ │
│ │ AuthContext │ │SolanaProvider │ │ usePoolTransactions │ │
│ │ - login │ │ - wallet │ │ - joinPool() │ │
│ │ - linkWallet │ │ - connection │ │ - createPool() │ │
│ └───────┬───────┘ └───────┬───────┘ └───────────┬───────────┘ │
│ │ │ │ │
│ └──────────────────┴──────────────────────┘ │
│ │ │
└─────────────────────────────┼───────────────────────────────────────┘
│
┌──────────────────┴──────────────────┐
▼ ▼
┌─────────────────────┐ ┌─────────────────────┐
│ SPRING BOOT API │ │ SOLANA BLOCKCHAIN │
│ │ │ │
│ • Auth (JWT) │ │ • Pool accounts │
│ • User management │ │ • Commitment accts │
│ • Wallet linking │ │ • Vault (escrow) │
│ • Pool metadata │ │ • Program logic │
│ • Commitment track │ │ │
│ │ │ │
│ MongoDB ────────────────────────────► On-chain data │
└─────────────────────┘ └─────────────────────┘
# Using Docker
docker run -d -p 27017:27017 --name mongodb mongo:latest
cd backend
./mvnw spring-boot:run
3. Start Local Solana Validator
solana-test-validator --reset
cd pooling-escrow
export ANCHOR_WALLET=" $HOME /.config/solana/id.json"
anchor deploy --provider.cluster localnet
npx ts-node scripts/seed-pools.ts
cd frontend
npm install
npm run dev
Method
Endpoint
Auth
Description
POST
/api/auth/register
No
Register new SMB owner
POST
/api/auth/login
No
Login
GET
/api/auth/me
Yes
Get current user
Method
Endpoint
Auth
Description
POST
/api/wallet/link
Yes
Link Solana wallet
DELETE
/api/wallet/unlink
Yes
Unlink wallet
GET
/api/wallet/status
Yes
Get wallet status
Method
Endpoint
Auth
Description
GET
/api/pools
No
List all pools
POST
/api/pools
Yes
Register new pool
GET
/api/pools/address/{addr}
No
Get pool by Solana address
GET
/api/pools/my-pools
Yes
Get user's created pools
POST
/api/pools/commit
Yes
Record commitment
GET
/api/pools/my-commitments
Yes
Get user's commitments
1. User logs in → JWT token stored
↓
2. User connects Solana wallet (Phantom/Solflare)
↓
3. User links wallet (signs message to prove ownership)
└─► Backend stores wallet public key
↓
4. User clicks "Join Pool" on a pool card
↓
5. Frontend checks:
├─ Authenticated? ✓
├─ Wallet connected? ✓
└─ Wallet matches linked wallet? ✓
↓
6. User enters quantity in modal
↓
7. Frontend executes Solana transactions:
├─ commit(quantity) → Creates Commitment PDA
└─ deposit(lamports) → Transfers SOL to Vault PDA
↓
8. Frontend records in backend:
└─ POST /api/pools/commit
↓
9. Success! User sees confirmation with tx signature
backend/src/main/java/com/blockchainBusters/SolPool/
├── auth/
│ ├── controller/AuthController.java # Login, register, /me
│ ├── model/User.java # User with wallet linking
│ └── security/
│ ├── JwtFilter.java # JWT authentication
│ └── JwtService.java # Token generation/validation
├── wallet/
│ ├── controller/WalletController.java # Link/unlink wallet
│ └── service/WalletAuthService.java # Signature verification
├── pool/
│ ├── controller/PoolController.java # Pool CRUD + commitments
│ ├── model/Pool.java # Pool with cached on-chain data
│ └── service/PoolService.java # Business logic
└── config/SecurityConfig.java # CORS, JWT filter setup
frontend/src/
├── contexts/
│ ├── AuthContext.tsx # Auth + wallet linking state
│ └── SolanaProvider.tsx # Wallet adapter setup
├── hooks/
│ ├── usePools.ts # Fetch pools from Solana
│ └── usePoolTransactions.ts # Execute Solana transactions
├── components/
│ ├── JoinPoolModal.tsx # Modal for joining pools
│ └── sections/ActivePoolsSection.tsx # Pool display
└── lib/api.ts # Backend API client
pooling-escrow/
├── programs/pooling_escrow/src/lib.rs # On-chain program
├── idl/pooling_escrow.json # Program interface
└── client/poolingClient.ts # TypeScript helpers
Wallet Linking : Users must sign a message to prove wallet ownership before linking
JWT Authentication : All sensitive endpoints require valid JWT
Wallet Matching : Transactions only allowed if connected wallet matches linked wallet
Signature Verification : TODO - Implement proper Ed25519 verification for production
cd backend && ./mvnw test
cd frontend && npm test
cd pooling-escrow && anchor test
Register at /signup
Login at /login
Connect Phantom wallet
Link wallet (signs message)
Browse pools on homepage
Click "Join Pool" → enter quantity → confirm transaction