Skip to content

Commit e478258

Browse files
committed
feat: Add payment links feature and project documentation
Payment Links: - Add payment link button to dashboard - Fix payment history API to use wallet address parameter - Add 'View My Links' button in create page - Update hook imports in payment history page - Add payment_links table schema to database Documentation: - Add comprehensive feature roadmap guide - Document X-Ray Protocol and ZK technology - Add honest project assessment - Include implementation priorities and timeline
1 parent e27a3ca commit e478258

7 files changed

Lines changed: 985 additions & 45 deletions

File tree

demo/docs/FEATURE_ROADMAP.md

Lines changed: 616 additions & 0 deletions
Large diffs are not rendered by default.

demo/docs/HONEST_ASSESSMENT.md

Lines changed: 281 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,281 @@
1+
# STELLARAY - 100% HONEST ASSESSMENT
2+
3+
**No bullshit. Just facts.**
4+
5+
---
6+
7+
## WHAT'S ACTUALLY DONE ✅
8+
9+
### 1. Landing Page (`/`)
10+
- Beautiful UI with dark/light theme
11+
- Google sign-in button (redirects to waitlist when WAITLIST_MODE=true)
12+
- X-Ray Protocol information section
13+
- Network switcher (testnet/mainnet)
14+
- **STATUS: COMPLETE**
15+
16+
### 2. Dashboard (`/dashboard`)
17+
- Google OAuth integration (NextAuth.js) - **WORKING**
18+
- Wallet generation from Google sub ID - **WORKING (but NOT real ZK)**
19+
- Balance display - **WORKING** (fetches from Stellar Horizon)
20+
- Transaction history - **WORKING** (fetches from Stellar Horizon)
21+
- Send XLM functionality - **WORKING** (real transactions on testnet)
22+
- Receive with QR code - **WORKING**
23+
- Fund with Friendbot - **WORKING** (testnet only)
24+
- XLM price display - **WORKING** (from CoinGecko/CoinPaprika)
25+
- X-Ray metrics display - **WORKING** (fetches blockchain events)
26+
- **STATUS: 90% COMPLETE** (missing real ZK)
27+
28+
### 3. Explorer Page (`/explorer`)
29+
- ZK Proof Visualizer component - **UI ONLY** (displays mock/fetched data)
30+
- Gas Savings Comparison - **UI ONLY** (shows comparison charts)
31+
- Proof Timeline - **UI ONLY** (shows recent proofs)
32+
- Network Activity Monitor - **WORKING** (fetches real Horizon data)
33+
- BN254 Curve Explorer - **UI/EDUCATIONAL**
34+
- Proof Benchmark - **UI ONLY**
35+
- Privacy Calculator - **UI ONLY**
36+
- Identity Badge System - **UI ONLY**
37+
- **STATUS: 70% COMPLETE** (lots of UI, data is mostly mock)
38+
39+
### 4. SDK Pages (`/sdk`, `/sdk-demo`, `/sdk-live`)
40+
- SDK documentation - **COMPLETE**
41+
- SDK import tests - **WORKING** (SDK imports successfully)
42+
- SDK instantiation - **WORKING** (can create ZkLoginClient)
43+
- **STATUS: COMPLETE** (but SDK not actually used for wallet creation)
44+
45+
### 5. Payment Page (`/pay`)
46+
- Payment link generator - **WORKING**
47+
- Deep links to Lobstr wallet - **WORKING**
48+
- Stellar URI protocol - **WORKING**
49+
- **STATUS: COMPLETE**
50+
51+
### 6. Components (14 total)
52+
| Component | Purpose | Real Data? |
53+
|-----------|---------|------------|
54+
| `ZKProofVisualizer` | Shows proof structure | Fetched from blockchain events |
55+
| `GasSavingsComparison` | WASM vs X-Ray gas | Calculated/mock |
56+
| `ProofTimeline` | Recent proof activity | Fetched from blockchain |
57+
| `ProofMetrics` | Verification stats | Aggregated from events |
58+
| `NetworkActivityMonitor` | Live blockchain activity | Real Horizon data |
59+
| `BN254CurveExplorer` | Educational curve viz | Static/calculated |
60+
| `ProofBenchmark` | Performance testing | Simulated |
61+
| `PrivacyCalculator` | Privacy metrics | Calculated |
62+
| `IdentityBadgeSystem` | Achievement badges | Mock data |
63+
| `AdvancedAnalyticsDashboard` | Analytics charts | Mock data |
64+
| `XRayStatusBadge` | Protocol status | API data |
65+
| `TransactionXRayBadge` | TX ZK status | Mock/derived |
66+
| `NetworkSwitcher` | Testnet/Mainnet toggle | Working |
67+
| `LoadingScreen` | Loading animation | Working |
68+
69+
### 7. Backend APIs
70+
| Route | Status | Real? |
71+
|-------|--------|-------|
72+
| `/api/auth/[...nextauth]` | ✅ Working | Yes - Google OAuth |
73+
| `/api/price` | ✅ Working | Yes - CoinGecko/etc |
74+
| `/api/xray/events` | ✅ Working | Yes - Stellar Horizon |
75+
| `/api/xray/status` | ✅ Working | Partially real |
76+
| `/api/xray/metrics` | ✅ Working | Aggregated from events |
77+
78+
### 8. Libraries
79+
| Library | Purpose | Status |
80+
|---------|---------|--------|
81+
| `lib/stellar.ts` | Stellar operations | ✅ Working |
82+
| `lib/soroban.ts` | Contract interactions | ⚠️ Defined but not fully used |
83+
| `lib/xray.ts` | X-Ray data fetching | ✅ Working |
84+
| `lib/db.ts` | Database utilities | ✅ Working |
85+
86+
---
87+
88+
## WHAT'S NOT DONE ❌
89+
90+
### The Critical Missing Piece: ACTUAL ZK
91+
92+
**Current wallet generation (NOT real ZK):**
93+
```typescript
94+
// lib/stellar.ts line 122-137
95+
export function generateWalletFromSub(sub: string): WalletKeys {
96+
// This is just a hash, NOT zero-knowledge proof!
97+
const data = encoder.encode(`stellar-zklogin-${sub}-${net}-v1`);
98+
const hash = StellarSdk.hash(Buffer.from(data));
99+
const keypair = StellarSdk.Keypair.fromRawEd25519Seed(hash);
100+
return { publicKey: keypair.publicKey(), secretKey: keypair.secret() };
101+
}
102+
```
103+
104+
**What SHOULD happen (real ZK):**
105+
```typescript
106+
export async function generateZkWallet(googleIdToken: string): Promise<ZkWallet> {
107+
// 1. Get user salt from salt service
108+
const salt = await saltService.getOrCreate(googleIdToken);
109+
110+
// 2. Generate ZK proof via prover service
111+
const proof = await proverService.generateProof({
112+
idToken: googleIdToken,
113+
salt: salt,
114+
maxEpoch: currentEpoch + 10,
115+
});
116+
117+
// 3. Derive address from proof (deterministic)
118+
const address = deriveAddressFromProof(proof);
119+
120+
// 4. Verify proof on-chain
121+
await zkVerifierContract.verify(proof);
122+
123+
return { address, proof };
124+
}
125+
```
126+
127+
### What's Missing:
128+
129+
1. **Prover Service** - Server that generates ZK proofs
130+
- Need to run ZK circuit (Groth16)
131+
- CPU/GPU intensive
132+
- ~$20K infrastructure cost
133+
134+
2. **Salt Service** - Secure storage for user salts
135+
- Need HSM/KMS backed storage
136+
- Each user needs unique salt
137+
- ~$10K infrastructure cost
138+
139+
3. **Actual ZK Proof Generation** - The core feature
140+
- SDK has the code but we're not calling it
141+
- Need to connect frontend → prover → blockchain
142+
143+
4. **On-Chain Verification** - Proving identity on Stellar
144+
- Contract exists but not being called
145+
- Need to submit proofs to ZK Verifier contract
146+
147+
---
148+
149+
## REAL VS FAKE DATA
150+
151+
| Feature | Data Source | Real? |
152+
|---------|-------------|-------|
153+
| Wallet address | Hash of Google sub | ❌ Not real ZK |
154+
| Balance | Stellar Horizon API | ✅ Real |
155+
| Transactions | Stellar Horizon API | ✅ Real |
156+
| Send/Receive | Stellar SDK | ✅ Real |
157+
| XLM Price | CoinGecko/CoinPaprika | ✅ Real |
158+
| X-Ray Events | Stellar Horizon operations | ✅ Real (but not ZK-specific) |
159+
| Proof Visualizer | Derived from tx hashes | ⚠️ Derived, not actual proofs |
160+
| Gas Comparisons | Calculated estimates | ⚠️ Estimates, not measured |
161+
| Badge System | Mock data | ❌ Fake |
162+
| User count/stats | Mock data | ❌ Fake |
163+
164+
---
165+
166+
## HONEST SUMMARY
167+
168+
### What You Can Demo:
169+
1. Sign in with Google ✅
170+
2. Get a Stellar wallet address ✅
171+
3. Fund it with testnet XLM ✅
172+
4. Send/receive real transactions ✅
173+
5. See real balance and history ✅
174+
6. Show X-Ray protocol info ✅
175+
7. Show blockchain activity ✅
176+
177+
### What You CANNOT Demo:
178+
1. Actual ZK proof generation ❌
179+
2. On-chain proof verification ❌
180+
3. Privacy-preserving authentication ❌
181+
4. The core "zkLogin" feature ❌
182+
183+
### The Hard Truth:
184+
**You have a working Stellar wallet with Google login. But it's NOT using zero-knowledge proofs. The wallet is generated from a simple hash of the Google ID, which means:**
185+
186+
- Google (or anyone with the ID token) could derive your wallet
187+
- There's no cryptographic privacy
188+
- The "ZK" part is marketing, not implementation
189+
190+
---
191+
192+
## WHAT NEEDS TO BE BUILT
193+
194+
### Priority 1: Prover Service (2-3 weeks)
195+
- Rust or Node.js service
196+
- Generates Groth16 proofs
197+
- Uses the zkLogin circuit
198+
- Deployed on AWS/GCP with GPUs
199+
200+
### Priority 2: Salt Service (1 week)
201+
- Simple API with KMS-backed storage
202+
- Associates Google sub → unique salt
203+
- Needs to be secure (HSM ideal)
204+
205+
### Priority 3: Frontend Integration (1 week)
206+
- Replace `generateWalletFromSub` with actual ZK flow
207+
- Call prover service
208+
- Submit proofs to blockchain
209+
210+
### Priority 4: Testing & Security (2 weeks)
211+
- End-to-end testing
212+
- Security audit
213+
- Edge case handling
214+
215+
**Total time to real ZK: 6-8 weeks with dedicated work**
216+
217+
---
218+
219+
## FOR STELLAR PITCH
220+
221+
### Be Honest:
222+
> "We've built a production-ready wallet frontend with working Stellar integration. The SDK is imported and tested. What we need is funding to build the backend infrastructure - the prover service and salt management - to enable actual ZK proof generation."
223+
224+
### Show What Works:
225+
1. Live demo of Google sign-in → wallet
226+
2. Real transactions on testnet
227+
3. SDK import and instantiation tests
228+
4. Beautiful UI/UX
229+
230+
### Admit What Doesn't:
231+
1. ZK proofs not actually generated yet
232+
2. Need backend services
233+
3. 6-8 weeks to full ZK implementation
234+
235+
### The Ask:
236+
> "$150K to complete ZK integration, run security audit, and launch on mainnet in 6 months."
237+
238+
---
239+
240+
## IMPROVEMENTS TO MAKE PROJECT MORE IMPRESSIVE
241+
242+
### Quick Wins (1-2 days each):
243+
1. Add real user count from database
244+
2. Add real transaction volume metrics
245+
3. Better error handling
246+
4. Mobile responsive fixes
247+
248+
### Medium Effort (1 week each):
249+
1. Build basic prover service (even if slow)
250+
2. Add transaction history export
251+
3. Add multi-asset support (USDC, etc.)
252+
4. Add address book feature
253+
254+
### Big Features (2-4 weeks each):
255+
1. **Full ZK integration** - THE priority
256+
2. Social recovery system
257+
3. Gas abstraction (pay fees in USDC)
258+
4. Multi-chain support
259+
260+
---
261+
262+
## FINAL HONEST VERDICT
263+
264+
**What you have:**
265+
- A good-looking Stellar wallet
266+
- Working Google OAuth
267+
- Real blockchain integration
268+
- Nice UI components
269+
270+
**What you don't have:**
271+
- Actual zero-knowledge proofs
272+
- The core differentiating feature
273+
- What makes this different from any other wallet
274+
275+
**Bottom line:**
276+
The project is about 40% done for the core ZK feature, but 90% done for a basic Google-login Stellar wallet. The ZK part is the hard part and the valuable part.
277+
278+
---
279+
280+
*Document created: January 2025*
281+
*This is the honest truth. Build on it.*

