solana-labs / solana

Web-Scale Blockchain for fast, secure, scalable, decentralized apps and marketplaces.
https://solanalabs.com
Apache License 2.0
13.05k stars 4.21k forks source link

Explorer: Name specified in external JSON should have precedence. #21109

Closed cihantas closed 1 year ago

cihantas commented 2 years ago

Problem

Given an NFT with the following metadata

{
  "name": "foo",
  "uri": "https://example.com/meta.json"
}

and external JSON metadata representing the asset at https://example.com/meta.json with the content

{
  "name": "bar",
}

Solana Explorer currently displays foo not bar.

Proposed Solution

Solana Explorer should use the name specified in the external JSON file if available and otherwise fallback to the name used in the Metaplex on-chain program.

The Metaplex Token Metadata Standard specifcies the field uri as "URI to the external JSON representing the asset". It therefore makes sense to use this data as the source of truth to represent the asset. From a DX perspective it's also easier to change asset metadata in the JSON in case it's stored centralised.

AFAIK common browser wallets such as Phantom already prefer the name specified inside the JSON.

I'm happy to provide a PR for this.

RTISCOOL commented 2 years ago

I have a PR open which changes the fetching of the external JSON metadata to the header component, should be able to add this in 1 line once thats is merged

cihantas commented 2 years ago

Awesome, looking forward. Thanks!

roederw commented 2 years ago

Why would the names differ in the first place? At least the on-chain metadata is theoretically "always" available. A uri isn't always hosted on a chain.

roederw commented 2 years ago

I understand the benefits of using the uri information over the official metadata on chain. Although, I strongly believe what is on-chain is the "truth". Most of the attributes on chain are always stored, potentially, off-chain where the uri property points. If you change the uri information, but don't change the on-chain metadata, than you've created discrepancies in your information. For example, if I update the seller fee off-chain, that has no merit when it comes to Metaplex based auctions, since it uses on-chain information. The "truth" on-chain differs from the uri information. I understand the benefits of using the off-chain information for lower fees, but I don't know if I agree it's the correct route to take. The Explorer was made to view on-chain information. We pull NFT assets from other sources because they're not stored on-chain. I could add another tab to view the uri schema, this was on the list of things to do anyways. Lastly, I am but a contributor, the end result comes down to what the maintainers think. I could be convinced otherwise but right now I don't know if I agree with this proposal. @jstarry @oJshua @bhgames