multiversx / mx-api-service

Unified REST API facade for providing data related to the MultiversX blockchain
https://api.multiversx.com
GNU General Public License v3.0
30 stars 48 forks source link

When why does this NFT metada did not change? #447

Closed wellbranding closed 2 years ago

wellbranding commented 2 years ago

When why does this NFT metada did not change?

Decode the data from the gateway and you will get a different value, here is a link:

https://bit.ly/3oieH3o

Now, please check the on the api,

https://bit.ly/3GgV3ed

You can see that the attribute Top is Banana, it should be a Bandana, like on the gateway.

Originally posted by @wellbranding in https://github.com/ElrondNetwork/api.elrond.com/issues/433#issuecomment-1028089905

wellbranding commented 2 years ago

Any updates?

AlexandruPislariu commented 2 years ago

Hello! I found an issue related to your metadata. It seems like your ipfs metadata json is not updated and that is why our API does not reflect the changes.

https://ipfs.io/ipfs/bafyreieyvupwb7qwymflzag2mhy6mtgghwug6hst4ec32xyav2yck2vobe/metadata.json

Please make sure you update this json or create a new one and the NFT metadata will change.

wellbranding commented 2 years ago

Please don't close the issue... This is more nuanced, look here. The attributes are bWV0YWRhdGE6YmFmeXJlaWV5dnVwd2I3cXd5bWZsemFnMm1oeTZtdGdnaHd1ZzZoc3Q0ZWMzMnh5YXYyeWNrMnZvYmUvbWV0YWRhdGEuanNvbg== If you decode base64 from api.erlond, you will get the metadata:bafyreieyvupwb7qwymflzag2mhy6mtgghwug6hst4ec32xyav2yck2vobe/metadata.json

This metadata refers to this ipfs: https://ipfs.io/ipfs/bafyreieyvupwb7qwymflzag2mhy6mtgghwug6hst4ec32xyav2yck2vobe/metadata.json

Now if you check the gateway, the attributes refer to different base64 hash:

ZGVzY3JpcHRpb246RGlzY292ZXIgb2ZmaWNpYWwgQ29tYmFzZWQgY29sbGVjdGlvbiBiYXNlZCBvbiB1dGlsaXR5IHdpdGggb3VyIE5GVCBhcHAgJiBpbnRlcmFjdGlvbiBvbiBNZXRhdmVyc2UuO0JhY2tncm91bmQ6U3RhbmRhcmQ7Qm9keTpPcmFuZ2UganVpY2U7RXllczpWUiBnbGFzc2VzO1RvcDpCYW5kYW5hO21ldGFkYXRhOmJhZmtyZWllcDdmczZpazN1bm5zbXdwc2VxZWxtY2x2eGR0aGRxd3VpY2xlZXRna2pyMml4NjJibTVp

If you decode it, you will get this value:

description:Discover official Combased collection based on utility with our NFT app & interaction on Metaverse.;Background:Standard;Body:Orange juice;Eyes:VR glasses;Top:Bandana;metadata:bafkreiep7fs6ik3unnsmwpseqelmclvxdthdqwuicleetgkjr2ix62bm5i And metadata link is this:

https://ipfs.io/ipfs/bafkreiep7fs6ik3unnsmwpseqelmclvxdthdqwuicleetgkjr2ix62bm5i

I can't change that json, it is not possible. I can only change attributes, which I did, but that did not affect the metada on API. I can't change it, if I can, please tell me which erdpy method should I use

theadriann commented 2 years ago

Having the PR #445 already merged into the development, should this be working on devnet?

I believe that this issue should be closed when the bug is not reproducing anymore on the mainnet (since this is still causing problems/confusions).

@tanghel @LucianMincu

wellbranding commented 2 years ago

I still experience the issue on mainnet. The metada was not updated. The team checked, but it seems the issue is still not on mainnet, please let me know.

Maybe I need to updatmetadata again to trigger the change?

combased-dev commented 2 years ago

Tried today, the issue exists on mainnet. It seem it is not merged yet, correct? Take your time, I am just double checking :)

Galudas commented 2 years ago

Any updates for this issue?

tanghel commented 2 years ago

hello! this particular issue is not related to the API. We fetch the attributes from the elasticsearch indexer (index.elrond.com), which does not yet update the attributes. It has a pending release where this issue is fixed.

Until then, the only change that we could make is to fetch the nfts from the elasticsearch and overwrite the attributes from the gateway, which in turn can create a performance issue.

The new indexer release is a few weeks away.

With the new indexer, this issue will be automatically resolved 👍

