ERC721 Metadata off-chain (IPFS) plus on-chain Metadata

I'm trying to create a ERC721 Smart Contract with most of the Metadata stored as a pre-calculated set of JSONs, stored on IPFS; referenced via a TokenURI in the contract, but I also want to allow Token-Holders to edit the Name or Description of the Token: ie. edit on-chain metadata.

Is it possible to do this? (on-chain and off-chain metadata, that is readable by a marketplace like Opensea?) Would greatly appreciate any help or if there are any examples of how to do this.

Hello @hgoona

Changing the content of an IPFS file is not possible without changing the IPFS hash itself. If you want data to be stored offchain on IPFS, then you don't have the possibility of letting users modify some attributes, while keeping the others constants.

IMO you have to option:

  • Drop IPFS for another off-chain system, that includes an permissioned update mechanism. This is likely going to be centralized and trusted
  • Keep you IPFS storage for the invariant attributes, and add some onchain storage/permission for the attributes owner can modify. I'm not sure if marketplaces will be able to pick these up, but you could on your own frontend.

I actually think you would be able to do this using on-chain generated metadata.

Because the metadata JSON looks something like:

  "name": "Name",
  "description": "The description.",
  "image": "ipfs://..."

You can generate this JSON string on-chain with the user-set values for name and description, while hardcoding the rest of the metadata like the image. Then you have to return a base64-encoded data URI; the Base64 library in the current release candidate (v4.5) can help with that.