Decentralized Storage

Storing & Retrieving Files

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 an image file open with a picture of 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 /home/institute/.go-ipfs
generating 2048-bit RSA keypair...done
peer identity: QmT6s9dZXRFbxGhvSW68BdZEFF9mHaTW6erH3TNMrRGZfX

Storing Files

You can also push files to the network:

hash=`echo "I <3 The Blockchain Institute" | ipfs add -q`

This will generate a hash of your string message and store it at a new IPFS hashed URL:

curl "$hash"

This should now return:

I <3 The Blockchain Institute