Data Structure
A linked-list is a good way to order block of sequential data that can be validated by others. Countless real-world examples show that it scales pretty well.
In our apps, We are testing the use of a blockchain-like structure for storing "application data" local-only. The app is a work-in-progress proof-of-concept and experimental. It is an investigation into creating a distributed and decentralized app. This could be considered and over-engineered solution to CRDT.
the sole purpose of this approach is to keep messages between peers in sync via a CRDT solution. The implementation is far from finished. The CRDT is entirely in javascript running in a browser.
Tables needed:
- device
- profile
- preferences
- contacts
- blockchain
device object:
id: unique identifier for the devicename: name of the device
profile object:
id: unique identifier for the profilename: name of the profileavatar: URL to the profile avatar imagedevices: array of device IDs associated with the profilepublicKey: public key for encryptionprivateKey: private key for encryption (stored securely)symmetricKey: symmetric key for encryption (stored securely)
preferences object:
enable notifications: boolean to enable/disable notificationstheme: string to store the selected theme (e.g., "light", "dark")language: string to store the selected languageprivacy settings: object to store privacy-related settings (e.g., "show online status", "read receipts")
contacts object:
id: unique identifier for the contactname: name of the contactavatar: URL to the contact's avatar imagedevices: array of device IDs associated with the contactid: ID of the device associated with the contactpublicKey: public key for encryptionprivateKey: private key for encryption (stored securely)symmetricKey: symmetric key for encryption (stored securely)
blockchain object:
id: unique identifier for the blockchain entryname: name of the blockchainchain: array to store the blocks in the blockchainstorage: object to store the blockchain data (e.g., messages, transactions)