How to launch a serverless website using RIF Storage

By Rinke Hendriksen - Swarm Product Owner April 10, 2020

RIF Storage was set out to create the base-layer of a truly decentralized internet. Previously we have spoken about the partnership between RIF Storage and Swarm in regards to the high-level workings of the protocol, the improvements with respect to incentivization of the protocol, and the launch of our incentivized testnet. In our documentation, you can see how to start your own RIF Storage node and participate in our incentivized testnet, but… how can you launch your own serverless website?

Doing this is actually surprisingly easy. So easy, perhaps, that we should have already created a simple, hands-on tutorial for you to try out!

We can promise you this: Everybody is able to, now, launch an unstoppable and serverless website. How? Please continue reading to find out!

Hello World HTML

In order to take full advantage of hosting a website in a decentralized fashion, it should not require connections to any (centralized) backend. For those who have never created such a website, let’s make a very (very!) simple one:

                              <title>My first website</title>
                              Hello world

While this website is very easy, all the building blocks that are used on the normal web can be utilized with RIF Storage!

If you save this file as index.html and open it in your browser, you will see the browser’s interpretation of what you just wrote.

Traditionally, the Hello World example would now continue with setting up a basic web server. In a nutshell, a server is a computer program which will send a file (like index.html) upon request; if you visit a website, you send a request to a server, which sends you a web-page in return.

Comparison between traditional centralized client-server model (web1.0 and web2.0 architecture) and decentralised model (web3.0)

Serverless Websites

RIF Storage allows the setting up of a serverless website: There is no centrally-controlled server that sends the index.html file upon request, but rather a collection of collaborating and incentivized nodes. For the purpose of this blog, we won’t go into the specifics of how this works. Essentially, your file will be cut into many pieces that are all stored on separate computers and pieced back together upon request. This architecture has many benefits, the primary one being that data on this web is not owned and controlled anymore by a single party, making it censorship-resistant and unstoppable!

Let’s do some preparation first. Please change your index.html file to say “Hello decentralized world”:

                              <title>My first website</title>
                              Hello decentralized world

Now, navigate to and press the upload button. Navigate to your file updated index.html and upload the file.

If you now click “Copy link to clipboard” and paste this link in the address bar of your browser, you will be able to see your serverless website. Pretty easy, right?

NOTE! Your link must look like <long_sequence_of_characters/index.html>

Serverless DNS

The link that you just copied into your browser looks rather complex and isn’t very easy to memorize. Your friend will be able to visit your website by pasting this link in their browser, but wouldn’t it be easier to make a real website with a memorizable name?

In the centralized world, this is solved by a DNS server. A DNS server basically keeps a record of website addresses and IP-addresses: If you type into your browser, you first send a request to the DNS-server, requesting the IP-address behind this website and consequently, you send a request to the actual server.

This is also possible in a decentralized way by utilizing smart contracts on the blockchain: RIF makes this easy with the RIF Name Service (RNS), which allows you to resolve any human-readable name (ending with the extension .rsk) to a content-identifier (the address of your website). Please check out our latest blog post that explains this process if you haven’t done so already. By following the steps noted in the blog, you will be able to use your own domain name for your newly-created website. Amazing!

After purchasing the domain, you need to add the content resolution. It’s simple via the new RNS manager. Log in to your admin console (as shown below).

Press on “edit” to set the content. As content, you need to set the content address of your index.html. The content address is this long sequence of characters and numbers, previously in the address bar of the browser. RNS requires such an address to start with 0x. Simply add it!

If you don’t have time to do this, but still want to see the magic happen, you can navigate to manifesto.rks


What about the gateways?

If you have come this far and have managed to create your own serverless website and add a decentralized name-resolution, congratulations! Yet, some of you might have already noticed that there is still one centralized component involved. Exactly- our gateways.

Up until now, we have been using a “traditional” website, as a portal to the decentralized network. We call such a system a gateway server. The gateway server runs the RIF Storage Swarm software and exposes it to the internet so that you don’t need to run it yourself. Of course, such a server is not a requirement to access the decentralized internet, it just makes it much easier to do!

An illustrative example of how gateways interact with decentralized storage and clients

For those who really want to have the full-decentralized experience, the Swarm software, which is running on our gateway, is well-documented (on our developers portal or in this RIF article). We advise you to read through this information and try it out yourself.
Additionally, the RIF team is always available to answer any of your questions or assist with your implementation.

You can watch my workshop tutorial on how to launch a website on RIF Storage using your own node via this link:

Coming Up:

Many exciting things are coming up to make the decentralized web experience even better, but two things require particular attention from us for the near future. Follow us on Twitter @rif_os to stay informed and be the first to hear about our launches!

RIF Publish

RIF Publish is an (even easier way) of publishing and consuming mostly static content (like articles and websites) to decentralized storage. The aim is to fight censorship of the content and content creators, especially in certain jurisdictions where this poses a more significant problem.

Global pinning

A decentralized network as a backbone of the internet is great in some cases, but decentralization comes with the loss of some control: As pieces of your files are stored at other nodes in the network, it may happen that they get lost. Ultimately, this can never be prevented fully, which is why global pinning is such an important feature. Global pinning allows for automatic repair of your files in case they are lost, thus enabling the persistence of files, as long as one node (the pinner) stores the file.

Follow our news!