# IPFS and Filecoin
Filecoin and IPFS are complementary protocols for storing and sharing data in the distributed web. Both systems are free, open-source, and share many building blocks, including data representation formats (IPLD) and network communication protocols (libp2p). While interacting with IPFS does not require using Filecoin, all Filecoin nodes are IPFS nodes under the hood, and can connect to and fetch IPLD-formatted data from other IPFS nodes using libp2p. However, Filecoin nodes don't join or participate in the public IPFS DHT.
This page aims to explain the relationship between the IPFS and Filecoin projects and help users decide which option is best suited for their use-case.
# Data storage incentives
IPFS (opens new window) allows users to store and transfer verifiable, content-addressed data in a peer-to-peer network. IPFS users persist the data they want on their own IPFS nodes. This is referred as pinning (opens new window). Sometimes the data may be pinned using a third-party pinning service, or through groups of individual IPFS users. The data exists in the network as long as one user is storing it and able to provide it to others when they request it.
IPFS does not include a built-in mechanism to incentivize the storage of data for other people. This is the challenge Filecoin hopes to solve. The Filecoin network creates a distributed storage marketplace for long-term storage. Nodes with a large storage capacity can rent storage to users with and get paid for it.
The Filecoin network ensures that data is safely stored. However, the processes of storing (sealing), verifying (proving) and unsealing (for retrieval) are computationally expensive and can take time. This is specially relevant for the retrieval of data, which should happen as fast as possible. For this reason, Filecoin enables an additional retrieval market where dedicated nodes can help quickly deliver content from the network for a payment by keeping unsealed, cached copies. This delivery mechanism may make use of IPFS.
Filecoin can be seen as a cold storage layer, perfect to safely store large batches of data. IPFS would be the hot storage layer, designed for the quick retrieval and distribution of content.
# Which system should I use?
# Using IPFS
- Data provided by user's own nodes. Otherwise must rely on other peers to voluntarily/altruistically storing data or on a centralized pinning service.
- Centralized IPFS pinning services must be trusted to do their job. IPFS brings no built-in provisions to verify that data is being stored and correctly provided by the pinning service.
- IPFS by itself works very well for popular content (with many providers), for organizations where there are incentives to sync and store data in multiple nodes and for situation where strong social contracts can be used to ensure the content remains hosted and maintained long-term.
# Using Filecoin
- Clients make storage deals with miners to store data. The network verifies that the miners are correctly storing the data. Small payments are made on a regular basis for the duration of the storage deal.
- Miners that do not honor the storage deal are penalised.
- Content retrieval might be offered by storage miners directly, or by specialized retrieval miners. The user requesting the data pays for this service.
- Filecoin excels at storing large amounts of data for long periods of time.
# Using both
Some solutions combine the best of the two systems, backing up data on the Filecoin network and at the same time providing the data through the IPFS network. This ensures that data is constantly available and can be retrieved quickly, while also making sure that the data is safely backed up on the Filecoin network. Powergate is a multitiered file storage API built on Filecoin and IPFS, and an index builder for Filecoin data.
# The technology behind IPFS and Filecoin
Filecoin and IPFS are powered by the same technology at many levels:
- IPLD (opens new window) specifies data formats for content-addressed data like the blockchain or the way in which IPFS stores files.
- libp2p (opens new window) provides peer-to-peer network capabilities, connection security and key discovery and data distribution features like the DHT and Pubsub.
- Multiformats (opens new window) define future-proof identifiers and data-types.
- Graphsync (opens new window) and Bitswap (opens new window) enable fast and efficient IPLD data transfers between nodes.
Interested in learning more? Check some of our application examples.