caizhiguang is a programmer

IPFS PYTHON API Reference Manual:

IPFS CLI Manual (Chinese version):

IPFS Installation and Basic Operations (Storage Directory):

  1. Introduction

1: InterPlanetary File System (IPFS). IPFS is a distributed web, peer-to-peer hypermedia protocol. It can make our internet faster, more secure, and more open. IPFS is actually a distributed file system.

2: The internet is based on the HTTP protocol, which is centralized, inefficient, and costly. Using the HTTP protocol requires downloading complete files (web pages, videos, images, etc.) from centralized servers, which is slow and inefficient. IPFS uses a P2P approach based on content addressing (rather than domain addressing), where files (content encrypted hash values) have unique existence, greatly reducing the redundancy of file storage. This can save a lot of bandwidth. Files are also divided into small blocks and downloaded from multiple servers simultaneously, which is very fast. IPFS runs a blockchain on the network to store a hash table of internet files, and each time there is network access, it checks the address of the content (file) on the chain.

3: Web files are often deleted. Web files on HTTP pages are often deleted (due to high storage costs) and cannot be permanently saved. Therefore, it is common to encounter 404 errors when trying to access bookmarked URLs. IPFS files can be permanently stored on multiple nodes and provide a version history feature for files (similar to the git version control tool), making it easy to view the history of files.

4: Our existing internet is a highly centralized network. IPFS, on the other hand, is a decentralized network that can overcome some of the drawbacks of the web (such as high dependence on the internet backbone, internet censorship, control, monitoring, and centralized server downtime).

  1. Significance of IPFS Applications

It can bring a certain degree of freedom to content creation.
Representative application: Akasha Akasha ( is a social blogging platform based on Ethereum and IPFS. The blog content created by users is published through an IPFS network instead of a central server. At the same time, users can bind their Ethereum wallet accounts and reward high-quality content with ETH, allowing content creators to earn ETH, similar to mining with the human brain. It has few regulatory restrictions and no intermediaries taking a cut, and content revenue goes directly to the creators.

It can reduce storage and bandwidth costs.
Representative application: Dtube Dtube ( is a decentralized video playback platform built on Steemit. The videos uploaded by users are stored using the IPFS protocol and have a unique identifier. Compared to traditional video websites, it reduces redundancy of the same resources and saves a significant amount of bandwidth costs incurred by users when playing videos.

It can be perfectly integrated with blockchain.
Representative application: EOS IPFS technology is currently seen as a transitional solution to solve storage bottlenecks, and EOS is the most typical application. EOS is proud to support a concurrency of millions of TPS, thanks not only to the DPOS consensus mechanism but also to its underlying storage design that uses IPFS to solve the efficiency of large-scale data transmission. EOS packages its own block data and performs heterogeneous processing using IPLD, unifying it into a convenient data structure type for content addressing and mounting it on an IPFS link. This allows the IPFS network to handle storage and P2P retrieval logic without consuming too many computing resources of the EOS blockchain system. It can provide a distributed caching solution for traditional applications.

  1. Environment Setup

1: Download and install the latest go-ipfs corresponding to the official website (
Installation (for convenience, install the precompiled binary ipfs first)

Download the latest (compiled) package#



tar -zxf go-ipfs_v0.6.0_linux-amd64.tar.gz


cd go-ipfs
sudo ./install


which ipfs
ipfs --help
ipfs version

Configure and run ipfs#

Initialize the node by executing ipfs init in the command line#

$ ipfs init

By default, initialization will create a .ipfs directory in your user directory and generate your node ID, such as QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv#

$ export IPFS_PATH=/ipfs

vim /lib/systemd/system/ipfs.service#

Add: Environment=export IPFS_PATH=/ipfs # Set IPFS directory

Modify the default IPFS directory, and now we will put the directory under /ipfs

Check the installation status#

$ ipfs cat /ipfs/QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv/readme

Start the daemon to bring the ipfs node online#

$ ipfs daemon

View connected ipfs peers#

$ ipfs swarm peers

  1. Upload and Download
    IPFS provides two ways to operate on files:
  1. Weiui method
    You can enter the host where ipfs daemon is located and enter localhost:5001/ipfs/webui in the browser to access the browser file operation page and add files.

  2. Command line method

Create a new file 1.txt with the content "123456789"#

Upload 1.txt#

ipfs add 1.txt

Returns the file hash value, which can be used to find this file#

View 1.txt using the hash#

ipfs cat file hash value

Download 1.txt to the current directory, with the default file name as the hash value#

ipfs get file hash value

Upload an image#

$ ipfs add ly.jpg

Download an image#

$ ipfs cmp /ipfs/QmaYQaCwxg8pK9Z5QQC8vrb1hdBC5nV8YFGwGNVNQ3fWka > after.jpg

Compare with the original image, which is the file uploaded earlier#

$ cmp ly.jpg after.jpg

You can also directly view it in the browser on the machine where ipfs daemon is deployed:#

Build a static website on IPFS#

Upload the website directory#

cd D:\Works\ipfs_file
ipfs add -r ipfs-qkw
The last part of the returned information, the hash QmNpRuzmmucd5sDoC7fjfZRgo2mnaXb35hpsLQf77A96xu, is the entry point for accessing the website.

Use the ipfs cat command, followed by the file path. The operation is as follows:
ipfs cat QmNmGoyiFpaHx1tra4zNL2iZHAfj8JM7gETjk2hZWVGWXi/ipfs-tutorial/new/newfile

  1. Common Commands

  2. JS HTTP client library

USE HTTP API reference

  1. IPFS Movie Resources
    Secret Superstar: QmWBbKvLhVnkryKG6F5YdkcnoVahwD7Qi3CeJeZgM6Tq68
    Youth: QmYVri7jyBdPyfR8AgBLTgyTjiJifCgpeHFiFrKxowQeq8
    Dahufa: QmdpR9iP9EhUg1rmduHqwA4ddyHNMcsR8t9saXA9BmMU4t
    The Invisible Guest: QmYWwXkgjdhMps9mB6DyEp4zSFmDQ9U6SuqGRGovEycr49
    Dying to Survive: QmZRJevYhADpXmCGGF6eCcP1afNEYFahDW5jxje3iyyCJS
    Darkest Hour: QmUPvs7iyM5ZWPQwDovRqvNzxMJHSUWNRWAWRkAsseVcvs
    Blade Runner 2049: QmcUHdzKgRrcJrD5Ah46HgBHF7urWDhmAnLKYwcHaLgeGP
    Inception: QmQATmpxXvSiQgt9c9idz9k3S3gQnh7wYj4DbdMQ9VGyLh
    The Lion King: QmfHGQZNQNymHDC6b7TZjgGbh962VWQQN5oV92w9jHE4qt
    The Grand Grandmaster: QmbrwEH4AEQhUN929yPy4j5B2PfQYk3JJyG8iq7HVoXbia
    Zootopia: QmUKaQwN2ppapUEFhbHsKoVXn2yBRM7mLpu5HQv9am7dB7
    Painted Skin: QmXg1c6qPtoQAyfrXrWnuDrUgFehnt4kLvv1hxheMUeFBC
    The Shawshank Redemption: QmRUYeMkvirV4frGX8wcntCq6x5GqDixAjZnFj5Jg1E3qj
    Passengers: QmdxpUVnvFnert9nmEkzwwz2tWdavU3fUQzrgBsTZP5yyG

IPFS video player:

Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.