# 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 usually persist the data they want on their own IPFS nodes. This is called pinning (opens new window). Sometimes the data may be pinned using a third-party pinning service or through groups of individual IPFS users (like IPFS Collaborative Clusters (opens new window)). The data exists in the network as long as one user is storing it and can provide it to others when they request it.
IPFS alone does not include a built-in mechanism to incentivize the storage of data for other people. This is the challenge Filecoin aims to solve. Filecoin is built on IPFS to create a distributed storage marketplace for long-term storage. Nodes with a large storage capacity can rent their storage to users and get paid for it.
The Filecoin network ensures that data is safely stored. However, the processes of storing, verifying, and unsealing (referred to as sealing, proving, and retrieving, respectively) are computationally expensive and can take time. This is especially 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 payment by keeping unsealed, cached copies. This delivery mechanism may make use of IPFS but is still in design. See ResNetLab's Decentralized Data Delivery Market research (opens new window) for more information on delivery mechanisms.
Filecoin aims to add longer-term persistence to safely store large batches of data, while IPFS optimizes for the quick retrieval and distribution of content.
# Using IPFS and Filecoin
# Content addressing with IPFS
IPFS is great for getting started using content addressing for all sorts of distributed web applications. In the majority of these cases:
- Data is provided by the 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.
- Popular content is more easily accessible. Popular content (with many providers) naturally becomes faster/easier to retrieve in IPFS, which is great when there are external 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.
# Data persistence with Filecoin
Filecoin builds on the content addressing of IPFS to add longer term data persistence using cryptoeconomic incentives. With 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 IPFS and Filecoin together
Many solutions combine the two networks to get the best of both worlds: IPFS for content addressing & data discovery, and Filecoin for longer-term persistence. To achieve this, services like Powergate back up data on the Filecoin network while also ensuring content is discoverable in the IPFS Public DHT. Data is constantly available and can be retrieved quickly, while also making sure that it is safely and verifiably backed up on the Filecoin network over time.
# 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.