[IPFS Encyclopedia] Filecoin's technical background

Filecoin's vision is to provide network-wide data storage and retrieval services through a blockchain with an incentive mechanism to reduce the cost of data storage and use. Since it is a blockchain, it also needs a consensus mechanism, that is, it needs to answer "How are the blocks of the Filecoin blockchain generated". V | czdn222

The well-known proof of work (POW) consensus mechanism requires miners to rely on the computing power of the machine to continuously perform hash calculations. Whoever can solve the answer to the problem in a short period of time is eligible to generate the next block. That is, the probability of miners generating blocks is theoretically proportional to the computing power of the machine, which gives birth to professional mining machines. However, the only function of this hash calculation is to provide network security without any other contribution, which is why POW is criticized for consuming resources.

The "computing power" in Filecoin not only provides protection for network security, but also provides functional guarantees for the system. The "computing power" in Filecoin is called storage computing power. To put it bluntly, if miners store more data for the network, they have more storage computing power. Then in the next round of competition for accounting rights It is even more advantageous. It can be seen that miners with large computing power not only protect the stability of the system at the security level, but also store data for users and provide functional guarantees.

Insert picture description here

Unlike POW, which continuously calculates the hash, although the calculation of the hash requires a long time to try, once the calculation is successful, the result of the calculation is easy to verify. In other words, miners can verify a block in a short time. But Filecoin's storage power is not the case. This indicator refers to how much data miners store on local disks. This is something that other miners cannot verify with their own eyes. Therefore, Filecoin's consensus mechanism must confirm at least two things:

  1. Whether the data that the miner claims to store is actually stored on its disk;

  2. The miner claims whether the stored data has been stored on its disk before expiration.

In order to confirm these two problems, Filecoin proposed two mechanisms: Proof-of-Replicaton and Proof-of-Spacetime.

The core idea of ​​proof of replication is that miner P can submit a PoRep proof to the entire network to verify that he does have a data backup on his storage device, and other miners can verify it more quickly. However, miners may launch malicious attacks. For example, a malicious miner claims to the entire network that he has saved n copies of data, but in fact the miner creates multiple nodes or shares data through multiple miners. Only one backup of this data is saved. When it is necessary to initiate a certification to the entire network, use a backup to complete all inspections. In this way, users who spend money to purchase redundant backups lack data security protection, and malicious miners use one storage space to earn n shares of the price. It can be seen that the key lies in the design of the PoRep consensus algorithm.

After research, the PoRep consensus algorithm needs to meet the following requirements: 1 The miner needs to perform an encryption operation when storing data, which should not be parallel and takes a long time; 2 When extracting data, decrypt the data The operation should take a short time;

3 The process of generating PoRep proofs through encrypted data should be fast; 4 The verification process of PoRep proofs should be fast.

For Requirement 1, this is to increase the time cost of data storage by miners. Subsequent operations such as generating proofs are based on encrypted data. This makes it impossible for malicious miners to temporarily generate encrypted data to generate it within the valid time. prove. The second requirement is that when files need to be extracted, it will not cause large computational resource overhead, otherwise the cost of the Filecoin system will be very high. For requirements three and four, it is because the miner needs to generate the PoRep proof within the specified time. If the miner has spent a long time encrypting and saving the stored data as required, the time for generating the proof should be shorter. Ensure that miners can prove their storage within the specified time. Of course, other miners should also verify the proof quickly to ensure that the system continues to run as told.

It can be seen that the proof of replication PoRep ensures that the miner does store a certain piece of data at a certain moment. However, there is no guarantee that the miners will store the data in accordance with user requirements for a period of time. For example, the data will be discarded after the PoRep certificate is generated. This is the problem solved by the proof of time and space PoSt. In simple terms, PoSt requires storage miners to generate proofs every certain period of time, which requires miners to generate a series of PoRep proofs to determine the time interval.

To sum up, PoRep is a time point proof that proves that the miner stored the file as required at that moment, and PoSt is a time interval proof that proves that the miner actually stored the file during the time period.

4 How to mine Filecoin

The Filecoin test network Lotus has been released. According to the official statement, Lotus is an experimental implementation of Filecoin, independent of the mainnet's go-Filecoin code. But Lotus has also implemented a series of functions such as wallet, miner, PoRep, and PoSt. To put it more bluntly, Lotus is an experimental product of Filecoin, and go-Filecoin is the complete realization of the final mainnet.

According to the official deployment document, a machine with the minimum hardware configuration in the Lotus test network also needs at least: 2TB of hard disk space, 8-core CPU, and 128G of memory. Although such hardware standards may be revised as the code is iterated, it discourages the majority of civilian miners. But a feasible way is to combine some cheap devices by deploying clusters to provide similar effects. There are few cases related to cluster deployment in the industry now, and we are gradually trying! V | czdn222

Guess you like

Origin blog.csdn.net/weixin_49795899/article/details/113936430