Token URI Generator

Generate token URIs for IPFS, Arweave, and on-chain storage

Storage Type

1. What is a Token URI?

A Token URI is a string that points to the metadata for an NFT. It can use various protocols (IPFS, Arweave, HTTP, or data URIs) to store and retrieve the JSON metadata that describes the NFT's properties, image, and attributes.

2. How does it work?

IPFS URIs

IPFS (InterPlanetary File System) is the most popular decentralized storage solution for NFTs. IPFS URIs follow the format 'ipfs://{CID}' where CID is a content identifier. The content is addressable by its hash, ensuring immutability. However, content must be 'pinned' to remain available.

Gateway URLs

IPFS gateways convert IPFS content to HTTP URLs that browsers can access. Popular gateways include ipfs.io, Cloudflare IPFS, Pinata, and Infura. While convenient, gateways introduce centralization and may have availability issues. The native ipfs:// URI is preferred for on-chain storage.

Arweave URIs

Arweave provides permanent storage with a one-time payment. URIs follow the format 'ar://{transaction-id}'. Once uploaded, content is guaranteed to be stored for at least 200 years. This makes Arweave ideal for high-value NFTs requiring permanent availability.

Data URIs

Data URIs encode the entire metadata JSON directly in the URI using Base64 encoding. This makes the metadata fully on-chain and completely immutable, with no external dependencies. However, it's expensive for large metadata and limited by block gas limits.

Best Practices

  • Use ipfs:// or ar:// URIs in smart contracts, not gateway URLs
  • Pin IPFS content with services like Pinata, NFT.Storage, or Infura
  • Consider Arweave for high-value or historically important NFTs
  • Use data URIs only for small metadata (generative art, simple data)
  • Always validate metadata structure before uploading

3. Examples

BAYC Metadata URI (IPFS)

ipfs://QmRRPWG96cmgTn2JSvhxcaFrNYMGrey5Zbvs34aexxQtime

CryptoPunks Metadata URI (IPFS)

ipfs://QmZ2RBCCVvk5C8b9FZ3VX3pMZqrJqF9D8z6qZjxV8G9Y5H

Permanent Storage (Arweave)

ar://aB_5sLr6E9h3vT8nX5cY7dZ1wQ6eF4gB2hU0iO3kJ7l

References