Skip to main content

Data Structure

Blockchain 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 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.

Unlike traditional blockchains, the sole purpose of this blockchain is to keep messages between peers in sync. The implementation is far from finished. The blockchain is entirely in javascript running in a browser.

Tables needed:

  • device
  • profile
  • preferences
  • contacts
  • blockchain

device object:

  • id: unique identifier for the device
  • name: name of the device

profile object:

  • id: unique identifier for the profile
  • name: name of the profile
  • avatar: URL to the profile avatar image
  • devices: array of device IDs associated with the profile
  • publicKey: public key for encryption
  • privateKey: private key for encryption (stored securely)
  • symmetricKey: symmetric key for encryption (stored securely)

preferences object:

  • enable notifications: boolean to enable/disable notifications
  • theme: string to store the selected theme (e.g., "light", "dark")
  • language: string to store the selected language
  • privacy settings: object to store privacy-related settings (e.g., "show online status", "read receipts")

contacts object:

  • id: unique identifier for the contact
  • name: name of the contact
  • avatar: URL to the contact's avatar image
  • devices: array of device IDs associated with the contact
    • id: ID of the device associated with the contact
    • publicKey: public key for encryption
    • privateKey: private key for encryption (stored securely)
    • symmetricKey: symmetric key for encryption (stored securely)

blockchain object:

  • id: unique identifier for the blockchain entry
  • name: name of the blockchain
  • chain: array to store the blocks in the blockchain
  • storage: object to store the blockchain data (e.g., messages, transactions)