What’s IPFS and why it is better than cloud?

Andrej
3 min readAug 25, 2019

According to official documentation

IPFS is a distributed system for storing and accessing files, websites, applications, and data.

Similar to a torrent, IPFS allows users to not only receive but host content. As opposed to a centrally located server IPFS is built around a decentralized system of user-operators who hold a portion of the overall data, creating a resilient system of file storage and sharing. Pretty cool, right?

But, how is this better than cloud and HTTP that we are using mostly nowadays? Well, let’s use a Facebook-Cambridge Analytica data scandal for instance. Whenever there’s a centralized authority, data stored on those servers can be abused. So, a distributed, decentralised future is one that we will inevitably come to see.

Installation

Mac OS X

$ brew install ipfs

Linux

Download IPFS for your platform . After downloading, untar the archive, and move the ipfs binary somewhere in your executables $PATH using the install.sh script:

$ tar xvfz go-ipfs.tar.gz
$ cd go-ipfs
$ ./install.sh

Windows

After downloading, unzip the archive, and move ipfs.exe somewhere in your %PATH%.

Usage

Version check

$ which ipfs

To see all commands and general usage

$ ipfs

Ok, everything is set. First you need to initialize the repository.

$ ipfs init

You should see something like this in your terminal.

initializing ipfs node at /Users/jbenet/.go-ipfs
generating 2048-bit RSA keypair...done
peer identity: Qmcpo2iLBikrdf1d6QU6vXuNb6P7hwrbNPW9kLAH8eG67z
to get started, enter:
ipfs cat /ipfs/Qmcpo2iLBikrdf1d6QU6vXuNb6P7hwrbNPW9kLAH8eG67z/readme

Now, try running the command suggested to you in the output of ipfs init. You should see something like this.

To run everything smoothly, you’ll need to open the following ports.

$ sudo firewall-cmd --zone=public --add-port=4001/tcp --permanent
$ sudo firewall-cmd --zone=public --add-port=8080/tcp --permanent
$ sudo systemctl reload firewalld$ sudo firewall-cmd --zone=public --permanent --list-ports

Let’s try it! Type the following command to turn on your IPFS Node.

$ ipfs daemon

You will see this as output

Initializing daemon...
go-ipfs version: 0.4.20-8efc825
Repo version: 7
System version: amd64/darwin
Golang version: go1.12.4
Swarm listening on /ip4/127.0.0.1/tcp/4001
Swarm listening on /ip4/192.168.8.106/tcp/4001
Swarm listening on /ip6/::1/tcp/4001
Swarm listening on /p2p-circuit
Swarm announcing /ip4/127.0.0.1/tcp/4001
Swarm announcing /ip4/192.168.8.106/tcp/4001
Swarm announcing /ip6/::1/tcp/4001
API server listening on /ip4/127.0.0.1/tcp/5001
WebUI: http://127.0.0.1:5001/webui
Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080
Daemon is ready

If you go to http://127.0.0.1:5001/webui you will open the web console.

Upload documents, movies, even whole websites on IPFS…

Now it’s time to upload some data on IPFS and see how it is being used. It is actually very similar to uploading data on cloud, but let’s not forget the benefits of decentralised networks. We will upload a simple png file. To do that type following command from a folder where the picture is located.

$ ipfs add -r ./ScreenShot.png

The output will be:

$ added QmRFhUyqGmWRM4un6RqUXWo69kRL7CwezZxq4VtYijdwdy ScreenShot.png

This Qm…. hash is the unique IPFS hash of particular file. To download our picture from IPFS network type

$ ipfs cat QmRFhUyqGmWRM4un6RqUXWo69kRL7CwezZxq4VtYijdwdy >> downloadedPicture.png

To see it through web browser go to https://gateway.ipfs.io/ipfs/QmRFhUyqGmWRM4un6RqUXWo69kRL7CwezZxq4VtYijdwdy

For more examples of usage, here is the official video demo.

Conclusion

If you find this article useful, thumbs up 👍. For more info there is official website and GitHub page.

--

--