Skip to content

Introduction to ECHO

ECHO (The Eventually Consistent Hierarchical Object store) is a peer-to-peer graph database written in TypeScript.

  • Secure, P2P data replication based on CRDTs.
  • No servers or central authority, all the data is with the clients.
  • Connectivity with peers via WebRTC.
  • Support for multiple concurrent writers.
  • Collaboration on key-value objects and text.
  • Support for offline writes and conflict resolution when peers rejoin the network.

Spaces

Spaces are units of sharing and access control in ECHO. They are equivalent to “collections” in a document store.

A space is an instance of an ECHO database which can be replicated by a number of peers.

A given peer is typically a part of many spaces at any given time.

There are several steps to establishing a space between peers:

  1. Peer A listens on the peer network for peers intereseted in a specific invite code it generated.
  2. Peer B obtains the invite code and locates the listening Peer A via the signaling network.
  3. Peer A and Peer B establish a secure connection via Diffie Hellmann key exchange.
  4. Peer A generates an authorization code and sends it to Peer B via another safe channel (i.e.: shows a QR code).
  5. Finally, Peer B provides the authorization code back to Peer A over the new connection.

This verifies that the connection is secure, and the identities of peers are mutually confirmed.

Objects

Units of data are referred to as objects (like documents or rows in other databases). Objects always belong to a space. Objects can have fields with values, and weak references to other objects to form trees or graphs.

Values

Values within an object are JS strings, numbers, booleans, and null, as well as objects and arrays of the same.

The top-level of a DXOS object is always a JS object, never a number, string, etc. Its fields starting with @ are reserved, for example @id and @meta.

How to use ECHO

ECHO and HALO

ECHO is designed to allow users to retain control over their data. ECHO is a secure storage mechanism, responsible for holding end-user data and identity information (keys, credentials, metadata, …, etc.) in persistent browser or filesystem storage. Specific devices can be revoked from accessing user data at any time.

In order to allow multiple applications to access the same ECHO database, the user must initiate a device invitation, which synchronizes ECHO across both applications, giving them both read and write access to all of the user’s data stored in their ECHO.

For Node.js applications, the ECHO database is implemented as an in-process storage engine that persists to files on disk.

Next steps