5

I'm currently setting up my minting software and noticed I get the error when assigning a CIDv1 hash as the image (CIDv0 works fine - it just fits)"Text string metadata value must consist of at most 64 UTF8 bytes"

I also noticed that someone got around this by splitting it up into a list of less than 64 bytes each.

eg.

{...image: [ "lessthan64string-0", "lessthan64string-1", "lessthan64string-2", "lessthan64string-3" ]...}

= lessthan64string-0lessthan64string-1lessthan64string-2lessthan64string-3

This seems very off standard for a NFT or am I wrong. Obviously you can recreate the string by joining, but I wouldn't think the chances of market places doing that is big.

I've had a look at - https://github.com/cardano-foundation/CIPs/pull/85, but I'm not sure about it.

If anyone could point me the the direction of what is the proper way to di this - It would be muchly appreciated

Thanks for your time

FYI: the reason for the CIDv1 is I am using https://nft.storage/ (as well as pinata) and I want the 2 hashes to match for longevity of the NFT for the images and they seem to only support CIDv1 - and it's going to have to be supported at some stage. The filecoin (nft.storage) one will be used as a backup

1 Answer 1

1

I would store the CIDv0 in the metadata. You should be able to convert from v1 to v0 if it's using v1 protocol buffer codec.

# If this outputs "protobuf" we can be reasonably certain we can convert
ipfs cid format -f "%c" -b base58btc bafybeiccuppnh2nh54jtubqo2jjmngzlnnmliejjq3xlswxzh24et2llu4
# Convert our CIDv1 to CIDv0 (returns "QmSpnYb3romJejsUqhRepYr6GBwuKUFj1kqrhtk1z2Hn8E")
ipfs cid format -f "%M" -b base58btc bafybeiccuppnh2nh54jtubqo2jjmngzlnnmliejjq3xlswxzh24et2llu4

Source: https://discuss.ipfs.io/t/make-cidv0-from-cidv1-using-cid-ipfs-io/10647/2

6
  • Thanks for the comment - I'll see what I can do :-)
    – Braden
    Sep 3, 2021 at 1:51
  • 1
    Storing the longer image url as an array is also in-line with the CIP standard. If you use CIDv1 and store it as an ipfs url split in two, it should work and is supported by pool.pm and other NFT viewers out there. Oct 2, 2021 at 12:56
  • @AndrewWestberg-BCSH can you elaborate on this pls? how is this done?
    – rx2347
    Nov 27, 2021 at 17:02
  • @rx2347 To store it as an array, just do ``` "image": [ "first part of the url", "second part of the url"] ``` Nov 30, 2021 at 22:58
  • 1
    @rx2347 as long as each part is less than 64 chars, anybody implementing the NFT metadata spec just concatenates them together. Dec 3, 2021 at 16:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.