Personal project
Research prototypePrivacy-preserving edge AI
Nothing leaves the device unless something happened.
- Role
- Designed and built
- Period
- Aug 2026
- Built with
- PythonC++ (PlatformIO)ESP32-CAMMQTTAES-256-GCMHyperledger Fabric chaincodeFlaskOpenCV
A runnable proof of concept for a report on privacy-preserving edge AI. The camera decides on its own whether an event occurred. If not, the reading is dropped from memory. If so, only an encrypted copy and its hash leave the device, and the hash is anchored on a ledger so the record can't be changed quietly afterwards.
- 80
- events committed in demo runs
- AES-256
- GCM encryption on the device
- 0
- hardware needed to run the demo
- 3
- ways to run it, from laptop to real board
What happens to one reading
Two edge paths, the real ESP32-CAM firmware and a laptop demo, feed the same back half, so nothing downstream changes between them.
- Modelcan be wrong
- Codedeterministic
- Persondecides
- 1
Sense
A small grayscale frame, or a simulated sensor reading.
Code - 2
Detect
Motion by frame differencing on the board; face detection in the laptop demo.
Model - 3
Discard
No event: the reading is dropped from memory. Nothing is stored or sent.
Code - 4
Hash and encrypt
SHA-256 of the plaintext, then AES-256-GCM with a fresh 12-byte nonce.
Code - 5
Publish
Ciphertext, nonce, hash and metadata go over MQTT. Never the frame.
Code - 6
Anchor and store
The hash goes on a hash-chained ledger; the encrypted blob goes to cloud storage.
Code - 7
Verify and view
An authorised user checks the hash against the ledger, then decrypts.
Person
Try it · runs in your browser
Change a block and watch the chain break
Each block's hash covers the previous block's hash plus its own record. Verification recomputes every hash from the start and stops at the first one that doesn't match.
Green: hash verified · red: first failing block · dashed: not reached (the walk stops at the first failure) · orange dot: edited here
Block 4
The stored hash no longer matches the changed record, so this block fails.
What's real and what's stubbed
- Runs today with no hardware
- A laptop webcam and simulated sensors feed the full pipeline. A Python ledger mirrors the real chaincode's API, and a local stub copies the Firebase SDK's method names, so both are drop-in replaceable.
- Tamper tests that fail correctly
- Corrupting a stored blob makes AES-GCM authentication fail on decrypt. Rewriting a ledger entry breaks the hash chain, and a chain-integrity check walks the whole ledger.
- Not yet verified
- The firmware has not been run on a physical board. Motion detection is frame differencing, not a trained person detector, and demo keys are shared between the device and the backend.
- The path to production
- A real Fabric network, real Firebase, a TFLite person detector, TLS on MQTT, and per-device keys from a secure element.