I want to develop a user interface which accepts an image file from the user, and a ERC1155 smart contract capable of minting tokens backed by the uploaded image. In other words, I need my ERC1155 tokens to represent a specific image. However, there are some obscurities for me regarding this topic:

  • What is Token URI? What are its use cases? What does it offer to users?
  • What is Token Metadata? Is it different from Token URI?
  • What are our options if we want to host our token URI somewhere? Is it necessary to host the URI on a decentralized storage such as IPFS? What happens if we keep the URI on the smart contract?
  • Why are there third party services ( like Infura and NFT.storage ) for establishing connection to IPFS to upload the NFT image. I mean why we cannot directly get connected to the IPFS?

Thanks in advance for the clarification

1 Answer 1


So tokenURI() is the function that will return the address where the metadata of this specific token is stored.

The metadata is a .json file (following the ERC721Metadata standard) where all the data associated to the NFT is stored. Such as its name, the address where the image is stored...


Here is a detailed explanation of ERC721 metadata schemas: https://nftschool.dev/reference/metadata-schemas/#ethereum-and-evm-compatible-chains

enter image description here

If you want your NFT to have a metadata and an image linked to your NFT it is much better (and the standard way used by applications) to store them offChain, since doing it onChain would cost a lot.

Your options to store your metadata as of now are either on a server (centralized) or on IPFS which is a decentralized storage. IPFS stands for Interplanetary File System.



The third party services are here to make your life easier. Originally you would have to run an IPFS node yourself to store and access the data you want. Third parties allow you to store on already existing nodes.

PS: All those answers are easily accessible on stackoverflow or the internet. It's always better to search by yourself first ;)

  • If we store the token’s image ( or metadata ) off-chain, how nft marketplaces can access it? Commented Nov 23, 2022 at 14:48
  • 1
    With tokenURI :) They fetch the metadata address from tokenURI and from the .json file they find the image address and display it.
    – Torof
    Commented Nov 23, 2022 at 14:50
  • So when it comes to generating Metadata for a token there must be a common format to ensure readability in various marketplaces? Commented Nov 23, 2022 at 15:00
  • 1
    Dude, just read the docs i gave you everything is written there ! But yes indeed it is better to follow an accepted format which is why standards exist. For instance: docs.opensea.io/docs/metadata-standards OR nftschool.dev/reference/metadata-schemas/…
    – Torof
    Commented Nov 23, 2022 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.