Prediction markets are powerful, but they're mostly confined to major world events. The predictions we actually make every day are social: can a friend run a seven-minute mile, will someone land a backflip at Saturday's meetup, will the new bike lane open before August. Better turns those everyday bets into real, liquid, socially-accountable markets.

WHAT IT DOES • Create markets on anything, framed as a binary YES/NO question with an explicit resolution criterion and close time. • Trade in USDC while a numerically-stable LMSR pricing engine quotes price, average fill, price impact, slippage — and the charity split — before you commit. • Options & strategy desk — one-tap preset strategies read live market state and pre-configure side, size, and slippage, so a first-timer can trade with intent. • Change your mind? A secondary market lets you resell a position to another trader before the market resolves — positions stay liquid. • AI safety layer (Gemini 3.5) screens every new market; if a question could incentivize harm or unfairly target someone, Better flags it and suggests a kinder rewrite instead of just blocking it. • Charitable by construction — on a win, 50% of your profit is routed to verified environmental charities; a 1.5% Impact Fee on deposits funds carbon offsets, making every transaction climate-neutral.

TECHNICAL ARCHITECTURE Better is a bipartite system: deterministic financial state lives on-chain on Solana (Sealevel); high-frequency social state lives off-chain, synchronized by an event-ingestion layer subscribed to the program's emitted events. This split drives every other design decision.

ON-CHAIN — the echo_protocol Anchor program (Rust) Deployed to devnet at program id ELThikt285QiyLBWPNiGbgTTzGvjvQhYjrV33VC8ZyoD. A socially-gated parimutuel market with an optimistic oracle, exposed as 9 instructions across the full lifecycle: initialize_config → initialize_market → mint_position → lock_market → propose_state_transition → dispute_transition → finalize_transition → resolve_dispute → execute_yield_routing • Settlement math in u128 with floor division and checked arithmetic (explicit NumericalOverflow guards): Payout = (S_user / S_winning) × (P_total − f_protocol). The protocol fee is snapshotted at market creation (capped at 10% / 1000 bps) so it can't change under open positions. • Optimistic oracle: anyone proposes an outcome, opening a 24-hour dispute window. Undisputed proposals settle via a permissionless crank; a challenge requires the disputer to stake collateral (1% of the pool), escalating to a multi-sig jury that slashes or refunds it. • Programmable Yield Routing (PYR): settlement atomically routes a configurable share of the net payout to the market's target wallet via CPI SPL-token transfers — all-or-nothing in one tx. • PDA account model (config / market / vault / position); position accounts are closed on settlement, refunding rent and structurally preventing double-claims. • Events for every transition — the program's public API to the off-chain world.

THE BRIDGE — a hand-rolled Anchor-compatible TypeScript client Rather than ship the Anchor IDL runtime to the browser, we reproduce Anchor's wire format directly: 8-byte sha256 instruction discriminators, Borsh argument encoding, and PDA derivation that mirrors the Rust field order byte-for-byte, with a positional decoder reading the Market struct back out. Tiny client, explicit contract.

OFF-CHAIN — pricing, identity, funding, simulation • LMSR pricing engine for the trading UI: log-sum-exp normalization (subtract max(qYes,qNo) before exponentiating) to prevent floating-point blow-ups on lopsided pools, plus an 80-iteration binary search to invert cost→shares. • Sign-In-With-Solana (SIWS): an EIP-4361-equivalent message verified server-side with Ed25519 (tweetnacl) over a server-issued nonce — auth with zero gas, layered under Auth0. • Unifold for cross-chain USDC deposits: the secret key stays server-side; the browser only talks to our own routes, which reconcile every deposit against an internal ledger before crediting a balance. • Deterministic simulation: a mulberry32 seeded PRNG builds 650 synthetic traders and rebuilds every market's pools from real bot bets — a believable, liquid demo with zero SSR hydration mismatches. • Persistence & reputation: pluggable MongoDB Atlas / Postgres stores; an off-chain reputation score that rewards durable contribution (create +5, settled +12, comment +1), not volume. • Visualization: interactive SVG odds/depth charts and a raw three.js / WebGL 3D odds arena.

Built With

Share this project:

Updates

Submission history