RevMarket is a testnet Soroban prediction-market prototype built around a Rust contract, a React/Freighter frontend, and an operator-run settlement worker. It demonstrates binary event markets and price-based prediction markets using Stellar Asset Contract escrow, fixed close windows, authenticated resolution, proportional payouts, and refund paths.
This repository is intended for local development, contributor review, and verification workflows. It is not presented as an audited production system.
- Contributing guide
- Contributor map
- Issue drafts
- Deployment guide
- Verification notes
- Limitations
- License
- Attribution
| Path | Purpose |
|---|---|
contracts/market |
Soroban contract: market creation, staking, settlement, claims, and escrow accounting |
shared |
Shared Stellar helpers and exact decimal encoding for contract calls |
service |
Provider adapters, evidence policy, worker logic, and retry-oriented polling |
backend |
Optional local API with signed public-key sessions and SQLite-backed activity data |
frontend |
React app for market creation, staking, positions, claims, and wallet interaction |
tests |
JavaScript and Rust verification for pricing, timing, payout, and worker behavior |
docs |
Setup, deployment, limitations, review notes, and Wave-related planning |
RevMarket is intentionally transparent about its safety boundaries:
- one configured resolver key authorizes settlement outcomes
- the contract enforces timing, state transitions, and evidence digest checks
- worker/provider checks run off-chain and are not a substitute for a decentralized oracle
- automation and delegated claim execution are explicitly not active by default
This is a testnet prototype, not a production-grade decentralized oracle or a fully trustless market system.
- Node.js 22+
- npm 10+
- Rust 1.99.1+
wasm32v1-nonetarget for contract builds- native C linker for Rust tests
- Stellar CLI for deployment workflows
- on Windows: a current 64-bit GNU toolchain or MSVC build tools
npm install
npm test
npm run build
npm run test:contracts
npm run build:contractsUseful local commands:
npm run demo
npm run backend
npm run dev
npm run test:testnetRun the backend and frontend as separate processes:
npm run backend
npm run devThen open the app at http://127.0.0.1:5173. The local activity backend keeps profile and reported activity data in SQLite and does not grant automated permissions or wallet authority.
The contract test suite exercises the real Soroban logic for:
- create market
- predict on both sides
- request settlement
- settle a market
- claim payout/refund
The demo script uses fixture observations only and does not write to a live chain.
Run the project checks before submitting changes:
npm test
npm run build
npm run test:contracts
npm run build:contractsProject-specific expectations:
- financial logic must preserve escrow rules and payout integrity
- authorization must reject wrong identities
- settlement timing and refund paths must remain valid
- UI and worker changes need meaningful validation, not just successful compilation
npm run test:testnet is an opt-in smoke test that deploys a temporary contract on Stellar testnet using temporary funded accounts. It is verification-focused and does not read a user's wallet or save secrets.
- Deployed Testnet Contract ID:
CACP6QFWWZ7BBMDXB5KHC6AAQKE3HBQ4MFFZNNAIJWYK7P6GXJAMLHIN - Network: Stellar Testnet (
https://soroban-testnet.stellar.org)
-
Build the WASM binary:
rustup target add wasm32v1-none stellar contract build --manifest-path contracts/Cargo.toml
-
Generate and fund a Testnet deployer account:
stellar keys generate deployer --network testnet stellar keys fund deployer --network testnet
-
Deploy with constructor parameters:
stellar contract deploy \ --wasm contracts/target/wasm32v1-none/release/revmarket.wasm \ --source deployer \ --network testnet \ -- \ --token CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC \ --resolver deployer
-
Create a prediction market via CLI:
stellar contract invoke \ --id CACP6QFWWZ7BBMDXB5KHC6AAQKE3HBQ4MFFZNNAIJWYK7P6GXJAMLHIN \ --source deployer \ --network testnet \ -- create \ --creator deployer \ --question "[Crypto] Will Stellar XLM spot price be strictly above $0.35 USD at settlement?" \ --description_cid "bafkreifdummycid" \ --image_cid "bafkreifdummycid" \ --kind '{"Price":["XLM","3500000"]}' \ --closes_at $(($(date +%s) + 604800))
-
Frontend Setup: In
frontend/.env(and Vercel environment variables):VITE_CONTRACT_ID=CACP6QFWWZ7BBMDXB5KHC6AAQKE3HBQ4MFFZNNAIJWYK7P6GXJAMLHIN VITE_RPC_URL=https://soroban-testnet.stellar.org VITE_READ_ACCOUNT=<YOUR_DEPLOYER_PUBLIC_G_KEY>
Use docs/DEPLOYMENT.md for full configuration and docs/VERIFICATION.md for verification evidence expectations.
Do not use production funds. Keep all secrets in local environment files or secret managers and never commit them.
Please read CONTRIBUTING.md before proposing changes. For funded Wave work, follow the Drips assignment and issue guidance in docs/WAVE_GUIDE.md. A local issue draft or comment does not create an official assignment.
Read SECURITY.md, docs/LIMITATIONS.md, and docs/VERIFICATION.md before running production-like or public-network workflows.
Important rules:
- never commit
.envfiles or private keys - never store sensitive evidence in the repo
- keep a single resolver worker per resolver account
- preserve evidence storage across worker restarts
- do not silently change settlement policy or trust assumptions
This project is licensed under the MIT License. See LICENSE for details.
This repo contains the Stellar implementation only. Historical material is preserved outside the active project flow. The project is prepared for review, validation, and contributor-driven iteration, but it is not claimed to be fully production-hardened or externally audited.