Filecoin is a decentralized storage network on top of IPFS.
Filecoin introduces the concept of decentralized storage network (DSN). DSN is a scheme that describes a network of independent clients and storage providers. The users are coordinated with each other in a trustless way. DSN involves the implementation of three functions: put, get, and manage. Put allows clients to store data under unique identifiers. Get allows clients to retrieve data using the identifier. Manage orchestrates the network by measuring space available for rent, auditing providers, and repairing possible data faults.
DSN has several properties. Two required properties are data integrity and retrievability. Data integrity means that client always receives the same data that he puts to storage, and storage providers can’t convince a client to take faulty data. Retrievability simply means that client will be able to retrieve his data over time.
DSN can also provide several optional properties: public verifiability, auditability, and incentive-compatibility. Public verifiability allows everyone on the network to verify that the data is being stored without knowing the data itself. Auditability allows verifying that the data was stored for the right duration of time. Incentive-compatibility strives to reward good service providers and punish bad ones.
There are 4 groups of users in Filecoin: clients, storage miners, retrieval miners, and the network.
Clients pay to store and retrieve data. They can choose from the available service providers. If they want to store the private data, they need to encrypt it before submitting to the providers.
Storage miners store client’s data for the reward. They decide how much space they are willing to reserve for storage. After the client and storage miner agree on the deal, the miner is obliged to continuously provide proofs that he stores the data. Everyone can look at the proofs and make sure that the storage miner is reliable.
Retrieval miners provide client’s data at their request. They can get the data either from clients or storage miners. Retrieval miners and clients exchange data and coins using micropayments: the data is split into pieces and clients pay a small number of coins for each piece. Retrieval miner can also work as a storage miner.
Finally, network represents all full nodes that validate the actions of clients and miners. These nodes count the available storage, check the storage proofs, and repair data faults.
Users share their intentions by making orders. Clients submit bid orders, specifying the price they want to pay. Miners submit ask orders, specifying the price they want to receive. When bid and ask orders match, client and miner both sign a deal order and submit it to the blockchain.
Bid and ask orders together form Storage Market and Retrieval Market.
Storage Market is a decentralized exchange run by the Network, where all asks and bids are stored in the blockchain. Both parties have to commit to their resources. Clients must deposit the coins specified in the order. Storage Miners must pledge the collateral proportional to the storage they are going to provide. After the deal order is signed, miners should regularly provide the proofs of storage that can be audited by the network. If the miner fails to provide a proof, he is penalized. If the miner entirely stops to provide proofs, the network decides that the miner is faulty. If the client loses data during this process, he gets refunded.
Retrieval Market is an off-chain exchange where clients and retrieval miners discover each other in a peer-to-peer way. Once the client and miner agree on the price, they start to exchange data and coins piece by piece using micropayments.
To make the act of storage publicly verifiable, Filecoin introduces two consensus algorithms: Proof-of-Replication (PoRep) and Proof-of-Spacetime (PoSt).
The idea behind Proof-of-Replication is to mitigate Sybil Attacks by proving that the data was replicated into several physically independent copies. For each replica, Storage Miner should provide individual proof. Miner can’t create fake proofs using the single replica, because the creation of proof also requires the creation of a replica, which is a time-consuming task.
The goal of the Proof-of-Spacetime is to require Storage Miner to continuously provide proofs of storage to the client and to the network. The miner generates a series of proofs and then submits it to the network.
PoSt is then used to assign voting power to each miner. The voting power works similar to the stake in PoS systems. The more space Storage Miner rents, the more power he has in Filecoin. At each round, one of the miners is elected to make the next block, where the probability of election is directly proportional to the voting power of the miner.
Filecoin plans to introduce smart contracts to the system. There will be two types of smart contracts. First, there will be generic smart contracts that work similar to implementations in other cryptocurrencies. Second, there will be File Contracts, which are storage-aware contracts. These file contracts can largely extend use cases for renting storage and making applications that have access to the decentralized storage.