All Collections
Gateways
Token URIs in NFT Projects
Token URIs in NFT Projects

Difference between ipfs:// and https://gateway

Steve Simkins avatar
Written by Steve Simkins
Updated over a week ago

Introduction

When you are making an NFT project, one of the decisions you have to make is whether or not to use a gateway URL in the metadata and/or token uri.

For context, an NFT is simply a token that points to a piece of metadata that is hosted off chain. In this case that would be IPFS. When you're in the process of making an NFT, the typical flow is:

  1. Upload the assets to the the CID

  2. Put the CID in the metadata file

  3. Upload the metadata file to get the CID

  4. Use the metadata CID in the NFT

The question is though, when you are referencing the image or metadata CID, should you use:

  1. A standard IPFS uri ipfs://QmRAuxeMnsjPsbwW8LkKtk6Nh6MoqTvyKwP3zwuwJnB2yP

  2. A public IPFS gateway url https://gateway.pinata.cloud/ipfs/QmRAuxeMnsjPsbwW8LkKtk6Nh6MoqTvyKwP3zwuwJnB2yP

  3. A dedicated gateway url https://pinnieblog.mypinata.cloud/ipfs/QmRAuxeMnsjPsbwW8LkKtk6Nh6MoqTvyKwP3zwuwJnB2yP

There are benefits and problems with each one, so let's go over each option!

Standard IPFS URL

A standard IPFS url looks like this:

ipfs://QmRAuxeMnsjPsbwW8LkKtk6Nh6MoqTvyKwP3zwuwJnB2yP

If you copy and paste that into your browser, you may not get anything back. That is because in order to use this one, you have to have a local IPFS node running to participate in the network. Even when you do, it will likely be very very slow since IPFS is still a growing network.

Why use it? Well for a couple of reasons. If you are building on a blockchain that already uses IPFS a lot, like Ethereum or another L2 chain, lots of marketplaces and apps are used to seeing this format. When they see it, they use tools to convert the url into a gateway url so it can display the content on a website. This can be a good thing or a bad thing. If the platform has a dedicated/private gateway, the speed will be very fast (much like our own dedicated gateways). However, if the platform uses a public gateway, the speeds will be very slow. In the end, the platform has control over how well your content is received. Additionally, using the standard IPFS url might help future proof your assets, as public gateways might be stopped down the road (however the CID is still in the url in those cases, so if the platform knows what to do, they can still get the content if pinned).

If you are on a different L1 chain, you may want to test it first before making a full collection. There are some platforms on other blockchains that expect "https" instead and nothing will load if you use this.

Public IPFS Gateway URL

A public gateway URL looks something like this:

https://gateway.pinata.cloud/ipfs/QmRAuxeMnsjPsbwW8LkKtk6Nh6MoqTvyKwP3zwuwJnB2yP

This will deliver the content in the browser without the need of a local IPFS node. However, since this gateway is a public gateway, your speed might vary due to the heavy traffic and congestion. Some platforms will see this kind of the url and switch it out with their own faster gateway choice, but not always. Generally you want to assume that if you take this path, the assets will be slow.

Dedicated IPFS Gateway URL

A dedicated gateway URL looks something like this:

https://pinnieblog.mypinata.cloud/ipfs/QmRAuxeMnsjPsbwW8LkKtk6Nh6MoqTvyKwP3zwuwJnB2yP

Dedicated Gateways are much much faster than any other method, and should ideally be used when trying to display content on your own platform. However, using them in an NFT project should be done in caution. If you use a Dedicated Gateway in your NFT project metadata and image links, your speed will be great, however anytime another marketplace or rarity bot asks the blockchain for the IPFS data, your gateway will be hit. Since most Dedicated Gateways are paid services, this could greatly drive up your costs and usage. You'll get the best performance, control, and flexibility with this method, however you might have to pay more than the other methods.

TL;DR

  • Using a standard IPFS URL is the preferred option if you are on blockchain with good IPFS infrastructure, however you will have less control over how quickly the context is displayed on marketplaces and other third parties (you always control how fast it's displayed on your own site).

  • Using a public IPFS gateway is cheap, however your content might be slow.

  • Using a Dedicated IPFS gateway can be more expensive, but will give you the most control, speed, and flexibility.

If you have any questions feel free to message us on our website or email [email protected]!

Did this answer your question?