At BlockSurvey, we recently migrated from .org to .io domain. We wanted to check if there is any way to take a dump of files from .org Gaia and migrate it to .io Gaia.
I understand the files are encrypted with the app-key based on the combination of Blockstack id and app origin. So it is not a straight forward move. I have taken the file dump from .org domain using the below command. But few files are encrypted with the .org domain-specific app keys.
Once I have taken my files using gaia_dump_bucket command, gaia_listfiles command is always coming back as null. My understanding is dump should create a copy, but instead, I get a feeling it is deleting and get_files is returning null. Correct me if my understanding is wrong.
Is there any endpoint available to encrypt_file / decrypt_file separately similar to
encrypt_keychain / decrypt_keychain.
One basic question while using gaia_putfile, what is encrypted + signed file?
I see collections as a potential solution but wanted to check Is there any alternate approach for my problem to shift files from .org domain to .io domain.
Requesting your inputs on the same. Thanks in advance for the help!
Once I have taken my files using gaia_dump_bucket command, gaia_listfiles command is always coming back as null. My understanding is dump should create a copy, but instead, I get a feeling it is deleting and get_files is returning null. Correct me if my understanding is wrong.
What’s the gaia_listfiles command you’re using? gaia_dump_bucket is just downloading files.
Is there any endpoint available to encrypt_file / decrypt_file separately similar to
encrypt_keychain / decrypt_keychain.
Not currently.
One basic question while using gaia_putfile, what is encrypted + signed file?
It will encrypt your file and upload both $file and $file.sig, where $file.sig is a file that contains the signature from your private key over the file. You can automatically verify it with the right options in getFile().
I see collections as a potential solution but wanted to check Is there any alternate approach for my problem to shift files from .org domain to .io domain.
I am using the below command to list files. Currently, post taking a dump, the below command is returning “0” as the output.
$ blockstack-cli gaia_listfiles “https://hub.blockstack.org” “$APP_KEY”
Thanks. But it will be very helpful if we have such endpoint provided. In our scenario, it will enable us to decrypt the downloaded dump file and upload it to Gaia using the putFile() command. Kindly let me know if there is any possibility of taking this into consideration.
Thanks for sharing this Jude. The proposal is good and it will definitely solve our current problem. Requesting you to let us know on the expected timeline for the proposed implementation.
Do you happen to know what your Gaia’s bucket address is? Are you able to fetch individual files with gaia_getfile, or via blockstack.js's getFile() method? This behavior could be due to a bug in the gaia_listfiles command.
In the mean time, it should be possible to write a script to directly call the blockstack.js method decryptContent to decrypt the data, since this is what getFile() does under the hood. You’d use the get_app_keys CLI method to get your app private key from your seed phrase.
There’s no timeline that I know of, but I’m not the maintainer of blockstack.js either. The best way to get in touch with the right people would be to bump that issue.
The gaia_listfiles command is working fine now. It is giving me the proper files now. Not sure why it wasn’t working earlier. I think It’s good for now. I will raise a bug if I face the issue again.
So, if I understand your problem, you’ll need to have all of your users us the CLI tool to migrate data from their old domain’s gaia hub to the new one. Is that correct?
If so, I would say that there are much better options from a user experience than forcing them to use the CLI, which most users won’t be able to figure out.
Another option is to support this strictly from your app’s UI. You could have a flow where:
Your new domain has some ‘settings’ screen (or similar) where there is an option to import from the .org site
The user is sent to some special page on the .org site, like /export or something
On that page, you simply show the user their appPrivateKey
They copy that key and paste it back on the .io site’s settings page
You write some Javascript to use listFiles and decryptContent, to iteratively re-save the old files in the new Gaia hub with the new private key
Thanks a lot, @Hank for the inputs. We are currently analyzing both UI and cli ways of helping users to backup the data. UI way is most common as well as preferable and your inputs are really helpful. We will analyze it more and come up with a solution. Also, We got few requests from a few users who want to access the result files programmatically rather than the interface. So we are looking at cli ways of helping them as well. Thanks.