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?
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.