How Much Does A Gateway?

Breaking down Cloudflare’s surprise announcement

Pinata
Pinata
4 min readSep 19, 2018

--

Look at that! Cloudflare’s recent announcement about their own IPFS gateway is huge for the IPFS community. This post starts by anthropomorphizing IPFS nodes then breaks down why this announcement is so important.

How Content Moves Around on IPFS

When somebody wants to retrieve content from IPFS, the IPFS node they’re connected to sends out a request to the IPFS network. This happens using Distributed Hash Tables (DHT). Imagine the requesting node yelling at all of its friends and asking, “Hey, does anybody know where to find this content?” There’s a good chance that none of them do. But, maybe one of their friends does. So, each of these nodes asks the other nodes they’re connected to and repeat the process until one node eventually says, “I know a node that has that content!” At this point, the requesting node links up with this newly found node and downloads the desired content from it. However, a problem arises when you realize that most nodes in the IPFS network are extremely separated from nodes that may be requesting their content. This makes node discovery slow and, therefore, content retrieval slow.

Gateways Make Content Discovery Faster

Every public gateway brought online to the IPFS network adds another “link” to the nodes on the rest of the network. As public gateways are more frequently used to retrieve content, their knowledge of other nodes and where to find content tends to be greater than a typical node. Because of how “high profile” these public gateways are in the IPFS network, these gateways also know of other public gateways. Here’s a quick visualization of how this makes content discovery faster.

Top-notch drawing by Matt Ober

In the visualization above, imagine the first “Public Gateway” is Pinata’s IPFS gateway, and “Public Gateway #2” is Cloudflare’s new gateway. In Scenario #1, the requesting node has to go through 5 nodes before reaching a node with the content it’s requesting. However, in Scenario #2, the requesting node only has to go through the two gateways before finding the content it desires. In practice, this is slightly more complex, but hopefully that gives an idea of what’s happening behind the scenes.

Improvements to the IPFS Network

From Cloudflare’s initial announcement, it seems that they currently have one official gateway. But, it is easy to figure out that Cloudflare is in a lot of places all around the world (152 at the time of writing this). If Cloudflare throws up an IPFS gateway in each of these 152 locations, content delivery gets even faster.

(If anybody from Cloudflare can provide more insight into how your gateway is set up, please let us know so we can update this post.)

Using special IPFS node configurations, Cloudflare can even set up these gateways to “bootstrap” connect to each of the other gateways. So, even though these gateways may reside across continents, they maintain contact with each other. Such a set up would allow cross-world communication where nodes all essentially have “shortcuts” to knowing where content resides globally.

Simplified version of a node requesting content through a network of gateways

End to End Integrity

In addition to spinning up a gateway, Cloudflare forked the go-ipfs repository and created improvements which allow for users running a browser extention to cryptographically verify that they’re receiving exactly what they ask for from the IPFS network. These security improvements are incredibly welcome and we hope to see them officially implemented in IPFS in the future. If you’re curious about how this works technically, Cloudflare has an excellent writeup on what they’ve built.

Summary

Often times, large industry players entering a space can spell trouble for the little guys. However Cloudflare’s entry into IPFS looks to be very positive for the technology as a whole. The added IPFS infrastructure boost and security improvements are thing Pinata welcomes with open arms. Most importantly, we’re excited about the industry validation that comes with Cloudflare’s announcement. IPFS brings with it a new paradigm in how content is distributed and stored on the web. Cloudflare embracing IPFS as a technology bodes well for the future of IPFS as a whole.

Reach out to us at team@pinata.cloud if you want to learn more about IPFS or check out pinata.cloud!

--

--