ERC1155 - changing uri method

The basic ERC1155 contract seems highly opinionated in its implementation of URI
:computer: Environment

Latest version, anywhere

The URI implementation which offers the same string no matter what ID is supplied and is not overridable makes the 1155 unusable in the NFT art space for (for example) prints of an NFT because the only way to use it is with a web based URL which is by definition based on impermanent storage (i.e. you can fail to renew the domain or go out of business).
You can’t use IPFS hashes for example.

The only way around it is to use a non standard URI function which then leaves us with issues when working with etherscan.

:1234: Code to reproduce

1 Like

Hi @DaveAppleton,

Thanks for raising this. The ERC1155 implementation is opinionated on using a single URI with {id} replacement.

There is an open issue on making some view functions virtual, which includes making uri in ERC1155 virtual:

The plan is to address this in the next release of OpenZeppelin Contracts.

Would you mind sharing what you are building with ERC1155?

As far as I know, Etherscan doesn’t have explicit support for ERC1155, as compared with ERC721.

I am building an NFT platform.
I am evaluating 1155 & comparing to 721.
Good point about Etherscan.
I can ask them if any 1155s are supported but with the current URI scheme I guess it could be tricky.

1 Like

Hi @DaveAppleton,

There is much greater eco-system support for ERC721 currently.

In my mind, it depends how much use your NFTs will have outside of your eco-system on whether you should use ERC1155 or ERC721. At least OpenSea supports ERC1155, it would be great if Etherscan did too. I don’t know how much wallet support there is for ERC1155 outside of Enjin.

Making the view functions such as uri virtual is planned to be addressed in the next release of OpenZeppelin Contracts and then you can extend to change the implementation of the uri so that you can have a uri per token. Alternatively, if you needed to in the short term, you could clone the ERC1155 OpenZeppelin Contracts implementation and change the uri to virtual so that you could inherit and override.

I like the website:

1 Like