Create a simple static site
All you need is a simple static HTML page, as long as ALL the links are relative. For the purposes of this tutorial, I have put a simple hello world here
Save these files in a folder named site.
Add to BTFS
Next, you need to add the site to BTFS.
$ btfs add -r site/
You should see something like this:
added QmaL9R8Mxpgn7gxiqYytccM3BWX1FZfSRNGPJChu62Xe2B site/index.html
added QmazEzEvcnQ6QRdMCMYPMFphen85G93x7qKpxgeCH2FFmu site/style.css
added QmeYMHYf9Sor9q8aUgHwSL466BQQ5WK12AadV7BApDEFPU site
The hash on the last line is the root of your site, you can visit is by opening http://localhost:8080/btfs/<your hash here>.
You can also view the website from the public BTFS gateway, but the website may take minutes to be available on the public gateway.
Publish to IPNS
Now you have a simple static site hosted on BTFS. The problem is, whenever you update your site, the hash will change, and any links you have shared will continue pointing to the old version.
You need a way to always share the latest hash. That’s where IPNS comes in. It allows you to store a reference to an BTFS hash under the namespace of your peerID (hash of your public key).
If you want to know more about IPNS and How it Works, head here.
$ btfs name publish <your site hash>
This may take a few minutes. We will see how to do this faster using DNSLink below.
You will see something link this after your website has been published using IPNS.
Published to QmeYMHYf9Sor9q8aUgHwSL466BQQ5WK12AadV7BApDEFPU: /btfs/QmQToNGFsGMkQe76mRirCvRykJSiRB1JPpRLumyMN7N67T
That will return your peerID(the bold text above) and the hash you are publishing to it. You can confirm by running:
$btfs name resolve <peerId>
This will also a few minutes. After this is executed, you will see something like this:
or you can view https://gateway.btfssoter.io/ipns/<peerID> (notice the directory is ipns not ipfs). This will also a few minutes.
After a few minutes, you will be able to see your website:
IPNS forgets(Time to Live System) published names after about 12 hours. You might want to run a cron job to republish within 12 hours.
https://youtu.be/FpHxyzzOFRc #TRON is worth $2.5 billion (and only growing), its become the #1 platform for dapps, its attracting new developers...
I was lucky to be selected as early tester of the BitTorrent File System (BTFS). In this video, I go through some basic features of BTFS including ad...
John McAfee starts beta trials of his decentralized exchange and offers anyone to set up ‘portals’ on the basis of the DEX and receive part of fees f...
TRON is excited to shortly be launching the BitTorrent File System (BTFS) Testnet. In advance of this launch, TRON will be making BTFS available to s...