GETTING STARTED

As with anything truly revolutionary, IPFS takes some getting used to. In this module we’ll cover how to set up your own node and push / pull files from the network.

1. INSTALL IPFS
Since IPFS is a new protocol, you’ll need to install their bundle so that your device will be able to communicate with other IPFS nodes.

After downloading, untar the archive, and move the ipfs binary somewhere in your executables $PATHusing the install.sh script:

$ tar xvfz go-ipfs.tar.gz
$ cd go-ipfs
$ ./install.sh

Test it out:

$ ipfs help
USAGE:

    ipfs - Global p2p merkle-dag filesystem.
...

Congratulations! You now have a working IPFS installation on your computer.

After downloading, unzip the archive, and move ipfs.exe somewhere in your %PATH%.

Test it out:

$ ipfs help
USAGE:

    ipfs - Global p2p merkle-dag filesystem.
...

Congratulations! You now have a working IPFS installation on your computer.

This will cover your needs for this tutorial, but for more info on setting up IPFS you can also visit their portal here.

2. Initialize Your Node

Now that you have installed the IPFS software, you’ll need to configure your local node. For the sake of this example, you can use the defaults. For more information on configuring nodes for different environments click here.

> ipfs init
initializing ipfs node at /Users/jbenet/.go-ipfs
generating 2048-bit RSA keypair...done
peer identity: Qmcpo2iLBikrdf1d6QU6vXuNb6P7hwrbNPW9kLAH8eG67z

Congratulations – you’re now the proud owner of your very own IPFS node!
Your node’s address is shown in the last line as ‘peer identity’.

You can test that your node is working by contacting the IPFS core node to download the readme or quick-start guide:

ipfs cat /ipfs/QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG/readme
ipfs cat /ipfs/QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG/quick-start

3. GOING ONLINE

Now that you have IPFS installed and your node has an address, you can take the node online and join the network. You may want to use a separate shell window for this.

> ipfs daemon 

Initializing daemon... 

API server listening on /ip4/127.0.0.1/tcp/5001 

Gateway server listening on /ip4/127.0.0.1/tcp/8080 

You can also see other peers on the network:

> ipfs swarm peers 
/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ 
/ip4/104.236.151.122/tcp/4001/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx 
/ip4/134.121.64.93/tcp/1035/ipfs/QmWHyrPWQnsz1wxHR219ooJDYTvxJPyZuDUPSDpdsAovN5 
/ip4/178.62.8.190/tcp/4002/ipfs/QmdXzZ25cyzSF99csCQmmPZ1NTbWTe8qtKFaZKpZQPdTFB

4. Retrieving Files

We’re now online, so we can try downloading a file from the network.

ipfs cat /ipfs/QmW2WQi7j6c7UgJTarActp7tDNikE4B2qXtFCfLPdsgaTQ/cat.jpg > cat.jpg
open cat.jpg

If everything is working properly you should now see a cat! This image file is now on your computer, but you didn’t get it over HTTP, and it may have been downloaded from any of hundreds of IPFS nodes around the world. 

> ipfs init
initializing ipfs node at /Users/jbenet/.go-ipfs
generating 2048-bit RSA keypair...done
peer identity: Qmcpo2iLBikrdf1d6QU6vXuNb6P7hwrbNPW9kLAH8eG67z

5. STORING Files

You can also push files to the network:

> hash=`echo "I <3 The Blockchain Institute -$(whoami)" | ipfs add -q`

This will generate a hash of your string message and store it at a new ipfs hash url. 

> curl "https://ipfs.io/ipfs/$hash"

This should now return:

I <3 The Blockchain Institute -<your username>

6. Dashboard View

Now that you’re up and running, you may want to also check out the localhosted network that shows connected peers and files stored.

You can view the dashboard whenever the daemon is running at http://localhost:5001/webui

The webUI View has lots of additional features for non-command line users!