Skip to content

Architecture Overview

Six-layer topology

┌──────────────────────────────────────────────────────────┐
│  L0 — Telegram Bot API                                   │
│      • Bot framework (Telegraf, Node)                    │
│      • WebApp UI (Next.js, TON Connect)                  │
│      • Inline keyboards + WebApp launches                │
├──────────────────────────────────────────────────────────┤
│  L1 — Round Engine                                       │
│      • Deterministic FSM (Go)                            │
│      • Phases: Announce → Commit → Reveal → Settle       │
│      • Commit-Reveal verification                        │
│      • Merkle Root construction                          │
├──────────────────────────────────────────────────────────┤
│  L2 — Oracle Aggregator                                  │
│      • Question reservoir (Postgres + IPFS)              │
│      • LLM ensemble pipeline (Claude + GPT + Gemini)     │
│      • Adversarial debiaser                              │
│      • DRAND beacon fetcher                              │
│      • TON-VRF poll                                      │
├──────────────────────────────────────────────────────────┤
│  L3 — Identity Layer                                     │
│      • Trust Ladder L0–L7 state machine                  │
│      • Worldcoin / PoH / Gitcoin Passport adapters       │
│      • KYC vendor integration (Sumsub)                   │
│      • Reputation Score Bayesian updater                 │
├──────────────────────────────────────────────────────────┤
│  L4 — Ad-Revenue Settlement                              │
│      • AdMob SDK (mobile + WebApp)                       │
│      • Telegram Ads SDK                                  │
│      • AdMob SSV callback receiver                       │
│      • zk-SNARK prover (SP1, Phase 2)                    │
├──────────────────────────────────────────────────────────┤
│  L5 — TON Settlement                                     │
│      • $POP Jetton contract (FunC)                       │
│      • Vesting wrapper contract                          │
│      • Round Merkle Root commit contract                 │
│      • Dispute resolution contract                       │
│      • DAO governance contracts (Phase 3)                │
└──────────────────────────────────────────────────────────┘

Data flow

User taps "Play" in Telegram

L0: WebApp opens, requests Round entry

L4: Show ad (AdMob), wait for SSV callback

L4: SSV verified → POP credit issued

L1: User receives Round question (from L2)

L1: User commits c_i during Commit phase

L1: User reveals (s_i, b_i) during Reveal phase

L1: Round Engine computes majority, builds Merkle Root

L3: Effective weight = α × r_i applied

L1: Prize pool distributed to survivors

L5: Merkle Root committed to TON (batch every 24h)

User sees POP credit + Round result in WebApp

Latency budget

PhaseTargetActual (P50)Actual (P95)
Announce5 s4.2 s4.8 s
Commit30 s29.5 s30 s
Reveal15 s14.7 s15 s
Settle10 s7.3 s9.8 s
Round total60 s55.7 s59.6 s

Settle phase includes Merkle Root construction and verification; on-chain TON commit is batched separately at 24-hour cadence.

Infrastructure

  • Hosting: Cloudflare Workers + R2 + KV (edge-distributed, low-latency).
  • Database: Postgres (primary), Redis (Round state, ephemeral), R2 (Round artifacts, archive).
  • Round Engine: stateless Go binary; horizontally scalable behind Cloudflare's anycast.
  • TON Client: ton-core SDK; full-node connections via TonAPI Cloud.
  • Observability: OpenTelemetry → Grafana Cloud; Sentry for client errors.

Open-source components

  • Round Engine: MIT, github.com/cashpop-protocol/round-engine
  • WebApp: MIT, github.com/cashpop-protocol/webapp
  • Smart contracts (post-TGE): MIT, github.com/cashpop-protocol/contracts
  • Question reservoir build pipeline: source-available, github.com/cashpop-protocol/reservoir

The full CashPop stack will be self-hostable post-TGE: any operator can spin up a fork-instance, though they cannot issue $POP without DAO approval.

Built on TON.