Tutorial: How to host your own distributed file sharing service on your pc

The first part of a series describing the technology behind Dweb.page

For those who have never heard of the InterPlanetary File System (IPFS), here is a quick introduction by Wikipedia:

“InterPlanetary File System (IPFS) is a protocol and network designed to create a content-addressable, peer-to-peer method of storing and sharing hypermedia in a distributed file system.”

Let us explore IPFS through an example. At present, we use the combination “https://www” plus an address to find information on the internet. This is a location-based system. It works in a way that resembles saying to someone that they can find a copy of a book at the library in Alexandria, on the second floor, section 2, shelf number 5. However, the same information — other copies of this book — may be found at different, perhaps even nearer locations, but unless you specifically know where to search for, you will not find this information.

The fundamental difference with IPFS is that it uses a name-based system. The name is a unique “hash”, which is a combination of letters and numbers. This is how a real-world hash looks like: QmaSpmvTr68z3EgTp2XFZdBzc1HwNPQXWHyF34rpctJgCs. To illustrate how this impacts our previous book example: unique hashes allow a person to search specifically for the information they are looking for (i.e. title of the book). Any individual who has this information can provide it — independent of their location. Usually, this means that the person can find a place much closer than the library of Alexandria to get this information, saving valuable resources and time. If you want to learn more about it, here is a more detailed yet digestible article: https://medium.com/@ConsenSys/an-introduction-to-ipfs-9bba4860abd0. For our use case, just replace Ethereum with IOTA.

Now one of the biggest advantages with a name-based system is that you can create a complete distributed web application (links don’t point to specific locations anymore), that can run on every server, even on your local machine. That’s why we will show you how to run our Dweb.page on your local computer, which means you can share files end-to-end encrypted with a transparent IOTA based logging system without trusting any web server.

The first two steps below describe the current process of setting up IPFS on your local machine. We expect that this process will take place automatically in the future: there is already a browser extension under active development that simplifies this.

Step 1: Install IPFS

First, you need to download the go-ipfs client for your operating system. At the time of writing, you can do this using the following link: https://dist.ipfs.io/#go-ipfs

IPFS download page

Next, extract the zip file. No need to click on the EXE file to install it or anything else at this stage.

Step 2: Start IPFS

Second, open your command line. On Windows, you can search for the command prompt by typing cmd in the search tool in the lower left corner. On a Mac, you need to search for the terminal . In the command line, you need to open the go-ipfs folder. You can do this by copying the address in your explorer (right click on it -> copy address):

Right click on it -> copy address

Next, you need to type the cd command (change directory) plus the address in your command line, for example:

The process is similar on Mac.

All that is left to do in this step is to set up your IPFS installation by typing:

ipfs init

And get everything up and running with:

ipfs daemon --writable

If everything works correctly it should look similar to this:

Step 3: Start sharing

Third, just open your preferred browser and type http://localhost:8080/ipfs/ plus the most recent hash of Dweb.page. This is basically like asking people on the street for the specific version of Dweb.page. For example, at the time of writing the whole address should look like this:

Now it will take some time to load the page. Once the page is loaded you can start using Dweb.page on your local machine! And the great thing is, that if the receiver of your file starts an IPFS server on their own computer, they can simply open your access link and download your file directly from your computer (might take some time).

Future perspectives

At present, we imagine that this setup has two drawbacks:

Currently, the person who should get the file probably knows little to nothing about IPFS and You both might not run your IPFS servers at the exact same time.

To address these issues, we will show you in the next tutorial how to host your own file sharing system permanently online.

And if you’re not interested in setting up your own IPFS server at all, you can always just open Dweb.page, which will automatically redirect you to one of the participating IPFS servers. This way, you and your recipients can take advantage of all the benefits of simple, decentralized, fast and highly secure IPFS-based file sharing on your pc.