Back to blog

Exploring IPFS: The Peer-to-Peer Layer vs. Gateways

Exploring IPFS: The Peer-to-Peer Layer vs. Gateways

Justin Hunter

Picture this. You’re on your computer, you go to domain.com/dog expecting to see a picture of a puppy, and what actually loads is a picture of a table. Unless you’re a table aficionado, you’re probably going to be pretty disappointed by this result.  We can likely all agree that there’s a wave of disappointment you feel when you go to a website expecting to see something very specific and get something entirely different in return. In a world of ambiguity and internet trust issues enters IPFS, the peer-to-peer layer we’re talking about, works to solve this exact problem. Ensuring you get exactly what you want to see, every time you want to see it, the peer-to-peer layer has allowed for a more reliable and efficient internet.

What exactly is the IPFS Peer-to-Peer Layer?

When a user requests content, the P2P layer facilitates a collective inquiry among peers, where each responds with either the availability or absence of the desired content. IPFS distinguishes itself through the Content Addressable File System, ensuring content retrieval is tied to a unique Content Identifier (CID).

This novel approach enhances content immutability, preventing the mutable practices found in traditional web infrastructure. Going back to our example up top, with the traditional web being all about location-based addresses, meaning, when you upload a file to a traditional server bucket, you serve that file via a specific URL, there’s always some ambiguity. Someone can load content through the URL, claim you’re going to see one thing and give you something entirely different. But, in contrast to the domain.com/dog example, IPFS (the P2P layer) would assign a CID to the content, removing all ambiguity and creating a more trustworthy and reliable space.  

What is an IPFS Gateway?

Gateways act as bridges between the IPFS network and the traditional web, providing a simplified interface for users. Essentially, a gateway is an HTTP abstraction over an IPFS node, enabling users to access IPFS content without running their own node. When a user queries a gateway with a specific CID, it performs the necessary operations on the P2P layer to retrieve the content and present it to the user. Gateways abstract the complexity of interacting with the P2P layer, offering an easy entry point for those not familiar with IPFS intricacies.

IPFS P2P Layers and IPFS Gateways Working in Tandem

The P2P layer and gateways are complementary components within the IPFS ecosystem. While the P2P layer facilitates communication and content exchange among IPFS nodes, gateways provide a user-friendly interface for content retrieval. In the context of pinning, both the P2P layer and gateways can be involved, but typically, the P2P layer is more associated with content retrieval and communication among nodes. The gateways play an integral part in the process, by being the transportation mode for content to travel back and forth between IPFS.

Use Cases for the IPFS P2P Layer

The P2P layer finds relevance in scenarios where users run their own IPFS nodes, pin content, and actively participate in the IPFS network. This approach is suitable for those who need to serve content via the p2p layer of the IPFS network, such as developers or applications.

Use Cases for IPFS Gateways

Gateways are ideal for users who want to leverage IPFS without delving into the complexities of running their own nodes. By simply accessing a gateway URL, users can upload and retrieve IPFS content seamlessly. Gateways serve as convenient entry points for individuals or organizations interested in the benefits of IPFS without the need for extensive technical knowledge or infrastructure management. When you layer in the performance benefits and access controls of Dedicated Gateways, using a gateway can become an attractive proposition.

If you’re looking for a way to leverage gateways and the P2P layer without running your own infrastructure, or are looking for a way to add speed and resilience that helps augment your existing IPFS infrastructure, Pinata makes it easy for you to do so. It can be as straightforward or complex as you’d like, allowing you to upload via the web app or utilize our API and SDK for more scalable, customizable needs.

Subscribe to paid plan image

Share this post:

Stay up to date

Join our newsletter for the latest stories & product updates from the Pinata community.