About the author: Tianyi Dong, IPFS/Filecoin China technology evangelist, author of IPFS Guide. He graduated from The School of Software and Microelectronics of Peking University and worked as a database development engineer in Oracle Asia R&D Center (China). Senior blockchain technology developer, now working on IPFS/Filecoin technology in China to promote IPFS competitors.

Today, I will talk about how to upload and download files in IPFS.

1. Download IPFS software

Dist. Ipfs. IO /#go-ipfs

After opening this address, the web page will automatically select the version available for you to download according to your current operating system. There are many ipFS related software downloads on this page. Please check to download GO-IPFS, which is the implementation of the GO language version of IPFS. The team is overwhelmed).

2. Install

Windows: Select a file, unzip the software into it, and then open the command line, navigate to the previous folder and execute:

ipfs help

USAGE:
ipfs - Global p2p merkle-dag filesystem.
...
Copy the code

If you get the above information, congratulations on your SUCCESSFUL IPFS installation.

For Mac and Linux, run the tar XVFZ go-ipfs.tar.gz command to decompress the downloaded file and run the./go-ipfs/install.sh command to install the software.

ipfs help

USAGE:
ipfs - Global p2p merkle-dag filesystem.
...
Copy the code

This also indicates that the installation was successful.

3. The configuration ipfs

Execute from the command line:

ipfs init

Ipfs initialization is complete. Ipfs generates a node ID: QmceWUYdX5xjE5zVA3bW1rt4Kq326bm83hRxAkPRe3QWR8, everyone’s computer execution results would be different, that string string means you run a ipfs node.

To view the installation, run the following command:

ipfs cat /ipfs/QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv/readme

You should see the following screen:

To learn more about ipFS commands, run the following command:

ipfs cat /ipfs/QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG/quick-start

Or visit this page: ipfs.io/docs/comman…

4. The node goes online

Execute command:

ipfs daemon

We get the following output:

Congratulations, your IPFS nodes are online, check your nodes are linked to those nodes.

Open a new command line window and execute the following command:

ipfs swarm peers

You can see output similar to the following, congratulations, you can see that your node is connected to other IPFS nodes so far.

Upload and download

Note: Don’t upload private files. You don’t want your photos to stay with the IFPS network for life, do you? Xiaobian is planning to write an article about personal privacy protection under IFPS.

The PFS core software provides two modes: command line and Web.

The command line

  • Command line: Downloadperform

ipfs cat /ipfs/your_hash > init.jpg ipfs cat /ipfs/your_hash

Such as:

ipfs cat /ipfs/QmdDTor6dWzknFJPJuhJgrUYqd56WkFXYAxyxpEY7kUrEb > init.jpg

This hash value is the image that xiaobian uploaded in the article “What is IPFS?(3)” on December 8. If you are interested, you can download it and have a look.

  • Command line: Upload

Perform:

ipfs add init.jpg

tt-3:go-ipfs tt$ ipfs add init.jpg
added QmdDTor6dWzknFJPJuhJgrUYqd56WkFXYAxyxpEY7kUrEb init.jpg
Copy the code

When you upload a file to the IPFS network, IPFS add returns a hash value that is the address of the file on the IPFS network.

Web:

Open a browser, type http://localhost:5001/webui in the browser, you can link to your node, interface is as follows:

This is the basic information of the node that xiaobian runs:

As you can see from the picture below, xiaobian’s machine has been connected to 385 nodes in the world. From the earth on the left, China doesn’t have many nodes in operation. Most nodes are in Europe and the US.

Then click the Files menu on the left of the interface, and you can see Select Files on the right, which is the function of uploading Files provided by the Web interface. Just Select the file and click Upload.

If you don’t see it, just refresh the page. Don’t shut down your node immediately. Give some time for other nodes to cache your file. Once caching is complete, this file will be perpetuated with the IPFS network.

IO /ipfs/ your hash value will see your file, for example: ipfs. IO /ipfs/QmTYrY…

You should now be able to run IPFS nodes and learn basic file uploads and downloads.

If you want to upload a memorable file to IPFS (like a wish to your girlfriend), you can leave a comment on the background and I’m happy to help you out: remember, IPFS files are permanent.


Related articles and videos recommended

[Dong Tianyi] IPFS: The world is quietly changing

Yuan Yuan Institute brings together a large number of blockchain masters to create high-quality blockchain technology courses. There are high quality free public courses on all major platforms for a long time, welcome to sign up and watch.

Open course address: ke.qq.com/course/3451…