This week I began a new project.
The idea is to make a decentral, censorship-resilient blog with blockchain technology, that is with the use of IPFS.
On my laptop computer, I am running the go-ipfs program as daemon, when working with it.
Locally I made a folder, in it is a blog directory and a media directory. Then using the Web UI - http://localhost:5001/webui - i uploaded that folder.
At Godaddy, I registered the domain ipfs-blog de - but no Webhosting plan and no server.
I found this article quite useful:
And I have found only one thing wrong; I will tell what I have found.
But from the beginning:
$ ipfs files ls -l
Reply:
ipfs-blog/ QmRcy1UHsBpXF7SdzNnbRzEnC7DQ8BWuWHEMXuvb5cBPsj 0
This is the folder that I uploaded through the Web UI. In it, besides media and blog folder, there is an index.html file. I simply used the standard greeting file from the apache2 web server (the phrase “it works” changed to “it wörks” for Umlaut testing) - but I have no web server running at all
$ ipfs name publish QmRcy1UHsBpXF7SdzNnbRzEnC7DQ8BWuWHEMXuvb5cBPsj
Reply:
Published to QmS5HYERGhTdqj5gsYQn5f1q2jUbxHbk9uja2MVH53tGcG: /ipfs/QmRcy1UHsBpXF7SdzNnbRzEnC7DQ8BWuWHEMXuvb5cBPsj
That what ends with GcG is the hash of my host and after a new publish command there comes the same, so that the reader will find the newest version of the file (for example article or photo).
$ wget http://ipfs.io/ipfs/QmRcy1UHsBpXF7SdzNnbRzEnC7DQ8BWuWHEMXuvb5cBPsj/index.html
This is normal.
Reply:
[code]URL transformed to HTTPS due to an HSTS policy
–2019-12-20 12:46:17-- https ipfs io ipfs/QmRcy1UHsBpXF7SdzNnbRzEnC7DQ8BWuWHEMXuvb5cBPsj/index.html
Auflösen des Hostnamens ipfs io (ipfs .io)… 209.94.90.1, 2602:fea2:2::1
Verbindungsaufbau zu ipfs io (ipfs io)|209.94.90.1|:443 … verbunden.
HTTP-Anforderung gesendet, auf Antwort wird gewartet … 200 OK
Länge: 10702 (10K) [text/html]
Wird in »index html« gespeichert.
index html 100%[=============================================================================>] 10,45K 8,06KB/s in 1,3s
2019-12-20 12:46:46 (8,06 KB/s) - »index html« gespeichert [10702/10702][/code]
- and it finds the file.
Firefox finds it too - Screenshot:
$ wget http ipfs io ipns QmS5HYERGhTdqj5gsYQn5f1q2jUbxHbk9uja2MVH53tGcG/index.html
(ipns instead of ipfs used)
[code]URL transformed to HTTPS due to an HSTS policy
–2019-12-20 12:50:50-- https ipfs io ipns QmS5HYERGhTdqj5gsYQn5f1q2jUbxHbk9uja2MVH53tGcG/index.html
Auflösen des Hostnamens ipfs io (ipfs io)… 209.94.90.1, 2602:fea2:2::1
Verbindungsaufbau zu ipfs io (ipfs io)|209.94.90.1|:443 … verbunden.
HTTP-Anforderung gesendet, auf Antwort wird gewartet … 200 OK
Länge: 10702 (10K) [text/html]
Wird in »index.html« gespeichert.
index.html 100%[=============================================================================>] 10,45K 11,9KB/s in 0,9s
2019-12-20 12:51:57 (11,9 KB/s) - »index.html« gespeichert [10702/10702][/code]
- and it finds the file!
The last thing:
I quote from the article:
IPNS mit lesbaren Namen nutzen
Die Verbidung mit klassischen DNS Servern.
Siehe auch:
Quelle: go-dnslink
Quelle: how-does-resolution-work-with-ipfs
Durch den Hinweis von @Janse möchte ich den Artikel hier noch etwas ergänzen. Damit man nicht nur einen permanenten Link, sondern einen lesbaren permanenten Link hat, kann man den IPFS Hash an einen DNS Eintrag koppeln.
Das setzt voraus, dass man eine Domain hat bei der man DNS Einträge setzen kann (das trifft also nicht gerade auf jeden zu). Alles was zu tun ist, ist ein TXT Record im DNS zu setzen. Machen wir mal ein Beispiel:
Angenommen uns gehört die Domain “sonstwas com”. Dann gehen wir zu unserem Nameserver und setzen ein TXT Record:
sonstwas com. 600 IN TXT “dnslink=/ipfs/QmXQeB…VYFSZB”
I put this in into godaddy, before this I had the idea to delete the A record.
Here I first had no success, then I changed ipfs to ipns and the had success.
Screenshot:
dig output:
[code]$ dig -t TXT ipfs-blog de
; <<>> DiG 9.11.5-P4-5.1-Debian <<>> -t TXT ipfs-blog de
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 27420
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;ipfs-blog de. IN TXT
;; ANSWER SECTION:
ipfs-blog de. 600 IN TXT “dnslink=/ipns/QmS5HYERGhTdqj5gsYQn5f1q2jUbxHbk9uja2MVH53tGcG”
;; Query time: 1664 msec
;; SERVER: 192.168.43.1#53(192.168.43.1)
;; WHEN: Fr Dez 20 12:41:11 CET 2019
;; MSG SIZE rcvd: 114[/code]
That’s it.
And:
[code]$ wget http ipfs io ipns ipfs-blog de index.html
URL transformed to HTTPS due to an HSTS policy
–2019-12-20 12:56:01-- https ipfs io ipns ipfs-blog de index.html
Auflösen des Hostnamens ipfs io (ipfs io)… 209.94.90.1, 2602:fea2:2::1
Verbindungsaufbau zu ipfs io (ipfs io)|209.94.90.1|:443 … verbunden.
HTTP-Anforderung gesendet, auf Antwort wird gewartet … 200 OK
Länge: 10702 (10K) [text/html]
Wird in »index.html« gespeichert.
index.html 100%[=============================================================================>] 10,45K 7,36KB/s in 1,4s
2019-12-20 12:56:25 (7,36 KB/s) - »index.html« gespeichert [10702/10702][/code]
And Now: Happy blogging!
Decentrally and censorship-resilient.
However the price: it takes much longer to load a page in comparison to a “normal” blog using a web server and a blogging app such as WordPress …
Some things do not work through the router of the company but only through my own smartphone hotspot, such as loading a page or giving the resolve command to go-ipfs - seems that another UPD / TCP port is used.
NOTE: SOME PERIODS AND SLASHES REPLACED WITH BLANK!