MetaMask / metamask-mobile

Mobile web browser providing access to websites that use the Ethereum blockchain
https://metamask.io
Other
2.16k stars 1.11k forks source link

IPFS protocol not working for NFT metadata/images #2817

Closed Ronak-59 closed 3 years ago

Ronak-59 commented 3 years ago

Describe the bug

Generally, when minting NFTs, the files and metadata.json are stored on IPFS resulting in URLs of the files and metadata.json using ipfs:// protocol. Hence, NFTs' tokenURI on blockchain contains link starting with ipfs://

However, metamask mobile version 2.4.0 doesn't seem to support ipfs protocol as you can see in the attached screenshot.

Ipfs protocol based URIs should be converted to https based URIs by using default IPFS gateway or by using the IPFS gateway value set by user in Advanced Settings screen.

Screenshots Metamask Screenshot

To Reproduce

  1. Mint an NFT using IPFS protocol for files and metadata.json
  2. Load the NFT in Metamask mobile app
  3. Notice that NFT couldn't be loaded properly.

Expected behavior NFTs should be properly loaded.

Smartphone (please complete the following information):


to be added after bug submission by internal support / PM Severity

defikintaro commented 3 years ago

We are having the same issue here. The sample metadata for our nft characters is like {image: "ipfs://<cid>"} . This is working pretty well in Avascan. However the NFTs are not showing up Metamask mobile v2.5.0 (750) - iPhone. I think the ipfs://<CID> links should be the source of data, trusting some domain (even ipfs.io) is possibly more harmful than trusting ipfs network itself.

Ronak-59 commented 3 years ago

Tested on the iPhone app and it seems to be working. But still not working on Android app.

omnat commented 3 years ago

@gantunesr bringing this to your attention - relevant for the NFT privacy issue

chrischip commented 3 years ago

image

Referring to the marked place above, could someone please advise where does the "collections" (ERC721 contract?) logo/picture defined?

Madeindreams commented 3 years ago

The collection logo is not part of a standard.

Metamask should query the value return by tokenURI() function.

This will return a string ipfs://content_hash/token_id

The query will return some metadata and should contain an image. Example of the data returned by an query.

{
  "description": "A Simple NFT", 
  "external_url": "http://idecentralize.eth", 
  "image": "ipfs://QmTghjX986AuupFww4XfTRbddTpbEgXzKAhWYHQdt7o5BT", 
  "name": "Ian Decentralize"
}

The image value is what should be displayed in the wallet.

heldersepu commented 3 years ago

If looking into this should also add support for arweave
ar://<hash>
that is supported by OpenSea: https://docs.opensea.io/docs/metadata-standards#ipfs-and-arweave-uris

kinggongzilla commented 3 years ago

when is ipfs:// URI going to be supported for both metadata and "image" URI in metadata?

ZaikinaEvgeniya-2 commented 3 years ago

Any updates here?

omnat commented 3 years ago

Related (same issue as) #3310

gantunesr commented 3 years ago

@ZaikinaEvgeniya-2 and @kinggongzilla, IPFS should be supported on v3.6.0

kinggongzilla commented 3 years ago

@gantunesr Thank you for the update! That's already great progress!

Our Metadata has the shape {"name":"Memories That Last Forever","description":"Memories have no time, only the fixed point conjured up within the mind.","image":"ipfs://bafybeihostfukjmaof7byeinkd7qzkmgtkrkwpx5hhuaugquwoycut762m/nft.jpg","artist":"popartdyl"}

Notably the image IPFS URI has the /nft.jpg in the end. The image of the NFT is not displayed correctly in Metamask. Only a gray box is shown.

It works fine on Open Sea

gantunesr commented 3 years ago

Hey @kinggongzilla, looks like the app is getting an error 524 (timeout) with CloudFlare, this is the current default gateway of the app. In a next update it'll be introduced the option to users set their own gateway.

