Building a Blockchain Bodycam Proof of Concept for $25
Tags: blockchain, rust, iot
Published: 2019-12-09 19:06:52

Police bodycams are an essential piece of equipment for modern law enforcement. But there is a problem. Videos can be faked. Blockchain technology can aid in the battle against malicious video forgery.

![An AXON police body camera.](https://cdn-images-1.medium.com/max/2000/1*VjBegYsCotTqD1cNmpWfLw.jpeg)*An AXON police body camera.*

The evidence on a bodycam is often a critical differentiator in the justice process. It can be the difference if someone spends the rest of their life in jail or leaves the courtroom a free man. **Lives are on the line. **The authenticity of bodycam videos must be protected to the highest possible degree.

**The importance of the videos is unquestionable, but is the threat of video alteration real? Very.**

Researchers have found that [bodycam videos are vulnerable to undetectable alteration](https://www.vice.com/en_us/article/594q5d/hackers-can-edit-police-body-cam-footage-without-anybody-noticing), and [malware has been found on shipped bodycams](https://www.newsweek.com/footage-police-body-cameras-can-be-altered-hackers-researcher-says-1070088). Police departments have also been [caught editing bodycam videos](https://www.rollingstone.com/culture/culture-news/protests-erupt-after-chicago-police-release-edited-body-camera-footage-699854/) to skew the narrative in their favor.

**This isn’t remote speculation, it’s already a serious problem.**

Most people have at least heard about the Bitcoin by now, but blockchain technology can take many forms. **A blockchain can be used to ensure that data isn’t changed or deleted.** This is the usage we can apply specifically to police bodycams.

[Bodycams can cost up to $2,000 per camera](https://www.ncjrs.gov/pdffiles1/nij/grants/250381.pdf), placing a hefty burden on police forces that are already cash strapped. Is it possible to run a blockchain on a low-cost low-power camera device?

Here’s the equipment we will be working with. Our total cost: < $25.00

![The components for our test.](https://cdn-images-1.medium.com/max/2000/1*Kyg0bYlH7O6Hk0ywzaqO7Q.jpeg)*The components for our test.*

This isn’t going to produce a field ready piece of equipment, but that isn’t the purpose. We just need to prove it’s possible.

Using some hot glue, tape, a few extra wires, and some minor soldering, we have a functional device that just barely crams into our project box.

![Our (poorly) assembled components in a project box.](https://cdn-images-1.medium.com/max/2000/1*8SJQuwKXbuHGMUTJdREWNg.jpeg)*Our (poorly) assembled components in a project box.*

Now we install our software:

* [Raspbian Buster Lite](https://www.raspberrypi.org/downloads/raspbian/) Operating System

* [FFMPEG](https://www.ffmpeg.org/) Multimedia Framework

* [RigidBit](https://www.rigidbit.com/) Blockchain (synced to Ethereum)

After a few hours of installing and configuring, we’re ready for our first video test at a 720p resolution with 30 fps.

![Screenshot of our first FFMPEG test.](https://cdn-images-1.medium.com/max/2000/1*B0kHRujO0NXyJidANar8cw.png)*Screenshot of our first FFMPEG test.*

Uh oh, FFMPEG is maxing out the CPU! 😲 We need to get that way down or this is a complete failure.

Our power is looking good though. Maxing out at around 0.3A we should be able to get a fair amount of time out of our 3200mAH battery.

![Power utilization at full load.](https://cdn-images-1.medium.com/max/2000/1*JrZjc2PcbamvT-60rRJU4A.jpeg)*Power utilization at full load.*

Next, I tried 480p at 10fps… Still maxing out the CPU, and we’re not even running the blockchain yet. 😢

Then I remembered something. Doesn’t the Raspberry Pi have hardware x264? After some quick googling: Yes, and it works with FFMPEG! 😃

Now to put it to the test.

![Screenshot of our successful FFMPEG test.](https://cdn-images-1.medium.com/max/2000/1*EMrBvcxJlPBapvJc1JgyeA.png)*Screenshot of our successful FFMPEG test.*

Running 720p at 30fps consumes only 5% of CPU we have plenty of room to spare! 🙌

The next step is to get RigidBit running. Compiling is painfully slow, so it was left to run overnight. At 4:25 am the compile finished, and (to my surprise) didn’t require any modification. Thank you, Rust!

![Screenshot of RigidBit running on our Raspberry Pi.](https://cdn-images-1.medium.com/max/2000/1*LTeT5g579g5Xz-kK6CwUpg.png)*Screenshot of RigidBit running on our Raspberry Pi.*

Now for the final test. Can our $10 Raspberry Pi handle the task of capturing video and storing it in a blockchain?

![Screenshot of RigidBit and FFMPEG running together.](https://cdn-images-1.medium.com/max/2000/1*1AT2tfFsd9NOX5tX__9bwQ.png)*Screenshot of RigidBit and FFMPEG running together.*

RigidBit hovers around 10% and FFMPEG at around 5%. Success! 🍾

It’s not pretty, but for $25 we have functional video capture being secured with a blockchain on the device itself.

![Photo of our fully operational blockchain bodycam proof of concept.](https://cdn-images-1.medium.com/max/2000/1*mfpXwJf8XMo15KhWZ9UTQA.jpeg)*Photo of our fully operational blockchain bodycam proof of concept.*

**This proof of concept is not even close to being ready for field deployment.** It may be good enough for a home security camera, but anyone who suggests duct-taping this to a police officer should be fired immediately.

There is plenty of room for improvement.

RigidBit requires an internet connection to sync with Ethereum. Since cell phones are widely available, this isn’t a complete deal-breaker, but it’s not ideal. If we incorporate trusted hardware, we may be able to achieve an acceptable level of provability while only needing to sync with Ethereum at the beginning and end of a shift.

RigidBit is already lightweight, but it can be stripped down much further. Most of the features it has are not being used. We might be able to strip it down enough to run on an MCU instead of a Raspberry Pi.

Raspberry Pis are great, but we might be able to get the cost and power utilization even lower by using an SoC like an RTL8170 or an ESP32.

![An RTL8170 (left) and an ESP32 (right).](https://cdn-images-1.medium.com/max/2000/1*L9g4w-0Li2zsgwikYX-CBg.jpeg)*An RTL8170 (left) and an ESP32 (right).*

By combining all of the above, we could cut the device costs, reduce power usage, reduce the physical footprint, and eliminate the need for a full OS.

Besides bodycams, there are plenty of other potential applications:

* Security cameras.

* Vehicle dash cameras.

* Vehicle black boxes.

**Any place where data integrity is important, blockchain can serve an important role in providing absolute provability in a completely open and transparent way.**

Thanks for reading! Please feel free to reply with any comments or questions!