{"id":49435853,"url":"https://github.com/vitorpy/monero-predict","last_synced_at":"2026-04-29T16:41:56.694Z","repository":{"id":318686280,"uuid":"1072137151","full_name":"vitorpy/monero-predict","owner":"vitorpy","description":"Monero-native prediction markets.","archived":false,"fork":false,"pushed_at":"2025-11-09T16:28:13.000Z","size":54,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-09T18:10:08.834Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vitorpy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-08T10:04:40.000Z","updated_at":"2025-11-09T16:28:17.000Z","dependencies_parsed_at":"2025-10-09T08:45:27.243Z","dependency_job_id":null,"html_url":"https://github.com/vitorpy/monero-predict","commit_stats":null,"previous_names":["vitorpy/monero-predict"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vitorpy/monero-predict","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitorpy%2Fmonero-predict","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitorpy%2Fmonero-predict/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitorpy%2Fmonero-predict/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitorpy%2Fmonero-predict/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vitorpy","download_url":"https://codeload.github.com/vitorpy/monero-predict/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitorpy%2Fmonero-predict/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32435120,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T13:34:34.882Z","status":"ssl_error","status_checked_at":"2026-04-29T13:34:29.830Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-29T16:41:54.226Z","updated_at":"2026-04-29T16:41:56.686Z","avatar_url":"https://github.com/vitorpy.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Monero Private Prediction Market\n\nA privacy-preserving prediction market built with TFHE (Fully Homomorphic Encryption) and Monero multisig.\n\n## Features\n\n- 🔒 **Private Betting**: Bets are encrypted using FHE - individual amounts and choices remain private\n- 🧮 **Fair Payouts**: Homomorphic computation ensures fair payout distribution without revealing individual bets\n- 💰 **Monero Integration**: Designed to use Monero multisig for trustless fund custody\n- 🔐 **Cryptographic Claims**: Commitment-based system allows only legitimate winners to claim payouts\n- 🚀 **High-Level API**: Easy-to-use REST API and CLI tools\n\n## Architecture\n\n```\n┌─────────┐         ┌──────────────┐         ┌────────┐\n│ Bettor  │ ◄─────► │  Coordinator │ ◄─────► │ Oracle │\n└─────────┘         └──────────────┘         └────────┘\n     │                      │                      │\n     │                      │                      │\n     ▼                      ▼                      ▼\n[FHE Keys]          [Computes Payouts]     [Signs Results]\n                    [Holds FHE Keys]\n                           │\n                           ▼\n                  [Monero Multisig 2-of-2]\n```\n\n## Quick Start\n\n### 1. Build the Project\n\n```bash\ncargo build --release\n```\n\n### 2. Quick API Test (Works Out of the Box)\n\n**Terminal 1:**\n```bash\ncargo run --release --bin monero-predict\n```\n\n**Terminal 2:**\n```bash\n./test_market.sh\n```\n\n### 4. Manual Testing\n\nSee [TESTING.md](TESTING.md) for detailed testing guide.\n\n## CLI Usage\n\n### Place a Bet\n\n```bash\ncargo run --bin bettor -- bet \\\n  --market-id btc-100k-2025 \\\n  --outcome YES \\\n  --amount 10.5\n```\n\nThis will:\n1. Generate/load FHE client keys\n2. Encrypt your bet (outcome + amount)\n3. Save a nonce file for claiming later\n4. Submit the encrypted bet to the coordinator\n\n### Claim Winnings\n\n```bash\ncargo run --bin bettor -- claim \\\n  --market-id btc-100k-2025 \\\n  --nonce-file bet_\u003ccommitment\u003e.nonce \\\n  --payout-address monero:your_address\n```\n\n## API Endpoints\n\n### Market Management\n\n- `POST /market/create` - Create a new prediction market\n- `GET /market/:id/info` - Get market information\n\n### Betting\n\n- `POST /market/:id/bet` - Submit an encrypted bet\n- `GET /market/:id/bets` - Get bet count\n\n### Resolution\n\n- `POST /market/:id/resolve` - Resolve market with oracle signature\n- `GET /market/:id/result` - Get market result\n\n### Claims\n\n- `POST /market/:id/claim` - Claim payout with commitment proof\n\n### FHE Keys\n\n- `GET /fhe/server_key` - Get compressed server key for verification\n\n## Project Structure\n\n```\nsrc/\n├── lib.rs              # Library exports\n├── main.rs             # Axum server\n├── types.rs            # Core data structures\n├── fhe.rs              # FHE context and payout calculator\n├── client.rs           # Bettor client\n├── coordinator.rs      # Market coordination logic\n└── bin/\n    └── bettor.rs       # CLI tool\n```\n\n## How It Works\n\n### 1. Bet Placement\n\n1. Bettor generates FHE client keys\n2. Encrypts outcome (0 for YES, 1 for NO) and amount (in piconeros)\n3. Creates commitment: `H(nonce)`\n4. Sends Monero to market multisig address\n5. Submits encrypted bet + tx proof to coordinator\n\n### 2. Market Resolution\n\n1. Oracle determines the winning outcome\n2. Signs the result\n3. Coordinator receives oracle signature\n4. Computes payouts homomorphically:\n   - Total pool = sum of all bets\n   - Total winning = sum of winning bets\n   - Individual payout = (bet_amount / total_winning) * total_pool\n5. All computations happen on encrypted data!\n\n### 3. Payout Claims\n\n1. Winner reveals their nonce\n2. Coordinator verifies: `H(nonce) == commitment`\n3. Coordinator checks bet outcome matches winning outcome\n4. Triggers Monero multisig payout\n\n## Security Model\n\n### Trust Assumptions\n\n- **Coordinator**: Trusted to compute correctly but cannot steal funds (multisig)\n- **Oracle**: Trusted to report accurate outcomes\n- **Monero Multisig**: 2-of-2 between Coordinator and Oracle prevents unilateral fund access\n\n### Privacy Guarantees\n\n- ✅ Individual bet amounts are hidden\n- ✅ Individual outcome choices are hidden\n- ✅ Only aggregate statistics revealed (total pool, total winners)\n- ✅ Winners can claim anonymously with commitment proof\n\n### Limitations\n\n- Coordinator knows the decryption key (simplified version)\n- No prevention of Coordinator revealing bets (would need threshold FHE)\n- Oracle is trusted (could use multiple oracles + voting)\n\n## Future Enhancements\n\n- [ ] Threshold FHE to distribute decryption key\n- [ ] Multi-oracle system with dispute resolution\n- [ ] Actual Monero wallet integration (currently mock)\n- [ ] Web frontend\n- [ ] Support for multiple outcomes (not just YES/NO)\n- [ ] Automated market maker (AMM) for dynamic odds\n- [ ] Zero-knowledge proofs for enhanced privacy\n\n## Development\n\n### Run Tests\n\n```bash\ncargo test\n```\n\n### Build Documentation\n\n```bash\ncargo doc --open\n```\n\n### Check Code\n\n```bash\ncargo clippy\ncargo fmt\n```\n\n## Dependencies\n\n- **tfhe** - Fully homomorphic encryption\n- **axum** - Web framework\n- **tokio** - Async runtime\n- **monero** - Monero library\n- **sha3** - Cryptographic hashing\n- **clap** - CLI argument parsing\n\n## License\n\nThis is a research/educational project. See [PROMPT.md](PROMPT.md) for the original specification.\n\n## Contributing\n\nThis project demonstrates FHE-based privacy for prediction markets. Contributions welcome for:\n\n- Additional privacy features\n- Better Monero integration\n- UI/UX improvements\n- Documentation\n- Test coverage\n\n## Resources\n\n- [TFHE-rs Documentation](https://docs.zama.ai/tfhe-rs)\n- [Monero Documentation](https://www.getmonero.org/resources/developer-guides/)\n- [Testing Guide](TESTING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitorpy%2Fmonero-predict","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvitorpy%2Fmonero-predict","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitorpy%2Fmonero-predict/lists"}