Error 524 indicates that Cloudflare successfully connected to the origin web server, but the origin did not provide an HTTP response before the default 100 second connection timed out.

References:

kinggongzilla commented 3 years ago

@gantunesr thank you for the reply! Why does Cloudflare timeout? Both Cloudflare and Infura links work for me when I try to open them directly. Does this issue affect all NFTs with IPFS URIs or just the one I posted above?

gantunesr commented 3 years ago

@kinggongzilla, I'm not sure why it happens, I imagine it could be for numerous reasons depending on the origin web server.

If the CloudFlare link is working, then you should be able to see the NFT in the wallet. I wasn't able to find that particular NFT, but I can see other collectibles of the same collection,

The considerate smoker The Last Resort

And regarding your last question, this could affect all collectibles depending on the origin web server, that's why the ideal use case is to let users set their own IPFS gateway.

kinggongzilla commented 3 years ago

@gantunesr those are actually from different collection. It is the same artist but the NFT I referenced was minted through beyondmars.art The ones you referenced were minted through OpenSea

You can see it here on OpenSea https://opensea.io/assets/matic/0x4e4d72c4c60f6790dd4a1e57198388187fe58980/322

gantunesr commented 3 years ago

@kinggongzilla It's working for me. Try refreshing the metadata, hold the NFT and you will see the option to refresh.

Simulator Screen Shot - iPhone 11 Pro - 2021-11-09 at 14 57 14

rodriguesmvinicius commented 2 years ago

I still cant see my nft on android app. Just a grey box with the number of the token

my contract returns a standard tokenUri

{ "name": "MyTokenName", "description": "MyTokenDescription", "image": "ipfs://bafkreigto3be4nko5oadk55wthv6fhiuj6hbsf4iurlq7bn2jdzpsnxkqm", "attributes": [ { "trait_type": "TraitType1", "value": "Value1" }, { "trait_type": "TraitType2", "value": "Value2" }, { "trait_type": "TraitType3", "value": "Value3" }, { "trait_type": "TraitType4", "value": "Value4" }, { "trait_type": "TraitType5", "value": "Value5" }, { "trait_type": "TraitType6", "value": "Value6" }, { "trait_type": "TraitType7", "value": "Value7" } ] }

What should i do? thanks in advance!

Madeindreams commented 2 years ago

I can see it!

"image": "https://ipfs.io/ipfs/bafkreigto3be4nko5oadk55wthv6fhiuj6hbsf4iurlq7bn2jdzpsnxkqm",

rodriguesmvinicius commented 2 years ago

I can see it!

"image": "https://ipfs.io/ipfs/bafkreigto3be4nko5oadk55wthv6fhiuj6hbsf4iurlq7bn2jdzpsnxkqm",

me too

but in metamask app i dont. I suppose its because the contract is on kovan network.

for what i have seen it will only work in rinkeby testnet i guess

robertjchristian commented 1 year ago

If looking into this should also add support for arweave ar://<hash> that is supported by OpenSea: https://docs.opensea.io/docs/metadata-standards#ipfs-and-arweave-uris

Here I am 19 mos later looking for ar:// scheme resolution support. =)

I'm surprised that OpenSea seems to be the only major entity in the wild supporting permanent offchain storage uris (ar scheme) for erc721 meta and images. So you can create a decentralized and frozen NFT with AR, but you have to provide the centralized gateway url for it to work with metamask.

Reference: https://mirror.xyz/pfeffunit.eth/iLX1IKglGDxRTufg64RdYJCrNRAMIogmLhfdJ6ZAXUY

Using ERC721 with MATIC network.

ivanlen commented 1 year ago

Not working for Polygon Mumbai network. Still ipfs://<CID> images are not displayed in metamask.

Madeindreams commented 1 year ago

you should try with ipfs.io

ivanlen commented 1 year ago

you should try with ipfs.io

The think is that if you use https://ipfs.io/ipfs/<CID> then there is not point in hosting the images in IPFS...