⏳ HashX: A permissionless Optimistic Oracle on Hedera built using Timelocked puzzles.
HashX is an app for creating and resolving prediction markets with accuracy with the help of privacy-preserving voting on Hedera EVM. Votes are encrypted using BabyJubJub-based ECDH and AES-256-CTR, then revealed via a timelock puzzle or automatically by a server-held key. Rewards are distributed using Merkle proofs.
Features
HBARLockingContract to obtain voting power. This converts HBAR to WHBAR utilizing WHBAR.sol contract.0xde368C3DCac4E5096f2D2b8AF7Be70277c43b1440x90Fe5e610A12D2Aa0374e5CEA373bc4CdC103Cbc0x0118250132B55af4Ca1659dA51Bf7430245C1A03ABI/Tech stack
Using the app
marketId and oracle contractAddress.• Tech stack
@zk-kit/baby-jubjub (ECDH), AES‑256‑CTR, bigint-mod-arith.• High-level architecture
HBARLockingContract stakes HBAR and wraps to WHBAR, tracks deposits, transfers stake to protocol and back for rewards.CreateVote oracle: stores public parameters for the timelock puzzle, accepts encrypted votes (userPublicKey, bytes option, amount), verifies solver secret, finalizes with a Merkle root, and enables claimRewards.PredictionMarket + PredictionMarketToken: AMM-like market with YES/NO tokens, initial liquidity, probability-based pricing, and settlement driven by the CreateVote oracle outcome. Factories deploy both oracle and market.finalizeVote with a server wallet (env PRIVATE_KEY).• Privacy-preserving vote encryption
bytes mapped to the ephemeral public key, keeping the voter’s choice hidden.• Timelock puzzle (delayed reveal)
a=2 and difficulty t. Compute b = a^(2^t mod φ(N)) mod N, hash b and XOR with the secret key to publish skLocked.a^(2^t) mod N), unmask skLocked, and submit it on-chain; or in “server mode” the backend reveals SK after end.• Finalization and distribution
VoteCast logs via viem.@openzeppelin/merkle-tree to build Standard Merkle Trees for winners; stores proofs in Postgres.finalizeVote, then sends it with winnerMerkleTreeRoot and added rewards. Users claim on-chain by submitting their Merkle proof.• Partner tech and how it helped
• Notable hacky bits
src/scripts/solve_puzzle.ts), with XOR masking of SK.CreateVote to simplify hackathon operations.