demo/src/app/api/pay/history/route.ts

Lines changed: 10 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,6 @@ import {
1111
getPaymentLinkStats,
1212
getPaymentLinkUrl,
1313
} from '@/lib/paymentLinks';
14-
import { generateWalletFromSub } from '@/lib/stellar';
15-
16-
// Helper to parse JWT and get sub
17-
function parseJwt(token: string): any {
18-
try {
19-
const base64Url = token.split('.')[1];
20-
const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
21-
const jsonPayload = decodeURIComponent(
22-
Buffer.from(base64, 'base64')
23-
.toString('utf-8')
24-
.split('')
25-
.map((c) => '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2))
26-
.join('')
27-
);
28-
return JSON.parse(jsonPayload);
29-
} catch {
30-
return null;
31-
}
32-
}
3314

3415
export async function GET(request: NextRequest) {
3516
try {
@@ -42,29 +23,20 @@ export async function GET(request: NextRequest) {
4223
);
4324
}
4425

45-
// Get user's wallet address from session
46-
// We need to derive it the same way as in useZkWallet
47-
let creatorAddress = '';
48-
49-
// Try to get from session if available
50-
if (session.idToken) {
51-
const claims = parseJwt(session.idToken);
52-
if (claims?.sub) {
53-
const network = request.nextUrl.searchParams.get('network') || 'testnet';
54-
const wallet = generateWalletFromSub(claims.sub, network as any);
55-
creatorAddress = wallet.publicKey;
56-
}
57-
}
26+
// Get wallet address from query parameter (passed from client)
27+
const creatorAddress = request.nextUrl.searchParams.get('address');
5828

59-
// If we couldn't get the address, try the email-based lookup
60-
if (!creatorAddress && session.user.email) {
61-
// For now, we'll search by email instead
62-
// This is a fallback - in production, store the address in the session
29+
if (!creatorAddress) {
30+
return NextResponse.json(
31+
{ error: 'Wallet address required' },
32+
{ status: 400 }
33+
);
6334
}
6435

65-
if (!creatorAddress) {
36+
// Validate Stellar address format
37+
if (!creatorAddress.startsWith('G') || creatorAddress.length !== 56) {
6638
return NextResponse.json(
67-
{ error: 'Could not determine wallet address' },
39+
{ error: 'Invalid wallet address format' },
6840
{ status: 400 }
6941
);
7042
}

demo/src/app/dashboard/page.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import {
3131
Code,
3232
Lock,
3333
Fingerprint,
34+
Link2,
3435
} from "lucide-react";
3536
import Link from "next/link";
3637
import { XRayStatusBadge } from "@/components/XRayStatusBadge";
@@ -605,7 +606,7 @@ export default function Dashboard() {
605606
</div>
606607

607608
{/* Actions */}
608-
<div className="grid grid-cols-3 gap-4">
609+
<div className="grid grid-cols-2 sm:grid-cols-4 gap-4">
609610
<button
610611
onClick={() => setShowSendModal(true)}
611612
className="group relative"
@@ -626,6 +627,16 @@ export default function Dashboard() {
626627
<span className="text-sm">RECEIVE</span>
627628
</div>
628629
</button>
630+
<button
631+
onClick={() => router.push('/pay/create')}
632+
className="group relative"
633+
>
634+
<div className="absolute inset-0 bg-[#0066FF] translate-x-1 translate-y-1 group-hover:translate-x-2 group-hover:translate-y-2 transition-transform" />
635+
<div className={`relative flex flex-col items-center gap-2 p-4 ${isDark ? 'bg-[#0A0A0A]' : 'bg-[#F5F5F5]'} border-4 border-[#0066FF] font-black group-hover:-translate-x-1 group-hover:-translate-y-1 transition-transform`}>
636+
<Link2 className="w-6 h-6 text-[#0066FF]" />
637+
<span className="text-sm">PAY LINK</span>
638+
</div>
639+
</button>
629640
<button
630641
onClick={exportTransactions}
631642
disabled={transactions.length === 0}

0 commit comments

Comments
 (0)