Messing around with DWeb

You may have heard something about NFTs recently. They are the technology concept that underpins the ability to sell an authoritative version of digital art, sometimes for millions of dollars. It is a bit like selling a signed print for more than the unsigned print sells for, but the unsigned print is free while the signed print is worth $69M. But that’s not really want I wanted to talk about.

If you are the sort of person who pays that much for a bunch of electrons somewhere, you don’t want to wake up tomorrow to find them gone. Many well-known websites have, at various times, been brought down by DDoS attacks or merely defacement attacks, and content has gone missing. A website is a surprisingly brittle thing, and relies on domain name registrars, nameservers, web hosts, ISPs and other parties to all come together to deliver the content that you’re expecting. Since a buyer may expect their newly acquired, expensive digital artwork to be as long-lasting as a statue or painting, traditional web infrastructure is not really the solution.

So, NFTs are now making use of decentralised Web or DWeb technology, where the content delivery has no single points of failure. A lot of the thinking behind this is motivated by free speech ideals and resisting government control, but it can just as easily be put to the service of capitalist art speculators. Or, in my case, blog authors.

I was curious to explore what was involved in putting my humble WordPress blog onto the DWeb, or as it is sometimes called, Web 3.0. It wasn’t too hard, but the material I found explaining it was a little esoteric. Follow along if you would like to do this too!

There are basically two things that I needed to do: host the content somewhere (equivalent to using a web host, or perhaps a CDN) and register a name that could point to that content (equivalent to registering and hosting a domain name). In theory, you don’t need the name, but the address for the content then will not be human-readable or memorable.

IPFS (or InterPlanetary File System) is a technology for hosting content in a decentralised fashion, a bit like peer-to-peer file sharing. The main catch is that the files are all static, which means that they can’t run a platform like WordPress. I had to begin by creating a static mirror of my website as plain HTML, CSS, JavaScript and images, without any dynamic content. If I wanted to do it properly, I’d also have replaced the backend system that allows people to leave comments, but instead that feature will simply be disabled.

At the Terminal prompt of my Mac (which suffices for a Unix shell), I used these commands in an empty directory:

% wget -k -r -p -N -E -w 0.5 -nH -e robots=off -R "*\?feed=*" -R "*\?rest_route=*" -R "*&*" https://www.aes.id.au
% git init
% git add *
% git commit -m "Initial commit"
% git remote add origin https://github.com/aesidau/www.git
% git push -u origin master

and within a couple of hours, I had a static copy of my website stored in GitHub. This is a necessary first step to make use of Fleek, which handily takes a GitHub repo and deploys it to the IPFS. It is also free to use for personal purposes if you use less than 3GB of storage!

At this stage, my blog was now available at https://ipfs.fleek.co/ipfs/Qmahm66pomdqppz71abMixDnHWr9b1HmqXhv1iTGrEWjb2/ which is a bit of a mouthful. That last part is the IPFS Hash that is used to uniquely refer to my blog content. Ideally, I could share something short like https://aes.id.au so the next step was registering a suitable name.

There are a few contenders for the name service of the DWeb, including Handshake and NameCoin, but currently the most popular one seems to be ENS which uses the Ethereum blockchain. To buy a name via ENS, you’ll need some Ether currency and a supported wallet to store it in – MetaMask, Portis, Authereum, Torus, WalletConnect and MEW are the various options at the moment. I chose the option of using the Chrome browser together with the MetaMask extension. The amount of Ether you need to buy will fluctuate based on the price of Ether and exchange rates, but it will probably be in the tens of dollars. Also, if you want to buy a name that is 3 or 4 characters long, it will be a lot more expensive. Additionally, every time there is any update to the ENS name record, it will cost some Ether.

After I’d installed MetaMask, set up a wallet with it, and put in some Ether, I needed to go to the ENS App site and click on “Connect”. Then it’s just a matter of following the instructions to register a name. Once the name is registered, click on the option to manage the name, and click on the option to edit the record. I also updated the entries for ETH and BCN addresses, since the changes will all be covered by the same fee, but the main one to edit is “Content”. I put “ipfs://Qmahm…” here with the full IPFS hash, and saved the record.

That’s it. So, now I can refer to that static mirror of my blog by ipns://aesid.eth (in the Brave browser) or aesid.eth/ (in the Chrome browser with MetaMask installed) or https://aesid.eth.link (which uses an IPFS gateway and should work in every browser). Unfortunately, while it is now protected against my WordPress blog disappearing, it is already out-of-date, as this blog post isn’t there!