In this guide we will cover hosting site in way where it will be available via Elymus or any other implementation of Repens protocol.
Firstly, you need to know what Repens protocol is. To learn it, read Repens protocol description
Repens protocol works with static-only websites. All "backend" should be done via smart contracts.
You can use both SPA (single page application, only 1 page exists, nothing is pre-generated) and SSG (SPA but with pre-generates routes) modes, although SPA mode shows to be more performant with Elymus.
You can get static content by developing it yourself, or clone/download example static site for this guide.
Site's content (all pages, images, files, etc.) should be packed to ZIP folder. On Windows the easiest way is to send it to compressed (zipped) folder. After this, you should get zip file with contents of your site.
Now you need sha256 hash of archive (in hex encoding) that you got in previous step. Easiest way to get it is to upload archive to this site.
Put it somewhere (you can open notepad/notes app and insert it here, you will need it later).
Now you need to upload this archive to IPFS, for effective p2p caching, and to other resource (Arweave/skynet/somewhere else) for anchoring (pinning, making data available when no peers are online).
Uploading to IPFS is important: When person will visit your website via Elymus or other Repens protocol implementation, he will download archive and seed it to other users, making it more decentralized.
So, download IPFS Desktop, and add your ZIP archive here.
Then, copy CID that you got and write it somewhere (notes app/notepad). You will need it at the stage of setting records for your handshake name.
Now upload it to arweave/skynet. It is needed because sometimes there's no peers who will seed your ZIP archive, and we don't want to fallback to centralizing pinning like Pinata or instable solutions like Filecoin.
This step won't be detaily described in this guide: You can find bunch of resources in internet about how to upload data to arweave/skynet. Just remember that you need to write down content IDs for usage in next step (for arweave it's transaction ID, for skynet it's skylink).
Now get Handshake name. You can buy it on Namebase, win on auction via Bob Wallet (or namebase), or get random one for free in one of Handshake communities. One of popular ones is here: https://discord.gg/vcM3bnhn2U
Now, after you have name, set root zone's records as described in Repens protocol specification, using sha256 hash from of ZIP archive that you got in 2nd step as data_hash
, and using content IDs from 3rd step as data_way
s. (e.g repensprotocol=enabled
,data_hash=02C29C6A6882222EF720E18D016D9ED52001AE3BA2552E2A7675F465C5012774
, data_way=ipfs:QmWi2zXjqv3XZbjyNHXH8yWgqExa2vQ81n9hUJ51cYLBfd
).
After you did setup records, wait until Urkle tree of Handshake updates. You can see time to next Urkle tree update here
After handshake Urkle tree updates, open Elymus (download on releases page if didn't yet), and try accessing your site using repens://<your-handshake-name>
(e.g repens://mouse
).
It should look like this (if you are using example site from https://github.com/angrymouse/extremely-simple-site):
Enjoy! Now this frontend is completely decentralized!
Share with your dev-friends who seek decentralization in their apps, follow @angrymouse_hns on twitter.