Synchronization with gaia


What are good options to synchronize app data on the client with the gaia hub?

I see use cases

  • for progressive web apps that store data offline in localStorage
  • for native apps that use the device storage first and then schedule synchronization
  • for collections that work for well established data sets like address book, calendar,… that have already a sync protocol like webdav/carddav/caldav

Should some version meta data be added to the files (like for webdav)? Maybe only in the header. This would also help to identify encrypted files vs unencrypted files.

Should gaia support rsync protocol?

Should each developer solve the problem individually by adding version numbers in the data (on the client)?


Maybe the use cases are too technical.

Synchronization is not needed if the account (user app bucket) is used in a sequential manner on different devices and apps. However,

  • one account could be used by different people,
  • the user might be not aware of having data stored offline (e.g. phone’s battery is dead)

Are there more scenarios?


These are good questions, @friedger

The way we handle synchronization currently is that a user’s Gaia hub is capable of serializing requests as they come in, and this is really all that it will do (i.e., it implements last-writer-wins). Synchronization between multiple devices can be (and in some sense, must be) handled by the client. A library could be used to support this synchronization, but for the moment, I don’t know if such a library exists. As far as supporting it in Blockstack’s libraries (like blockstack.js), I think that approach would be a mistake, as this seems like something a community or otherwise supported library could implement on top of the simple interface currently provided.


Other apps are known to implement CRDTs on top of blockstack.js in order to accommodate potentially-concurrent writes from multiple devices.


Yep, Graphite uses Yjs for this and I believe Blockusign uses Automerge.