5

The official docs say

ERC721 token with storage based token URI management.

If someone could elaborate more on what exactly this means and when to use it, I'd be grateful.

2 Answers 2

9

It means that the tokenURIs are also stored in "storage". The base implementation in ERC721.sol reads the baseURI in memory and concatenates the resulting String on-the-fly, without storing them as a state var.

It is used if you want to decouple the tokenURIs from the baseURI. Otherwise if no baseURI is set, the base implementation returns empty string. Afaiu, this is used if you want to store metadata off-chain and be able to set individual tokenURIs, see also here.

0

Usually, metadata is not stored directly on chain. There has to be a link (tokenURI) in your contract pointing to that external metadata.

ERC721URIStorage extension provides storage for token URIs which means that uris are stored on-chain. Without this extension, URIs are NOT going to be stored on-chain.

If Uri's are not stored on-chain, token URI's are simply generated dynamically by concatenating the base Uri and token id. this makes storage efficient. The downside of this token Uri's are coupled to the token IDs. Because token id is contained inside the uri. Or what if you are using ipfs which has content identifier to store your metadata. The content identifier is going to be a hash of the input data which looks like this.

dweb.link/ipfs/f01701220c3c4733ec8affd06cf9e9ff50ffc6bcd2ec85a6170004bb709669c31de94391a

As you this has no pattern like sequentially increasing token id. In this case you cannot generate the token URI by concatenating the token id and the base uri.

As a note, it is possible to use ipfs without uri storage. However this involves uploading folder to ipfs and then the folder is used as base Uri. that way you can dynamically generate token uris by concatentaing the ipfs base uri and token id.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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