Id with sixty-four zeros in erc1155

What is the reason why we must carry out the ids in this way in contracts 1155?

The URI value allows for ID substitution by clients. If the string {id} exists in any URI, clients MUST replace this with the actual token ID in hexadecimal form. This allows for a large number of tokens to use the same on-chain string by defining a URI once, for that large number of tokens.

The string format of the substituted hexadecimal ID MUST be lowercase alphanumeric: [0-9a-f] with no 0x prefix.
The string format of the substituted hexadecimal ID MUST be leading zero padded to 64 hex characters length if necessary.
Example of such a URI: https://token-cdn-domain/{id}.json would be replaced with https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json if the client is referring to token ID 314592/0x4CCE0.

I've seen tutorials that bypass this rule working perfectly.

The reason is simply that the standard says so! Compliant applications should implement URI replacement in this way, and NFTs should publish their metadata in URLs of this form as well!

Ok. Thanks for your time.

@frangio , a doubt that has arisen with these fixed URLs.

If in the end the URL changes with respect to the {id}, how will they all point to the same decentralized hash?

Let's see if I explain myself properly.
If the same metadata is for a whole series of ERC1155 NFTs, but the id varies, wouldn't this change the hash and therefore the NFT path?

It's possible to publish a directory to IPFS. The directory has to contain a file for each id, with the appropriate name. Then the URI would be something like ipfs://Qabc...123/{id}.

But don't I have to create different "metadata.json" files for each id with this form?
Taking into account that we only have one metadata per ERC1155 token

If all ids in your token have the same metadata just don't include {id} in your URI. It'll always point at the same file.

OK agreed. These are IDTokens, not ERC20s Ids. Now it is clear. Actually ERC1155 tokens should not be called NFTs because they have balance. Just like an ERC20. They only convert to NFTs when your balance is 1.
Thank you for your response @frangio

1 Like