135 lines
4.1 KiB
Plaintext
135 lines
4.1 KiB
Plaintext
- IPFS: The Interplanetary File System
|
|
- What is IPFS
|
|
- What can I do with it?
|
|
- Basics of IPFS
|
|
- Cool stuff to do after set up
|
|
- Adding a file to ipfs
|
|
- Making an Indestructible Website
|
|
- Up and Coming projects using IPFS
|
|
|
|
|
|
|
|
IPFS: THE INTERPLANETARY FILE SYSTEM
|
|
|
|
|
|
What is IPFS
|
|
|
|
Ipfs is software that connects every computer thats a node in the system
|
|
to the same, indestructable network of files. Its comparable to a
|
|
bittorrent swarm and evokes the spirit of the original version of the
|
|
web.
|
|
|
|
|
|
What can I do with it?
|
|
|
|
Ipfs is designed to make anything you post on it, near impossible to get
|
|
rid of as as the network is up. This means you can make files that are
|
|
impossible censor and cant 404 just because the server hosting it craps
|
|
out. Its even possible to make an indestructible, completely
|
|
decentralized static website!
|
|
|
|
|
|
Basics of IPFS
|
|
|
|
You can install it with your native package manager or snap if your
|
|
distro supports it
|
|
|
|
sudo apt install snapd snap install ipfs
|
|
ln -s /snap/ipfs/current/bin/ipfs /usr/local/bin
|
|
|
|
Setup is just as easy!
|
|
|
|
ipfs init
|
|
ipfs less /ipfs/QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv/readme
|
|
ipfs daemon ipfs swarm peers
|
|
|
|
|
|
Cool stuff to do after set up
|
|
|
|
Adding a file to ipfs
|
|
|
|
If having you're own immortal file sounds awesome, you'll be happy to
|
|
know doing the same is easy!
|
|
|
|
Simply type: ipfs add the_meaning_of_life.txt
|
|
|
|
and you're done!
|
|
|
|
The command will return a hash that looks something like this:
|
|
QmZtmD2qt6fJot32nabSP3CUjicnypEBz7bHVDhPQt9aAy
|
|
|
|
You'll need that has to get your file from ipfs, just like a website url
|
|
gets you the site. The hash changes when the file changes, so as long as
|
|
the file is the same the has will also be.
|
|
|
|
More can be found here
|
|
|
|
Making an Indestructible Website
|
|
|
|
If you've every wanted a website but
|
|
|
|
1. Couldn't afford hosting
|
|
2. Needed to post things you're government wouldn't approve or
|
|
3. thought it was too complicated
|
|
|
|
Ipfs has you covered!
|
|
|
|
Start by making a directory containing your html files, lets say
|
|
zerzangang is your folder name. Make sure the daemon is running:
|
|
|
|
ipfs daemon
|
|
|
|
Then you can add the directory to ipfs
|
|
|
|
ipfs add -r zerzangang
|
|
|
|
You'll get something like this spat out at you
|
|
|
|
added QmcMN2wqoun88SVF5own7D5LUpnHwDA6ALZnVdFXhnYhAs zerzangang/pics/zerzan_sexy.jpg added QmS8tC5NJqajBB5qFhcA1auav14iHMnoMZJWfmr4k3EY6w zerzangang/pics added QmYh6HbZhHABQXrkQZ4aRRSoSa6bb9vaKoHeumWex6HRsT zerzangang/index.html added QmYeAiiK1UfB8MGLRefok1N7vBTyX8hGPuMXZ4Xq1DPyt7 zerzangang/
|
|
|
|
Something to note is how every file and subdirectory is given its own
|
|
crypto hash. For now, all you need to know is that the last line is what
|
|
functions as your "site url". And you're done! All you have to do is
|
|
type http://localhost:8080/ipfs/$SITE_CID where $SITE_CID is your hash
|
|
of your site's directory.
|
|
|
|
And you're done!
|
|
|
|
1. IPNS: The Problem Solver
|
|
|
|
You might remember me saying that the entire hash changes when you
|
|
change the file. So one downside is that if you edit your website
|
|
and republish it on ipfs, your site's hash, which is part of its
|
|
url, will change completely. This is obviously a pain in the ass.
|
|
But dont worry IPNS has you covered! IPNS allows you to register one
|
|
hash that stays the same despite the file changes. Lets set it up
|
|
with your site now!
|
|
|
|
Start by running:
|
|
|
|
ipfs name publish $SITE_CID
|
|
|
|
The command will return
|
|
|
|
Published to $PEER_ID: /ipfs/$SITE_CID
|
|
|
|
PEER_ID will be the new site hash and you can verify everything went
|
|
write by typing ipfs name resolove PEER_ID. You can now visit your
|
|
site on https://ipfs.io/ipns/PEER_ID. The next time you you want to
|
|
update the site, simply run:
|
|
|
|
ipfs add -r zerzangang/ ipfs name publish NEW_SITE_HASH
|
|
|
|
Now when someone wants to visit your site the address stays the
|
|
same!
|
|
|
|
|
|
Up and Coming projects using IPFS
|
|
|
|
Neocities, the spirtual successor to geocities, uses ipfs to back up
|
|
every change made on the sites it hosts. Making sure that a wealth of
|
|
web culture won't go AWOL again.
|
|
|
|
Radicle is a really interesting project that uses ipfs to make a p2p way
|
|
to collab on code.
|