Hosting a website in the Inter Planetary File System

Centralized internet relies on servers. A decentralized version would rely on a peer-to-peer network built on a community of users. Their internet-connected devices would host the internet. Each website would be spread out across hundreds of nodes on different devices, erasing the possibility of the erver shout-down and your website with it.
Disclaimer!
The intention of this blog is to entertain anyone who might read it and also to provide some sort of encouragement for the author. The opinions it contains are exactly that: OPINIONS, which are mine and mine alone (and of some people that i copied from).

As per usual, a lot of text is copied and pasted from other resources, combined here in a hot mess of everything, however EVERYTHING is properly cited at the end. I use this as "notes" going through the learning process. All the credit goes to the people that made those resources avalible for free for me to copy from them 😛.
In this short post, were gonna talk how to: host a website on IPFS and how to keep it online using a combination of Cloudflare and Pinata.

The why

Here is the thing, I have no secrets of my own! Zero, zilch, zip, nada, nothing. However, this does not mean I am open to anyone to browse what I do and how I do. I like my life to be private. If somebody asks me anything (even a personal query), and if I find it reasonable (which most of the cases I do), I give the answer. I am very careful about what share and how I share. Sometimes, one’s opinion, even though meant to be harmless can cause trouble. This is because, right and wrong are just a matter of perspective. There is no line between good and evil, like there isn’t one between black and white. One’s views are influenced by many many factors, from the day one is born, to the way is risen, place where is risen, beliefs it has and so on ‘n on. Example, if one has Asiatic origins, in one’s views dragons are magical, all powerful creatures, that represent health, good life, excellence and royalty. But if one is of a Western origins, one’s views dragons as a symbol of evil. They fly and breathe fire, it represents the dark side of humanity, greed, lust, and violence. This is an excellence example of how people can have different views. But what happens when one’s views and beliefs do not align with somebody else’s, and because he/she might have more power, he/she may not want your views to be heard?.

Today's online privacy in a nutshell

Sometimes, the same opinion can be intentionally interpreted wrongly by third party. This might be because one wants to manipulate in someone’s name, or want to shame on the other’s dignity, or other that I can’t think of. Thats why signatures were made. Signatures have been an important part of human creativity and identity for literally thousands of years, and in modern day we use them to do everything from sign receipts to authenticate documents, sign autographs and write birthday cards. The legal definition of the signature is: A mark or sign made by an individual on an instrument or document to signify knowledge, approval, acceptance, or obligation. This is crucial in todays world where things like deepfakes exist.

The what

If you are like me, then you’d ask the question, what can one do about it??

Well, in this short post I am going to share my opinions, knowledge and experience on how I set up a copy of my personal website above the IPFS. So, my main domain is bresilla.com and it is directed to a hugo static site hosted in github sites. However, this is a centralized site. Whenever Github wants can turn it off, or whenever a powerful player wants can shut down Github entirely (most likely this wont ever happen), or maybe some powerful government entities think that Github is security risk and block it, then my website cant be accessed either. For this reason i created bresilla.xyz (in differnet dommain, uses .xyz compared to .com). It is the exact replica but instead of being centralized (on a server), it is decentralized, it used Inter Planetary File Syste (IPFS).

IPFS Logo

Internet itself

The early days of Internet were based around different groups of people and organizations. They were isolated standalone networks that might or might not connect with other networks. Thus, the control over the different parts of Internet was limited to different people across groups. The Internet grew up at a fast pace and is now completely centralized. The internet is not fully and physically “centralized,” since no single corporation actually owns the entire internet. But relatively few large, physical servers (associated or operated by relatively few large corporations) are responsible for hosting essential elements of what we consider the internet. These web hosting and cloud computing servers are responsible for keeping our email, social media, and webpages available to all — and that means that the companies that own those servers have an outsized impact on how the internet runs. Centralized internet connection has since given rise to a string of issues that appear to be getting out of hand by the day. In addition to potential loss of connection, given the centralization of such services, privacy and data security concerns continue to cause havoc. Here is the main idea to take with:

The Internet was not planned for what it is and not well developed. It was a time necessity and it just happened.

There is this great article hosted by NOIA Network, that I’ll be refering quite often, goes into technical details on why internet is fundamentally broken, and how it came to be.

A controlled-centralized network Credit: NOIA Network

Decentralization

Centralized internet relies on servers. Decentralized internet connection, on the other hand, relies on a peer-to-peer network built on a community of users whereby no one single entity is ever in control. In this case, various internet devices act as host of the internet, rather than a group of powered servers. What this means is that any website is spread’ across hundreds of nodes erasing the possibility of a single server acting as the single custodian of a particular subset of data. It takes accessibility of data to another level as there are hundreds if not thousands of nodes through which one can gain access to, to access data. Decentralized internet is the sort of idea that works great once everyone is on board with using it. But until then, the sheer fact that no one is using something tends to function as a Catch-22: No one wants to use it because no one is already using it.

Inter-Planetary

IPFS or Inter-Planetary File System, works by connecting all devices on the network to the same file structure. This file structure is a Merkle DAG, which combines Merkle trees (used in blockchains to ensure immutability), and Directed Acyclic Graphs (used in Git version control, which also allows users to see the versions of content on IPFS). Think of it as a large BitTorrent swarm.

Imagine you want to read the IPFS whitepaper. What you would normally do is type in a URL, which can be resolved to an IP address, which provides information about the location of the file (would be the IPFS servers, if they had those), which then allows your client to make a connection with the host and get the file. There are numerous ways in which this can go wrong, a lot of which have been discussed above.

Now, imagine accessing it from the IPFS network. The file, and all of its blocks, are identified by a unique cryptographic hash of the content itself. The whole system is based around a key-value data store. This is what allows for the content addressing: anyone can host the key no matter the origin of the information. So, you would connect to the swarm and request to the network that file. It would first look to the peers closest to you, because chances are they have a copy of that file. If they don’t, however, you will connect with the node that originally uploaded the file, since he’s the one that hosts it.

References
© bresilla (this year 😛). All rights reserved.

Just kidding bro. Apart from the logo, nothing is reserved. Any part of this blog may be reproduced, stored in or introduced into a retrieval system, or transmitted, in any form, or by any means (electronic, mechanical, photocopying, recording or otherwise) without the prior written permission of the author, including for the “fair use” purposes of criticism, comment, news reporting, teaching, scholarship, or research. Any person who does any unauthorised act in relation to this blog it's not gonna be prosecuted at all. Its my great pleasure actually if you find it helpful in any way or form. Copy and do whatever you want, cos this is how we spread knowledge, not by copyrighting everything. However, plese double-check the resources above before you so such an amazing crime.