Skip to content

edycutjong/noxoracle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

16 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

NoxOracle Logo

NoxOracle ๐Ÿ”ฎ

Bet what you know, not who you are.

NoxOracle Hero

Demo Video Live Demo Pitch Deck WTF!! Hackathon Verified Contract


Next.js 14 TypeScript Ethereum Sepolia Gnosis CTF ERC-7984 Tests Coverage Release License CI


โœ… Live on Ethereum Sepolia โ€” the full confidential cycle (commit-private โ†’ public-aggregate โ†’ claim-private) proven on-chain over a byte-for-byte unmodified Gnosis CTF market. 197 tests green.


4 identical transactions. One dissenter. Unfindable.

The problem. Prediction markets price truth โ€” but only if informed people dare to bet. On-chain markets (Polymarket-style, on Gnosis Conditional Tokens) expose every position: direction, size, timing, wallet. Anyone with reputational, employment, or political exposure self-censors, and the market loses exactly the information it exists to collect.

The approach. NoxOracle keeps the real market untouched โ€” the official Gnosis CTF + FixedProductMarketMaker, deployed byte-for-byte from the npm artifacts and CI hash-checked โ€” and adds a confidential participation layer. A bet is committed as two encrypted amounts (YES-stake, NO-stake; one is an encrypted zero) so direction never exists in plaintext. Stakes pool in confidential cUSD; at epoch close only the aggregates are publicly decrypted and routed through the FPMM in one batch; winners are paid in confidential cUSD at a public pot/pool rate. Individual direction and size stay hidden through and after settlement.

One flow, with depth: commit-private โ†’ batch-execute-public-aggregate โ†’ claim-private on one real market โ€” with an in-product k-anonymity meter and an independently-recomputable verify-epoch.

๐ŸŸข Status (this build)

Caught live, not in a mock. The first Sepolia run reverted in executeEpoch (NotAllowed, 0xb87a12a9): the internal-handle unwrap needs the pool to allowTransient the burn amount to the cUSD contract, because the token re-enters the TDX compute under its own identity. A deliberately-permissive local mock had hidden it. Fixed, redeployed, re-ran green โ€” the cycle above is the fix. See feedback.md #16.

๐ŸŽฏ The one devastating demo

"Four people just bet on this market. Tell me who bet NO."

Four identical commitBet transactions, each carrying two sealed handles. The epoch closes: aggregates decrypt to YES 1,700 / NO 500. Someone dissented with size โ€” the market knows the information, but not the informant. Dana opens her position card, signs, and her NO 500 unseals โ€” for her alone. NO wins; she claims quietly in cUSD. The herd never learns who read it right.

โš–๏ธ Judge path (run it yourself)

npm install
npm run compile          # solc 0.8.35 โ€” our contracts (CTF/FPMM are deployed, not recompiled)
npm test                 # 134 pure-logic tests (@noxoracle/confidential-ctf)
npm run test:contracts   # 63 Hardhat tests โ€” full confidential cycle + I1โ€“I5 on local Nox mock
npm run check-artifacts  # protocol-purity hash baseline (I5), read-only, no gas
npm run check-readiness  # offline deliverable checklist

On the funded run (adds -- gas):

CONFIRM_SPEND=yes npm run deploy  # NoxOraclePool + unmodified CTF/FPMM (reuses live DemoUSD/cUSD)
CONFIRM_SPEND=yes npm run seed    # 4-bettor cycle -> writes fixtures/demo-state.json
npm run verify-epoch 1            # recompute I1โ€“I5 from chain data alone (read-only)

โš™๏ธ Configuration โ€” environment variables & services

Copy the template and fill it in (.env is gitignored โ€” never commit real keys; use throwaway keys, Sepolia only):

cp .env.example .env
Variable What it is How to obtain
DEPLOYER_ADDRESS, DEPLOYER_PRIVATE_KEY, PRIVATE_KEY Throwaway EOA that deploys NoxOraclePool + the market, is the market oracle, and signs demo txs (PRIVATE_KEY mirrors the deployer key). Generate a key: openssl rand -hex 32 (prefix 0x). Derive its address: node -e "console.log(new (require('ethers').Wallet)('0x<hex>').address)". Fund ~0.03 Sepolia ETH from sepoliafaucet.com or the Alchemy faucet.
SEPOLIA_RPC_URL Sepolia JSON-RPC endpoint. Default public node needs no signup (rate-limited). For reliable e2e, get a free key at Alchemy or Infura โ†’ Ethereum โ†’ Sepolia.
CHAIN_ID Fixed 11155111 (Sepolia). Do not change.
NOX_PROTOCOL_ADDRESS iExec Nox protocol contract (NoxCompute โ€” TEE ACL + proof validation). Fixed 0x24efโ€ฆ77bf; re-verify from the Nox docs /networks page if it redeploys. No Nox account or API key is required โ€” the Handle Gateway is self-serve.
DEMO_USD_ADDRESS, CONFIDENTIAL_USD_ADDRESS Reused DemoUSD faucet + its confidential-USD wrapper (shared with NoxSend), already live on Sepolia. Leave as-is โ€” the funded run reuses them and does not redeploy. Only change if you deploy your own pair.
DEMO_MNEMONIC Throwaway BIP-39 phrase the e2e derives its bettor actors (Alice/Bob/Carol/Dana) from. Not the public Hardhat mnemonic. Generate your own: node -e "console.log(require('ethers').Wallet.createRandom().mnemonic.phrase)".
ETHERSCAN_API_KEY Optional โ€” only to publish NoxOraclePool source (npx hardhat verify โ€ฆ). Free, ~1 min at etherscan.io/myapikey โ†’ Add โ†’ copy the ~34-char key (no 0x).

