In this post, I show how to (1) publish a static website on the InterPlanetary File System (IPFS), (2) make it available via the InterPlanetary Name System (IPNS), and (3) point your DNS domain to your IPNS record via DNSLink.
This is the process I use for this website. It lets visitors to pirlea.net retrieve my site either using HTTPS or, if their browser is configured for it, using IPFS.
As a bonus, (4) I will show how you can register an Ethereum Name Service (ENS) domain, so that people can find your web site even if your DNS domain is censored.
What is IPFS and why would I want to use it?
IPFS is a system for sharing files. You can become a part of this system by runnning IPFS node software on your computer. As a participant, you can host files and retrieve files hosted by others.
HTTPS requires trusted servers
One system for hosting and retrieving files you are already familiar with is HTTP(S), the Hypertext Transfer Protocol (Secure). You can host a file by running HTTP server software (e.g., nginx) on your computer. Others can access your file using a HTTP client, like a web browser, by connecting to your server via its IP address and requesting the file by name.
For instance, when you visit https://pirlea.net/2021/07/09/publish-your-site-using-ipfs/, your browser resolves the
pirlea.net domain to the IP address of my computer,
22.214.171.124, establishes a connection to the nginx server on my machine, and requests this article by name:
GET /2021/07/09/publish-your-site-using-ipfs/ HTTP/1.1 Host: pirlea.net
This works, but has issues with (a) the availability of my computer and (b) the integrity of the files you receive. If my computer is offline, I would want other people to be able to serve my website in my stead. But this is actually quite difficult to do with HTTPS.
I can’t point
pirlea.net to a random person’s IP address, since that person may serve different files than I intend. For instance, I don’t want people who access this URL to see pictures of cats: there’s nothing that guarantees that https://pirlea.net/2021/07/09/publish-your-site-using-ipfs/ is actually this article, rather than a completely different file.
Letting your website be hosted by people you don’t trust is not possible with HTTPS.
HTTPS has centralising effects
There are other issues that make it difficult to host an HTTPS server on a regular home Internet connection, so people typically host their website on computers they rent from others.
The hosting market is dominated by a small number of corporations, so whenever they have problems, large portions of the web stop working, which is unfortunate, but I won’t go into details.
IPFS lets untrusted hosts serve your website
How to Register ENS
Wait for a period with low gas fees. You can check at https://www.gasnow.org/
Use a fresh account, with no connection to your previously used accounts. Withdraw ETH directly from an exchange to this account.
If you’ve used a crypto wallet before, this is easy.
© 2022 George Pîrlea ― last updated on 2022-01-03 at 09:32 UTC