forked from Emmy123222/Stellar-MicroPay
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpush_zk_proof.ps1
More file actions
99 lines (84 loc) · 4.08 KB
/
Copy pathpush_zk_proof.ps1
File metadata and controls
99 lines (84 loc) · 4.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
Write-Host "Pushing Zero-Knowledge proof implementation to GitHub..." -ForegroundColor Green
Write-Host ""
# Clone the forked repository
Write-Host "Cloning the forked repository..." -ForegroundColor Yellow
git clone https://github.com/omolobamoyinoluwa-max/Stellar-MicroPay.git temp_repo
Set-Location temp_repo
# Switch to the target branch
Write-Host "Switching to the target branch..." -ForegroundColor Yellow
try {
git checkout "Implement-Zero-Knowledge-proof-of-payment"
} catch {
git checkout -b "Implement-Zero-Knowledge-proof-of-payment"
}
# Copy the implementation files
Write-Host "Copying implementation files..." -ForegroundColor Yellow
Copy-Item -Path "..\contracts\*" -Destination "contracts\" -Recurse -Force
Copy-Item -Path "..\Cargo.toml" -Destination "." -Force
Copy-Item -Path "..\Cargo.lock" -Destination "." -Force
Copy-Item -Path "..\README.md" -Destination "." -Force
Copy-Item -Path "..\DEPLOYMENT_GUIDE.md" -Destination "." -Force
Copy-Item -Path "..\validate_contract.py" -Destination "." -Force
Copy-Item -Path "..\lib\*" -Destination "lib\" -Recurse -Force
Copy-Item -Path "..\package.json" -Destination "." -Force
Copy-Item -Path "..\ZK_PROOF_IMPLEMENTATION.md" -Destination "." -Force
Copy-Item -Path "..\MANUAL_PUSH_INSTRUCTIONS.md" -Destination "." -Force
Copy-Item -Path "..\push_zk_proof.ps1" -Destination "." -Force
# Stage and commit changes
Write-Host "Staging changes..." -ForegroundColor Yellow
git add .
Write-Host "Committing changes..." -ForegroundColor Yellow
git commit -m @"
Implement Zero-Knowledge proof of payment (zk-SNARK)
This PR implements privacy-preserving proof of payment functionality using Soroban — allowing a user to prove they made a payment of at least a certain amount without revealing the exact amount or their identity to third parties.
## Features Implemented
- ✅ PaymentCommitment struct for storing commitment hashes on-chain
- ✅ ZKProof struct for zero-knowledge proof verification
- ✅ commit_payment function to store payment commitments
- ✅ verify_payment function to verify ZK proofs without revealing amounts
- ✅ Simplified Merkle tree structure for commitment storage
- ✅ TypeScript helper in lib/stellar.ts for client-side proof generation
- ✅ Comprehensive test suite for ZK proof functionality
- ✅ Double-spending prevention using nullifiers
- ✅ Privacy preservation through cryptographic commitments
## Acceptance Criteria Met
- ✅ cargo test passes for ZK proof tests
- ✅ Commitment stored on-chain without revealing amount
- ✅ verify_payment returns true for valid proofs
- ✅ verify_payment returns false for tampered proofs
- ✅ TypeScript helper generates valid proofs
## Files Modified
- contracts/stellar-micropay-contract/src/lib.rs - Main contract with ZK functionality
- lib/stellar.ts - TypeScript helper for client-side proof generation
- package.json - Dependencies for TypeScript helper
- ZK_PROOF_IMPLEMENTATION.md - Detailed implementation documentation
## Testing
All tests pass and cover:
- Valid proof verification
- Invalid proof rejection
- Double-spending prevention
- Merkle tree functionality
- Commitment hash generation
- Amount commitment verification
## Security Features
- Nullifier tracking prevents double-spending
- Cryptographic commitments hide payment amounts
- Merkle proofs provide inclusion verification
- Salt ensures uniqueness of commitments
"@
# Push to the forked repository
Write-Host "Pushing to GitHub..." -ForegroundColor Yellow
git push origin "Implement-Zero-Knowledge-proof-of-payment"
Write-Host ""
Write-Host "✅ Successfully pushed to the forked repository!" -ForegroundColor Green
Write-Host ""
Write-Host "Repository: https://github.com/omolobamoyinoluwa-max/Stellar-MicroPay/tree/Implement-Zero-Knowledge-proof-of-payment" -ForegroundColor Cyan
Write-Host ""
Write-Host "Next steps:" -ForegroundColor Yellow
Write-Host "1. Visit the repository on GitHub"
Write-Host "2. Create a pull request from your branch to the main branch"
Write-Host "3. Use the commit message as the PR description"
Write-Host ""
Set-Location ..
Remove-Item -Recurse -Force temp_repo
Read-Host "Press Enter to exit"