note (this is the public version ... basiclly i just made claude create a safe version to share publicly) A blockchain-verified photo and video authenticity system. Capture media on mobile, hash it (SHA-256), store the hash on an Ethereum smart contract, and independently verify authenticity — all with an open, auditable pipeline.
┌─────────────┐ ┌──────────────┐ ┌────────────────┐
│ Flutter │────▶│ FastAPI │────▶│ Ethereum │
│ Mobile App │ │ Backend │ │ Smart Contract │
└─────────────┘ └──────┬───────┘ └────────────────┘
│
┌──────┴───────┐
│ PostgreSQL │
│ (Supabase) │
└──────────────┘
│
┌─────────────┐ ┌──────┴───────┐
│ Next.js │────▶│ S3 / DO │
│ Website │ │ Spaces │
└─────────────┘ └──────────────┘
| Layer | Tech |
|---|---|
| Mobile | Flutter (Android / iOS) with Clerk auth, Google Sign-In, Play Integrity, camera capture |
| Backend | Python FastAPI, PostgreSQL (Supabase), S3/DigitalOcean Spaces for video |
| Website | Next.js with Clerk auth, photo dashboard, public verification page |
| Smart Contract | Solidity (Foundry framework), deployed on Ethereum Sepolia testnet |
- ✅ Device attestation (Android Play Integrity + iOS App Attest)
- ✅ C2PA hardware trust verification (e.g., Sony cameras)
- ✅ Blockchain hash anchoring (tamper-proof)
- ✅ Chained audit logs (tamper-evident)
- ✅ Secure crypto (bcrypt, SHA-256, timing-safe comparison)
- ✅ CORS restrictions (environment-based)
- ✅ Security headers (CSP, X-Frame-Options, etc.)
- ✅ HTTP-only cookies (XSS protection)
- ✅ Secure mobile storage (Keystore / Keychain)
- ✅ SQL injection prevention (ORM)
- Python 3.10+
- Flutter 3.x
- Node.js 18+
- Foundry (for smart contract development)
git clone https://github.com/YOUR_USERNAME/Truthopi.git
cd Truthopicd backend
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env # Fill in your actual values
uvicorn main:app --host 0.0.0.0 --port 8000 --reloadcd chain
cp .env.example .env # Fill in your actual values
make deploy-anvil # Local deploymentNote: Copy the
Deployed to: 0x...address from the output and set it asCONTRACT_ADDRESSinbackend/.env.
cd website
npm install
cp .env.example .env # Fill in your actual values
npm run devcd mobile_frontend
cp .env.example .env # Fill in your actual values
flutter pub get
flutter runNote: For local development, use ngrok to expose your backend and set the tunnel URL in
mobile_frontend/.env.
To run the complete system, open separate terminals:
| Terminal | Command | Purpose |
|---|---|---|
| 1 | make anvil (in chain/) |
Start local Ethereum node |
| 2 | make deploy-anvil (in chain/) |
Deploy the smart contract |
| 3 | uvicorn main:app --host 0.0.0.0 --port 8000 --reload (in backend/) |
Start the API server |
| 4 | ngrok http 8000 |
Expose backend to mobile |
| 5 | npm run dev (in website/) |
Start the website |
| 6 | flutter run (in mobile_frontend/) |
Run the mobile app |
cd chain
# Unit tests
forge test --match-contract TruthopiTest -vv
# Integration tests
forge test --match-path test/integration/* -vvv# Store a hash on-chain (simulates backend behavior)
make store-anvil
# Verify a hash on-chain
make cast-verify CONTRACT=<DEPLOYED_ADDRESS> HASH=<IMAGE_HASH>cd backend
./run_tests.shAll critical security, auditing, and hardware verification mechanisms are fully open source.
- Chained audit logs — altering any past record mathematically invalidates all subsequent entries
- Public API —
/public/auditand/public/versionendpoints allow independent verification without authentication
- Play Integrity — validates requests originate from a genuine, untampered Android app
- App Attest — 5-step iOS attestation proving request origin
- C2PA Verification — cryptographically verifies camera hardware trust claims (e.g., Sony cameras)
Each component has a .env.example file documenting all required environment variables:
Truthopi/
├── backend/ # Python FastAPI backend
├── chain/ # Solidity smart contract (Foundry)
├── mobile_frontend/ # Flutter mobile app
├── website/ # Next.js web dashboard
└── LICENSE # MIT License
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Copy
.env.examplefiles and fill in your own credentials - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
⚠️ Never commit.envfiles, API keys, or secrets. The.gitignoreis configured to exclude them, but always double-check before pushing.
This project is licensed under the MIT License — see the LICENSE file for details.