I’m stuck trying to access NFT metadata on the Hedera blockchain. When I created the NFT, I converted the CID to a uint8array. Now, when I fetch the data, I’m getting a different output.
The problem is I can’t get back the original CID value from the metadata. I know the data isn’t lost because I can see the NFT images in Hackpack wallet. I just can’t seem to process the metadata correctly.
I’ve tried converting the input to both [uint8array] and uint8array, but I’m still getting some kind of encoded value. The metadata output isn’t in hex or binary format either.
My goal is to convert this metadata back to a CID so I can show the NFT image on my website. Any ideas on how to decode this properly? I’m really scratching my head here!
hey dancingcloud, sounds like ur dealing with a tricky encoding issue. Have u tried using base58 decoding on the metadata? that’s often used for CIDs. Also, make sure ur not accidentally double-encoding somewhere. If u share a code snippet, might be easier to spot the problem. good luck!
heya dancingcloud! oooh, nft metadata can be such a headache sometimes
have you considered using the hashconnect library? it’s pretty nifty for handling hedera nfts and might simplify the whole process for ya.
btw, just curious - what kind of nfts are you working with? sounds like a cool project! 
also, have you tried logging the metadata at different stages? might help pinpoint where exactly things are getting wonky. and hey, if you’re still stuck, maybe we could brainstorm some more ideas? always fun to tackle these crypto puzzles together!
I’ve encountered similar issues with Hedera NFT metadata retrieval. One approach that worked for me was using the @hashgraph/sdk library to fetch the TokenInfo, then parsing the metadata field. The key is to use Buffer.from(tokenInfo.metadata).toString() to convert the raw bytes back to a string.
If that doesn’t work, you might need to investigate how the CID was originally encoded. Sometimes, additional encoding steps are applied that need to be reversed. Have you tried using a hex decoder on the metadata output? That could potentially reveal the underlying CID format.
Alternatively, consider using the Hedera Mirror Node API to query token information. It often provides metadata in a more readily usable format, which could simplify your retrieval process.