How to Locate and Repin NFT Content to IPFS

Async Art
4 min readJan 13, 2024

If you’re curious about why someone would want to locate and repin NFT content to IPFS then please read: “Cryptographic Hashing and Why Your Tokenized Art Collection is Worthless Without It”

So you’ve identified an NFT whose metadata and content is hashed and pinned to IPFS and you’d like to ensure that it remains accessible for years to come. Great! You’re at the right place.

The very first step is identifying the smart contract address identifier for the token:

Finding a Token’s Contract Address and Identifier:

First, find your NFT on a marketplace of your choice. Almost every marketplace includes the token address and identifier in its URL.

Using “Son of Satoshi” by Jivinci as an example:

https://opensea.io/assets/ethereum/0xd31a0edf0341aed2a9f555f172a7a374c3cf1a1b/25

https://rarible.com/token/0xd31a0edf0341aed2a9f555f172a7a374c3cf1a1b:25

You can see that the address is: 0xd31a0edf0341aed2a9f555f172a7a374c3cf1a1b and the token ID is 25.

Finding the Token’s Content Identifier (CID)

You can use Etherscan to query a smart contract’s functions. Taking the address that we found, we can visit: https://etherscan.io/address/0xd31a0edf0341aed2a9f555f172a7a374c3cf1a1b

and click “Contract”:

Then click “Read as Proxy”:

from here it depends if the token is an ERC-1155 (semi-fungible) or ERC-721 (non-fungible). The function that returns a URI (Uniform Resource Identifier) is “uri” for 1155 and “tokenURI” for 721.

Locate the function and input the token ID. Then click “Query”. After a moment you’ll be presented with the token’s metadata URI:

This will consist of its IPFS Content Identifier (CID) or sometimes have a prefix of “ipfs://”.

Viewing IPFS Content

To view the content you’ll need a gateway. Technically saavy folks can run their own locally or you can use a publicly available gateway. Here’s a couple resources for finding them (Please do your own research before using any third-party websites of course!)

Once you have your gateway you can access content via its CID like so:

{gatewayURL} / ipfs / {CID}

So for instance, using cloudflare’s gateway:

https://cloudflare-ipfs.com/ipfs/QmWeFBnhs2WKBtBJRQiKd5Xw8wYZcKNEMdpm7DWFHScrsT/25/

This is the token’s metadata file which specifies information like the artist, the title, and the image’s CID itself. To back up every part of this NFT you’ll want to download the content for any IPFS CIDs referenced within (They all begin with ipfs:// or Qm. Curious why Qm? See here).

To download a file from IPFS simply append the following parameter commands when accessing it in a browser:

JSON files (metadata)

?download=true&format=json&filename=file.json

Images

?download=true&format=png&filename=image.png

Folders

?download=true&filename=Filename.tar&format=tar

Pinning Content to IPFS

Once you’ve downloaded all the content that you want to pin, you’ll need to either run your own node or use a pinning platform.

Here’s the documentation for running an IPFS node: https://docs.ipfs.tech/install/

and a list of some of the pinning services you can look into:

Pinata - https://www.pinata.cloud/

Infura - https://www.infura.io/

Fleek - https://fleek.co/

For ERC-721 it’s simply enough to pin the individual token’s metadata and content but for ERC-1155 collections you’ll need to pin the entire collection’s folder and metadata for every token contained within:

This is because file CIDs are derived from a file’s hash so any difference in content will result in an entirely different CID and won’t match what’s stored on-chain.

Once you’ve begun pinning a file it will remain accessible on the IPFS network under the same CID, even if previous pinners stop pinning from their side.

Furthermore, files can be repinned to the network by anyone at any time as long as they have a copy of the original file(s). Happy pinning!

--

--