Overview
I’m wondering if it’s possible to recursively pin new data with a V1 CID such that any users that previously existing pinned V0 CIDs would still contribute when the V1 CID was requested.
Background & Problem
I’m building a dataset that I’ve pinned to IPFS using CID V0.
The top level CID v0 of this dataset that contains several subfolders and each subfolder contains several image files. The v0 CIDs of the top level folder, a subfolder, and a file are:
QmfStoay5rjeHMEDiyuGsreXNHsyiS5kVaexSM2fov216j
QmbZrgM4jCJ8ccU9DLGewPkVBDH6pDVs4vdUUk1jeKyfic
-
QmaFcb565HM9FV8f41jrfCZcu1CXsZZMXEosjmbgeBhFQr
- PXL_20210411_150641385.jpg
I have several users that have pinned this top level folder, which means the subfolders and subitems are also recursively pinned.
When I update the dataset I add a new subfolder containing new images, and then re-add the root folder and get a new root CID that I publish. This means that the CIDs of the previous subfolders don’t change, which means when a user pins the new root CID, they only have to grab the new data and not the entire 17+GB dataset.
Stuff I’ve tried
I would like to update my project to use CID version 1, but when this update happens I don’t want clients that pin the new root CID to (1) have to redownload everything and (2) have to store all of the old files twice.
To check if this was the case, I looked at the different CIDS for the file via:
ipfs add -n PXL_20210411_150641385.jpg --cid-version 0
ipfs add -n PXL_20210411_150641385.jpg --cid-version 1
These respectively returned:
QmaFcb565HM9FV8f41jrfCZcu1CXsZZMXEosjmbgeBhFQr
bafybeieuzuypuptalyfrpmmtihjmydtq2ok2fmkslsxpvdthxihmbomkay
I read that V0 CIDs could be convered to V1 CIDS via: ipfs cid base32 <CID>
. But when I this on the V0 cid:
ipfs cid base32 Qmd4PzLWTZiawH1W3VzoAbkyh9hCopjqSVAddYF8PrYBfE
I get:
bafybeig2wvo6ojcq6fjemmqs3ussgcn3m2inbv6ogxrhfsbdkosaeilqpe
which is a V1 CID, but it does not match the V1 CID I got from the ipfs add
command. This makes me think that the behavior I want wont be supported by default, but I was wondering if there was any way to support my use case.
To summarize, is there a way to pin a file with a V1 CID, such that it’s existing V0 CID converts to the new V1 cid? Or is there way to pin a V1 CID such that it can be converted back and forth between V0 and V1?
Is there anything else I can do to migrate to V1 without breaking existing users or should i just stick to V0?