IPFS Demo

Week 6–1 Year of Blockchain

Clone or follow along:

IPFS is a distributed object store. If you’re completely new to IPFS, start here.

The data storage industry itself is massive (50 billion U.S. dollars by 2019), however it is highly concentrated amongst those that provide file storage hardware and those that provide file storage services. Needless to say, the services provide much higher margins compared to the hardware itself (think of how much a hard drive costs vs how much AWS can charge for the service on top of it over the lifetime of the drive). Is IPFS a disruptor to this industry? Is it ready for production usage? How easy is it to implement? Let’s find out.

Getting Started

Start by installing ipfs.

# Initialize the node: $ ipfs init # Start the daemon $ ipfs daemon

You should be able to see the web UI at http://localhost:5001/

IPFS web UI

At this point you can clone the repo and start it with:

$ git clone https://github.com/wrannaman/IPFS-Demo.git && cd IPFS-Demo && npm i && npm run dev

An empty demo

Now you should be able to upload images or video and see them immediately.

A video uploaded to a local IPFS node.

If your IPFS Web UI is getting a 403, or the app can’t connect to your local IPFS node, try this.

Notes:

Implementing IPFS was straightforward. In a lot of ways it is easier to implement IPFS than it is to implement an S3-Compatible object storage. There is no server required and even uploading larger videos was fast (because the node you’re uploading to is local). It should be noted that access control on ipfs as we know it on S3 would be non-trivial.

Deleting files is non-trivial. In short, you don’t delete files with IPFS. You can read more about the discussion here.

Uploading the same file multiple times will result in the same file with the same hash being uploaded. This makes sense, the content of the file hasn’t changed, so neither has its hash. In the demo, when deleting a file, really I’m un-pinning the file and removing a local storage reference to it, the caveat being that if another node has picked up the file and is hosting it, it will be addressable via it’s hash indefinitely.