External services (all free, testnet-only):

  • iExec Nox Handle Gateway โ€” seals bet direction+size inside Intel TDX; self-serve, no signup.
  • Gnosis Conditional Tokens (1.0.3) + FixedProductMarketMaker (1.8.1) โ€” the real, unmodified prediction-market primitives the pool sits on (bytecode hash-checked vs the official npm artifacts).
  • Ethereum Sepolia โ€” the chain everything deploys to.
  • Etherscan (Sepolia) โ€” NoxOraclePool source verification only.

Deployed contract addresses (NoxOraclePool, CTF, FPMM + factory, cUSD, DemoUSD) are in the Status table above.

๐Ÿ› ๏ธ Engineering harness

Beyond the on-chain proof, the repo ships a production-grade test + security harness so judges can tell a real product from a weekend prototype.

# โ”€โ”€ Contracts + SDK (repo root) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
npm test                 # 134 pure-logic tests (@noxoracle/confidential-ctf, vitest)
npm run test:contracts   # 63 Hardhat tests โ€” full confidential cycle + I1โ€“I5
npm run test:all         # both suites (197 green)

# โ”€โ”€ Web dApp (web/) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
npm run lint       --workspace @noxoracle/web   # Next.js / ESLint
npm run typecheck  --workspace @noxoracle/web   # tsc --noEmit
npm run e2e        --workspace @noxoracle/web   # Playwright โ€” demo mode, NO wallet, NO env
npm run lighthouse --workspace @noxoracle/web   # Lighthouse CI (perf / a11y / SEO)

make security-scan  # npm audit + license check
Layer Tool Status
Contracts + SDK vitest (134) + Hardhat (44) โ€” full confidential cycle + I1โ€“I5 โœ…
Frontend Quality ESLint + TypeScript (strict) โœ…
E2E Testing Playwright โ€” 3 suites, desktop + mobile, demo mode โœ…
Security (SAST) CodeQL (javascript-typescript) โœ…
Security (SCA) Dependabot (npm + actions) + npm audit โœ…
Secret Scanning TruffleHog (verified-only) โœ…
Performance Lighthouse CI (a11y hard-gate โ‰ฅ 0.9) โœ…
CI/CD 7-stage GitHub Actions pipeline, concurrency-cancel โœ…

The E2E suite runs the app with no wallet and no environment variables โ€” every route (/, /position, /epoch, /verify) renders confidential-market UI from bundled demo fixtures, so the confidential-bet flow, meta tags, and mobile layout are all verified without signing a transaction.

๐Ÿ” Why only Nox

Primitive Where Without it
aggregation-only allowPublicDecryption epoch sums ONLY (I2) threshold-decryption committee
dual encryptInput + fromExternal proofs direction-free (amtYes,amtNo) a side bit leaks in calldata
per-user ACL (allowThis/addViewer) decrypt-own-position forever a custodial account DB
IERC7984 pooled custody + operator-pull nothing position-shaped in wallets positions in wallets = the linkage
2-step unwrapโ†’finalizeUnwrap plaintext exits ONLY at the FPMM boundary a trust-me bridge
Nox.mul/div (ร— public scalar) public-rate claims, no FHE-div-by-ciphertext leak stakes at claim

Remove Nox and you need an FHE coprocessor, a threshold-decryption committee, a custodial batcher, and a disclosure registry โ€” four systems โ€” and still couldn't compose with the CTF market on the same chain.

โš ๏ธ Honest limitations

k-anonymity is bounded by epoch size (meter + k<3 warning + a seeded bad epoch #0; membership is public, only sizes/direction hidden) ยท batching trades latency for FPMM price drift (slippage guards) ยท the demo oracle is a disclosed centralized EOA (reality.eth = the stated production path) ยท the SDK is beta 0.1.0-beta.13 (findings in feedback.md).

๐Ÿ—บ๏ธ Repo map

Path What
contracts/NoxOraclePool.sol the only novel contract (dual-handle commit, epoch batch, scalar-rate claim, k-gate)
contracts/{ConfidentialUSD,DemoUSD}.sol reused cUSD wrapper + underlying (vendored from NoxSend)
contracts/test/MockNoxCompute.sol transparent local TEE test-double (never deployed)
packages/confidential-ctf drop-in SDK: dual-handle, k-anon, verify-epoch, client (134 tests)
packages/cli noxoracle bet / position / aggregates / claim / verify-epoch
scripts/ deploy ยท seed ยท e2e ยท bench ยท verify_epoch ยท check_artifacts ยท readiness
web/ Next.js dApp (market ยท position ยท epoch ยท verify), synthwave-themed
SPEC.md ยท ARCHITECTURE.md ยท DEMO.md ยท feedback.md invariants ยท design ยท runbook ยท findings

๐Ÿ“ข Disclosure

Hackathon-original. The cUSD wrapper + Nox integration core are a disclosed shared skeleton with my other WTF entries (NoxSend/NoxSafe), vendored into this repo (no cross-repo file: dependency). The Gnosis CTF/FPMM are deployed unmodified third-party protocols (licenses intact). Nothing reused from Vibe Coding. Built solo.

Thank you for reviewing.

About

๐Ÿ”ฎ Bet what you know, not who you are โ€” private positions on a real Gnosis prediction market, direction & size encrypted through settlement via iExec Nox. Live on Ethereum Sepolia.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages