Editors Note: This article comes fromimToken(ID:imToken), reprinted by Odaily with authorization.
Editors Note: This article comes from
secondary title
What is IPFS
The full name of IPFS is InterPlanetary File System, which translates to Interplanetary File System in Chinese. IPFS is not a blockchain project, but an underlying network transmission protocol. Juan Benet, the proposer of the protocol, saw the flaws of the current Internet HTTP protocol, so he proposed IPFS in May 2014, with the aim of creating a more open and secure next-generation Internet Web3.0.
Juan Benet, Proposer of IPFS
centralized
So whats wrong with the HTTP protocol of the current Internet?
centralized
high cost
secondary title
1. Centralization
The HTTP protocol is extremely dependent on the centralized service network, and the server must be turned on and running 24 hours a day.
image description
The worlds first web server
👆This is a computer used by Tim Berners-Lee when he worked at CERN CERN. It is also the worlds first web server that follows the HTTP protocol. It has been eliminated and stored in the museum. There is a note on the case:
This machine is a server. Do not power down! (This is a server, do not power down!)
When we enter the URL in the browser, the browser will retrieve information from the server based on the URL and return it to the client, which is what our ordinary users see. Once the server is shut down, the browser cannot retrieve relevant information, so we will see the 404 interface of the web page.
On March 3, 2019, Alibaba Clouds servers in North China were down for 3 hours, and many Internet companies that rented the service were paralyzed.
Gangnam Style
secondary title
image description
Remember Gangnam Style, this song was all the rage in 2012, and it was the first video with more than 1 billion hits in the history of the Internet (although I still dont understand why this song is so good😓). If the video is 100 MB in size, 1 billion views consumes 100 PB of network traffic.
Assuming the cost per GB of traffic (including network bandwidth and server storage) is $0.01, the total cost is $1 million. In addition, centralized data services have low utilization efficiency of resources. For example, the centralized model requires each data center to operate continuously for 365 days. Industry reports show that power consumption alone accounts for 57% of operating costs. It can be seen that on the HTTP protocol, the cost of centralizing information dissemination from the data center to the outside is very expensive.
secondary title
The National Security Agency of the United States has signed the Cyber Security Agreement with a number of telecommunications companies, stipulating that telecommunications companies must establish network operation centers in the United States. At the same time, U.S. allies such as the U.K. and Canada also provided it with cable surveillance intelligence. According to the Washington Post, the US National Security Agency (NSA) monitors submarine cables covering 27 countries and regions on 4 continents.
Edward Snowden
image description
Edward Snowden
Seeing the many flaws of the HTTP protocol, Juan Benet proposed the idea of IPFS, and established Protocol Labs in 2015, which is responsible for the development of IPFS.
secondary title
How IPFS works
1. Unique identification through content addressing
2. Protect document privacy through asymmetric encryption
3. Accelerate file transfer speed through peer-to-peer transfer
1. Content addressing
The HTTP protocol is based on domain name addressing. The browser will obtain the file from the specified server according to the URL we entered, while IPFS is based on content addressing. IPFS will hash the file to get a hash value starting with Qm, and we can retrieve the corresponding file by providing the hash value.
What is the specific difference between the two?
QmYqSCWuzG8Cyo4MFQzqKcC14ct4ybAWyrAc9qzdJaFYTL
For example, I want to download a file through a browser. According to the HTTP protocol, the browser will first find the location of the server, that is, the domain name addressing, and then ask the server for the path of the file. The location of the file in this system is up to the administrator of the server, and I can only hope that the location of the file has not changed and the server is powered on.
In addition, when downloading a file, I cannot be sure whether the file downloaded by the client is consistent with the file on the server. The file may be tampered with during the download and transmission process, but I cannot perceive it.The IPFS approach is to ignore the specific location of the server and the file, and only focus on the content of the file. When I put a file on an IPFS node, it will calculate a string of hash values starting with Qm based on the content of the file, such as this 👇The hash algorithm mathematically ensures that even if only one punctuation is modified in the content of the document, the hash value will be completely different. Each piece of content stored on the chain will be assigned a unique hash value as a content identifier (Content Identifier, CID for short).
But there is a privacy issue. Anyone who knows the hash value can download my file through the IPFS network?
Then you need to use asymmetric encryption technology
, its time to invite Bob and Alice, the heroes and heroines of cryptography again.
2. Asymmetric encryption
Sender: Bob 🚹, Receiver: Alice 🚺
1. Bob wants to upload a document to IPFS, and only Alice can view the document
2. Bob encrypts the document with Alices public key
3. Bob uploads the encrypted document to IPFS, and obtains the corresponding hash value as the content identifier
4. The encrypted document is stored in the IPFS system, and Alice can download the document with the hash value provided by Bob
5. Alice decrypts the document with her private key and obtains the contents of the document
6. Since an unauthorized third party does not have Alices private key, it cannot decrypt the document even if it is downloaded.
The process of Alice downloading files through IPFS is similar to downloading movies through Thunder, which is based on P2P peer-to-peer transmission technology.
3. Point-to-point transmission
If you have read the Bitcoin white paper, the term peer-to-peer should sound familiar, because the title of its white paper is Bitcoin, a peer-to-peer electronic cash system
Peer-to-peer is a Chinese translation based on Peer-to-Peer, referred to as P2P. The English word Peer has a common meaning in the dictionary, which means people with the same identity or status.
In the HTTP protocol, the client needs to access the server when it wants to obtain information. If the number of server visits increases sharply in a short period of time, the access will fail. You can think of the ticket booking platform when you go home to grab a train ticket. downtime scenarios. Distributed denial of service attack DDoS is to use hundreds or even thousands of devices to initiate requests to the server in a short period of time, exhausting the resources of the server and causing other users to be unable to access the website normally.
The point-to-point transmission technology adopted by IPFS, a point refers to a computer. Any computer in the system can be used as a server to share files with each other, such as Xunlei, eMule, and KuGou all use P2P technology to share resources among each other.
When downloading documents according to the HTTP protocol, multiple computers such as B, C, and D must access server A for downloading. If there are too many visits, server A will crash. The point-to-point transmission technology can make B download from A, B becomes a server after downloading, and C can download from A and B. C also becomes a server after downloading, and D can download files from A, B, and C, and each computer with files can be used as a server to provide information to other download users.
Therefore, the further you go to the back, the more computers that can be used as servers, and the faster the download speed. At this time, the status among multiple computers such as A, B, C, and D is equal, and they can all be used as servers. In principle, Alice can download documents faster via IPFS than the traditional HTTP protocol.
But there is a problem here. Why do computers such as A, B, C, and D provide resource downloads for other computers in vain without any rewards? Economic incentives for Filecoin are necessary.
secondary titleThe relationship between IPFS and FilecoinIn 2017, Protocol Labs announced the establishment of Filecoin, an IPFS-based blockchain project. Although both Filecoin and IPFS were created by Protocol Labs, Filecoin is not equivalent to IPFS. IPFS is an underlying protocol, and Filecoin is an economic incentive layer built on it. By issuing token FIL as a reward, each node has the motivation to store and Retrieve data.
When users want to upload files to the IPFS network or download files in the network, they need
Pay with Filecoin
Give miners money for their toil. The total circulation of the native token FIL of the Filecoin network is 2 billion pieces, 70% of which will be allocated to miners.