From my understanding, a CIDv1 is backwards compatible with a CIDv0, but only if that CIDv1 was created with the default settings (base32, sha2-256, etc).
After adding a file using ipfs add ... (defaults to using CIDv0 in go-ipfs), I use ipfs cid base32 <cidv0> to output its CIDv1 equivalent. The v1 hash I get back is not the same as the v1 hash I get if doing ipfs add --cid-version=1 .... Why is this?
I thought this might be because adding a file with CID version 1 forces --raw-leaves=true. Doing the same add but with the long option set to falsedid change the final v1 hash, but it still wasn’t the same v1 hash output by the v0 cid base32 subcommand.
I also tried comparing both the first and second mentioned CIDv1s with two runs of ipfs cid format <cidv1> -f="Prefix: %P, Multibase: %b, CID: %s" -v=1 -b=base32 but that didn’t provide any clues either as to why they differ. Though on second thought, this may not reveal anything as I think it’s reporting on the output not the input.
Mostly curious and trying to understand IPFS, but my goal is to add some files as CIDv1s and for them to be considered the same as files potentially added by others using CIDv0 (which from using the Web UI import and go-ipfs, is the default, but I’ve also read CIDv1s are supposed to be the preferred CID version to use going forward). Probably missing something as I’m new to this.
@lidel Just a specific one. I just tried it with a new plaintext file, and it does work. For some reason, the PNG I was performing the commands on just won’t produce the same CIDv1s.
Personally that a WONTFIX (except maybe some docs), having to use --cid-version=0 and then ipfs cid base32 if you care about backward compat doesn’t look too bad.
I belive we just have to be carefull that this behaviour doesn’t happen with #4143.
I would say just use --cid-version=0 and then ipfs cid base32 and then it’s “fixed”.
Just as a follow-up, when CIDv1 becomes the default, will this mean all of the content people have added over the years as CIDv0 may end up being added by new users as CIDv1s, and since CIDv0s converted to CIDv1s don’t match with CIDv1s created by add --cid-version=1, the old files won’t be considered as sources? What happens when CIDv2s become the standard? Will an identical Cat.jpg exist for every CID version? Or is this backward compatibility issue only present between CID v0 and v1?