# From project root
cd /Users/matteo/projects/cachecash
cargo run --package serverThe server will start on http://localhost:9002 with these endpoints:
POST /api/faucet- Get funds from faucetPOST /api/transfer- Send funds to another userPOST /api/notes- Upload encrypted notesGET /api/notes/{recipient_tag}- Fetch encrypted notesDELETE /api/notes/{recipient_tag}/{note_id}- Delete notes
# In another terminal
cd front
npm run devThe frontend will connect to http://localhost:9002 (configured in front/.env)
- Click the "SEND" button in the game UI
- Enter recipient's username (e.g., "alice")
- The system will automatically derive their public key
- You'll see a preview:
→ 1a2b3c4d...9e8f7g6h
- Enter amount (must be ≤ your available balance)
- Click "Send Transfer"
You can also send directly to a public key:
Recipient: 0x32bf2d2c5796...
No action needed! The app automatically:
- Polls for encrypted notes every 30 seconds
- Decrypts notes with your private key
- Adds funds to your balance
- Shows notification in console
- Selects optimal notes to spend (greedy algorithm)
- Computes nullifiers locally (keeps secret keys private!)
- Builds transaction with commitments
- Submits to
/api/transfer - Uploads encrypted note for recipient
- Validates inputs (pubkey, amount, commitments)
- Builds blob transaction
- Submits to blockchain
- Returns tx hash + change note
- Encrypted notes polling hook fetches notes
- Decrypts with private key (ECDH + AES)
- Adds to localStorage
- Balance updates automatically
rest_server_port = 9002
default_faucet_amount = 10
node_url = "http://127.0.0.1:4321"
utxo_contract_name = "hyli_utxo"VITE_SERVER_BASE_URL=http://localhost:9002
Solution: Backend server isn't running. Start it with:
cargo run --package serverCauses:
- Notes still marked as "optimistic" (wait for blockchain confirmation)
- Notes are pending from another transfer
- No confirmed notes yet
Solution:
- Slice pumpkins to get funds from faucet
- Wait a few seconds for blockchain confirmation
- Check Debug panel (add
?debug=trueto URL)
Check console logs for:
- Insufficient balance errors
- Invalid recipient format
- Network connection issues
✅ Client-Side Privacy
- Secret keys never leave browser
- Nullifiers computed locally
- Encrypted note delivery (ECDH + AES)
✅ Double-Spend Prevention
- Pending transfer tracking
- Nullifier checking on blockchain
- 5-minute timeout for abandoned transfers
✅ Input Validation
- 32-byte public key validation
- Positive amount checking
- Balance verification
- Self-transfer prevention
User A (Browser) Backend Server Blockchain
| | |
| 1. Select notes | |
| 2. Compute nullifiers | |
| (secret keys stay local!) | |
| | |
| 3. POST /api/transfer ------->| |
| - commitments | 4. Build blob tx |
| - nullifiers | 5. Submit tx ------------->|
| - output notes | |
| |<------ 6. Tx hash ---------|
|<------ 7. Response -----------| |
| (tx hash, change note) | |
| | |
| 8. Upload encrypted note ---->| |
| (for recipient) | 9. Store note |
| | |
User B (Browser)
|
| 10. Poll /api/notes (30s)
|<------ 11. Encrypted notes ---|
| 12. Decrypt locally
| 13. Add to balance
- Backend starts without errors
- Frontend connects to backend
- Faucet works (slice pumpkins)
- Transfer modal shows correct balance
- Can transfer by username
- Can transfer by public key
- Recipient receives funds automatically
- Change notes are handled correctly
- Can't send to yourself
- Pending notes excluded from balance
# Backend tests
cargo test --package server
# Frontend tests
cd front && npm test# Backend
cargo build --release --package server
# Frontend
cd front && npm run build