IPFS and Solidity contract

Hello,

I am trying to retrieve the IPFS hash/file that is at the bottom of the Contract tab

This is the link:
ipfs://62c1e84b5f1f3effe1c0e4adbbd785ad950c738ea87a7aaef091add4452a9cbd

from my understanding and from the solidity docs this is the IPFS hash of the file but IPFS responds with:
Error: invalid path “/ipfs/62c1e84b5f1f3effe1c0e4adbbd785ad950c738ea87a7aaef091add4452a9cbd”: invalid CID: selected encoding not supported

it looks like I need to base58 encode this:
122062c1e84b5f1f3effe1c0e4adbbd785ad950c738ea87a7aaef091add4452a9cbd

which gives me this:
QmUzAA35NGHkSs5nMDXh9HgvbNWwmiQ24xQTx3Ppedfeip

which LOOKS like a valid hash for ipfs.
but it hangs and never receives anything.
if someone could point me in the right direction?

Please help?

Perhaps there are simply no providers for this content anymore (I cannot find either).

but does this look like the correct way to encode the hex string?
I am concerned that im missing a step.

Your CID is a valid CIDv0 at the end, so it must be the right way

well sigh… thanks for taking a look. I spent hours on this before asking questions, should have not been so stubborn.

In the future, it would be nice if people would use the right tool to get a base16 CID:
ipfs cid format -b base16 -v 1

Thanks for that!! I’m coming off of 4 hours sleep, and am struggling with this, can you give me an example please?
Would I use my hex string for that or …?

Unfortunately it will not work in your case because your hex string is not a CIDv1 encoded in base 16 (otherwise it should have begun with f or F).
But here is an example of use:

  • You have a CIDv0 in your hand (this one for example: QmUzAA35NGHkSs5nMDXh9HgvbNWwmiQ24xQTx3Ppedfeip), you want a base-16 one, so you do:
    ipfs cid format -b base16 -v 1 QmUzAA35NGHkSs5nMDXh9HgvbNWwmiQ24xQTx3Ppedfeip and you will get this:
    f0170122062c1e84b5f1f3effe1c0e4adbbd785ad950c738ea87a7aaef091add4452a9cbd

  • Now you have a base16-encoded CIDv1 and you want a (base58-encoded) CIDv0
    You just run this: ipfs cid format -b base58btc -v 0 f0170122062c1e84b5f1f3effe1c0e4adbbd785ad950c738ea87a7aaef091add4452a9cbd and you will get this: QmUzAA35NGHkSs5nMDXh9HgvbNWwmiQ24xQTx3Ppedfeip

but all these CIDs are in fact equivalent, and IPFS will respond in the same way to both versions without the need for manual conversion.

1 Like

thank you sir! this helps a lot

1 Like