Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grc721: Remove redundant on-chain Metadata struct #3502

Open
stefann-01 opened this issue Jan 13, 2025 · 2 comments
Open

grc721: Remove redundant on-chain Metadata struct #3502

stefann-01 opened this issue Jan 13, 2025 · 2 comments

Comments

@stefann-01
Copy link
Contributor

stefann-01 commented Jan 13, 2025

Description

Despite our Metadata struct being modeled after OpenSea's metadata standards (as referenced in the comment in igrc721_metadata.gno), our implementation actually makes OpenSea integration more difficult.

Problem:

  1. OpenSea expects metadata to be served via TokenURI() as a JSON endpoint
  2. Our on-chain Metadata struct duplicates the JSON format, but OpenSea cannot read it - they only fetch JSON from the URL returned by tokenURI
  3. Having both TokenURI and on-chain Metadata is redundant and potentially confusing for users
  4. Storing this data on-chain is:
    • Wasteful of chain storage
    • More expensive (gas costs)
    • Inflexible for updates
    • Unable to handle large media files that OpenSea supports

Solution:

  • Remove the Metadata struct and related methods
  • Keep only TokenURI functionality as the standard way to reference metadata

This will make our NFTs actually compatible with OpenSea while following blockchain storage best practices.

Update:

After further consideration, I realized that there is one potential use case where the on-chain Metadata struct could be useful: rendering NFT images in the Render function for Gnoweb.

Since it is not possible to resolve a URI response inside the chain (in realms), and there is no mechanism in Gnoweb to handle the TokenURI JSON response, there is currently no way to display the image of an NFT within Gnoweb.

By using on-chain metadata, which includes a direct image URL, we can leverage this URL in the Render function, enabling .md in Gnoweb to render the image.

This highlights a scenario where storing Metadata on-chain allows direct rendering of NFT images in the Gnoweb, but I believe a better way of enabling this feature would be to add this capability directly into Gnoweb, instead of unnecessarily complicating the grc721 implementation.

@stefann-01 stefann-01 changed the title grc721: On-chain Metadata struct contradicts OpenSea integration despite attempting to follow its standards grc721: Remove redundant on-chain Metadata struct Jan 13, 2025
@thehowl
Copy link
Member

thehowl commented Jan 15, 2025

cc @leohhhn for feedback

@moul
Copy link
Member

moul commented Jan 16, 2025

Let's remove metadata from both GRC721 and GRC20 to simplify the process. We can use an interface if necessary.

Let's completely refactor GRC721 as we did for GRC20. It would also be helpful to create a meta issue for this. Please check my recent #3510.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Triage
Development

No branches or pull requests

3 participants