Skip to content

About

Investment scam checker for Singapore (WarriorHacks 2.0)

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

ChainCheck

Investment scam checker for Singapore. Paste or upload what an investment offer showed you, and ChainCheck tells you which claims can't be verified, where you are in the scam playbook, and what the scammer will ask for next.

ScamShield protects the inbox. ChainCheck protects the wallet. ChainCheck links to ScamShield; it does not send ScamShield any data.

Built for WarriorHacks 2.0. Full plan: docs/BUILD_BRIEF.md.

What's real, what's a snapshot, what's synthetic

Part Status
Checks, verdict, playbook stage, Reality Check Real code, fixed rules, tested
MAS Financial Institutions Directory / Investor Alert List Demo data with invented firms (data/demo_mas_*.json) until a real dated snapshot is added. The site shows a demo banner and every MAS flag says "DEMO data"
Community reports Synthetic: 12 invented reports (backend/demo_seed.py), labelled on screen. Stored in Turso on the live site. Shared stories are screened automatically (below)
Example offers and mock chats Invented, labelled MOCK
Domain age Live RDAP lookup via rdap.org when deployed; fixtures in tests
Accuracy figure Not yet measured on a real set: see Accuracy

How it works

The model reads. Code decides. The model (Gemini) only extracts entities into a fixed schema and may add amber "concern" flags. Code also extracts the hard facts itself (links, phones, wallets, returns, payment requests) and merges them in, so the model can only ever add. Every check, the verdict, the stage and the next move are deterministic code. Any red or amber flag means STOP; the best possible result is "No red flags found. Verify these yourself before you pay." The app never says safe, verified or legit.

screenshots ─▶ OCR in the browser (images never leave the device)
              │
text ─▶ redact personal numbers ─▶ model extraction ─┐
     └───────────────────────────▶ code extraction ──┴▶ merge ─▶ follow-up answers ─▶ checks ─▶ verdict ─▶ stage, chain map, Reality Check
Check Rule (thresholds in backend/config.py)
MAS licence Not in FID snapshot: red (with the invented demo list: amber "isn't on ChainCheck's demo firm list", so a real firm is never called unlicensed). On Investor Alert List: red
Fuzzy name ≥ 0.85 similar to a licensed name but not exact: red, looks like a copy
Copycat Licensed name but website/email/phone not on its MAS record: red. No contact details: amber
Domain age < 180 days red, < 365 days amber, lookup failed amber
Returns Annualised (1+p)^n − 1: > 30%/yr red, 15–30% amber
Fees Withdrawal "tax", unlock fee, % fee to withdraw: red
Payment Cash handover, gold, crypto to a wallet given: red. Crypto otherwise: amber
App Installed from a link, not an app store: red
Lockout Withdrawal blocked, trading target to withdraw, account "frozen": red
Fund recovery Offer to recover lost money: red
Claimed titles Professor, analyst, fund manager: amber
Text aimed at AI "Ignore your instructions…": red
Community network Entity in approved reports: red. Licensed firms are never flagged from reports alone
AI concerns Amber, labelled as AI, reason withheld if it tries to reassure

Shared stories follow the same rule. Code publishes a story only when its own checks find nothing (instructions aimed at AI, a MAS-licensed firm named, a repeat, more than 10 auto-published in an hour) and a Gemini screen of the redacted story raises no concern. The screen can only hold a story back; if it fails, the story waits for a moderator at /#/admin.

Run it locally

Needs Python 3.11+ and Node 20+.

python -m venv .venv
.venv/Scripts/python -m pip install -r requirements-dev.txt
cd frontend && npm install && npm run build
.venv/Scripts/python -m scripts.seed_reports
.venv/Scripts/python -m backend.server

Open http://localhost:8000. For front-end work, also run npm run dev in frontend/ (it proxies /api to port 8000). On macOS/Linux use .venv/bin/python.

Without GEMINI_API_KEY the checker runs on code-side extraction only and says so on screen; screenshots are read in the browser and work either way. Copy .env.example to .env (or export the variables) to configure.

Tests

.venv/Scripts/python -m pytest -q

No network: a fake model gateway, fixture snapshots and fixture RDAP answers. Any attempt to open a socket fails the test run. The injection fixture is run against an honest fake and a hijacked fake that returns empty, hostile output; the verdict must not change.

Accuracy

.venv/Scripts/python -m scripts.run_accuracy

tests/fixtures/accuracy_set/ has 20 scam and 20 legitimate invented offers. Code-only mode currently stops 19 of 20 scams with 2 false alarms on 20 legitimate offers. Don't quote this number: the set was written by the same person as the rules. Before freeze, replace it with offers written by someone else and modelled on real cases and real licensed-firm promotions, run it with --mode live, and quote only that result with its size.

Deploy

Live (free plan, Render): https://chaincheck-dxj5.onrender.com. It auto-deploys from master. Step by step, including the Vercel alternative: docs/DEPLOY.md.

Layout

backend/   api.py server.py pipeline.py extract.py code_extract.py schema.py prompt.py
           checks/ providers/ verdict.py playbook.py followups.py reality.py redact.py db.py community.py
data/      demo MAS snapshots, benchmarks
frontend/  React + Vite
scripts/   seed_reports.py snapshot_mas.py run_accuracy.py
tests/     fixtures/offers, fixtures/model_outputs, fixtures/accuracy_set

About

Investment scam checker for Singapore (WarriorHacks 2.0)

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages