Using IPFS for IoT Communications

Have you heard about the IPFS project? It’s an open source project on a mission to develop a distributed file system. It feels like BitTorrent + Git smashed together to allow anyone running the IPFS daemon to access each other’s files in a peer-to-peer (P2P) fashion.

They recently released an experimental pubsub feature on the IPFS platform. Pubsub basically lets you “subscribe” to a channel or topic allowing you to receive messages from other devices that “publish” messages to that same channel or topic.

This got me thinking… MQTT is one of the most popular IoT messaging protocols. It, too, uses a similar pubsub model. It’s downside is that it requires a broker in the cloud or on the edge of a network to manage message deliveries. If you could do the same thing but in a more resilient manner such as within a distributed network, (IPFS), your devices could interact across networks — even without the cloud or DNS!

Here’s quick, working proof-of-concept of my idea in action!

Here’s the code:

You can turn the Arduino LED on/off by publishing messages via IPFS from anywhere in the world.

> ipfs pubsub pub general on
> ipfs pubsub pub general off

You could just as easily automate the toggling of this LED using the following script for publishing messages.

I believe that IPFS has great potential in the Internet of Things domain.