Sorry for the inconvenience 🙏

Galudas commented 2 years ago

Thank you for the quick response :pray: :pray: :pray:

raress96 commented 2 years ago

Hello, I also encountered this issue. The attributes are the old ones for this endpoint: https://devnet-api.elrond.com/nfts/NFTMEMES-1119a5-01

But on the address specific endpoint, the attributes are fine: https://devnet-api.elrond.com/accounts/erd1pjgkaaq75vfy0mx5qe9xv9n8ef4zsg3jd24s593clg896zau4h5s6ehxpf/nfts?collection=NFTMEMES-1119a5

Which seems quite strange to me, why the first endpoint cache was not updated...

Gateway also has correct value: https://devnet-gateway.elrond.com/address/erd1pjgkaaq75vfy0mx5qe9xv9n8ef4zsg3jd24s593clg896zau4h5s6ehxpf/esdt

tanghel commented 2 years ago

The address specific endpoint fetches the data from the gateway directly: https://devnet-api.elrond.com/accounts/erd1pjgkaaq75vfy0mx5qe9xv9n8ef4zsg3jd24s593clg896zau4h5s6ehxpf/nfts?collection=NFTMEMES-1119a5

Whereas the global NFT details are fetched from the elasticsearch, which at the moment does not update the attributes: https://devnet-api.elrond.com/nfts/NFTMEMES-1119a5-01

nirre55 commented 2 years ago

Hello, I tried to modify the attributes of an NFT (about 3 days ago), I just checked it and I noticed that only the Tags have changed and the Metadata is the same. https://devnet-explorer.elrond.com/transactions/8ae129d7ce2ecc9c71f6aa0473774caba8fb372c04da6687d0310e20d8dd9737 attributes and tags have been updated on: https://devnet-api.elrond.com/accounts/erd1ccukl7vkhvkfzvyz0g6d0df0n4vvzrc9drvgupfcfpxxq2xrq04spu27fm/nfts?collection=NIRRE-8f1c8b

but the metadata not, is this normal?

tanghel commented 2 years ago

The issue has been resolved with the following PR: https://github.com/ElrondNetwork/api.elrond.com/pull/541

It will be deployed shortly and from that point in time, the API will react to NFT metadata refresh transactions

alexbolog commented 2 years ago

Hello guys! This issue is still reproducing, both on devnet and mainnet.

Take for example this NFT: https://api.elrond.com/nfts/EREX-80e5a4-44

The API attributes contain "metadata:QmTtVwwAXsBy66C6oNDHWGLs57yfRMEqnGAkEhJo8uz3XK/468.json" while the gateway attributes contain the correct "metadata:Qmd5SS16SD7DDPZ3RzSsxdt6Dg3Lkaw9AVbhJMQNojYJdE/468.json".

This happened after a ChangeNFTAttributes transaction

tanghel commented 2 years ago

indeed, this seems to have uncovered a new situation in the way the latest version of the indexer is handling update attributes events. We will have to investigate this and provide an update.

could you provide us the TX where the update of attributes occurred?

tanghel commented 2 years ago

In the meantime, we will update again the API to take attributes from gateway in NFT details:

https://github.com/ElrondNetwork/api.elrond.com/pull/610

alexbolog commented 2 years ago

@tanghel Here's the tx hash: https://explorer.elrond.com/transactions/ef66cc838aaef8cfbfe20eec051c9fc0a2e3980c2fe77de0706a03e1ca8db084

It was done from a SC but it looks like the wallet transactions have the same behaviour.

alexbolog commented 2 years ago

@tanghel The attributes seem to be fetched correctly now, thank you. There is one more issue involving the attributes: although the base64 string received reflects the updates, it looks like the metadata field does not get refreshed. Internally, this is not a big issue as we decode the attributes to fetch the current metadata, but secondary marketplaces might not do this and it leads to confusion. Here's an example of it: https://api.elrond.com/nfts/AETHERSOUL-fbbc7b-022f The metadata reads {"trait_type":"7th Element Summon:","value":"0/1"} While if we decode the base64 attributes and fetch the json file we see { "trait_type": "7th Element Summon:", "value": "1/1" }

Please let me know if you need me to provide anything else.

tanghel commented 2 years ago

Hello!

Indeed, there was this remaining issue that updating attributes with the help of a smart contract did not trigger the refresh function.

It has been solved with this PR: https://github.com/ElrondNetwork/api.elrond.com/pull/656

We also forced the refresh of metadata for NFTs minted in the past, such as https://api.elrond.com/nfts/AETHERSOUL-fbbc7b-022f

🔥