A blockchain-based system that makes security camera footage tamper-proof. Video files are not stored on the chain. Instead, a cryptographic hash of every frame is anchored to the chain at recording time. To verify footage later, the system re-hashes the files on disk and compares against what was stored. Any modification to any frame - even a single pixel - is immediately detectable.
When recording, the camera hashes each frame, groups every 10 frames into a segment, computes a segment hash (a hash of the frame hashes), signs it with an RSA private key unique to that camera, and writes a block to the chain. The chain is saved to disk and can be synced across multiple company-owned nodes.
When verifying, the verifier re-hashes every frame file on disk and checks two things independently: the hash must match what is stored in the block, and the RSA signature must be valid. Both have to be beaten simultaneously to go undetected, which is not feasible on a multi-node network.
footage_chain/
├── blockchain.py Block, Blockchain, proof-of-work, chain validation, persistence
├── wallet.py RSA keypair generation, signing, and verification
├── node.py Network node simulation and longest-chain consensus
├── camera.py Webcam capture, frame hashing, segment signing, chain writes
├── verifier.py Re-hashes footage on disk and checks against the chain
├── app.py Flask web UI
├── demo.py CLI walkthrough of all steps
└── templates/
├── base.html
├── index.html Dashboard with live frame thumbnails
├── chain.html Block explorer showing hashes and signatures
└── verify.html Per-segment and per-frame verification results
pip install flask cryptography pillow opencv-pythonCLI demo - records from your webcam, verifies, then simulates a tamper attack:
python demo.pyWeb UI - records on startup then serves the dashboard at localhost:5001:
python app.pyBoth open the webcam automatically. If the wrong camera opens, change DEVICE_INDEX from 0 to 1 at the top of the respective file.
To adjust recording length and frame rate, edit these values at the top of demo.py or app.py:
RECORD_SECONDS = 20
FPS = 5
DEVICE_INDEX = 0The dashboard lists every recorded segment with thumbnail previews of each frame. The chain explorer shows every block including its hash, the previous block hash, the nonce, and the camera RSA signature. The verify page re-runs the full check live and highlights any tampered frames with a red border.
The tamper button on the dashboard blanks out the first frame on disk without updating the chain, then immediately runs verification so you can see exactly how the system catches it.
| Concept | File |
|---|---|
| SHA-256 frame hashing | camera.py, verifier.py |
| Segment hash (hash of hashes) | camera.py |
| RSA camera signature | camera.py, verifier.py |
| Proof-of-work chain | blockchain.py |
| Chain persistence | blockchain.py |
| Multi-node sync | node.py |