mafintosh / mafintosh/hyperdb

To prevent mutation of history, use merkle root hashes in addition to sequence numbers

Open
#41 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
748
Forks
56
PR merge metrics
No merged PRs in 30d

Description

EDITED to include new discussion and work

`hyperdb` identifies node relationships using a feed key and a sequence number in that feed.

Because there is no hash related to the contents of the feed, it is possible for anybody who _holds the private key_ of a feed in a hyperdb to alter the content. (This would mean either a duplicitous publisher, or a compromised private key.) Old clients will refuse to sync, but new clients could be unable to tell the difference. A hyperdb version does not identify the contents or history of the database uniquely at all in this scenario.

To move towards solving this [`rootHashes` has been added to the hypercore api](https://github.com/mafintosh/hypercore/issues/142). Now, a single hash of all the root nodes in each feed should be added to each newly generated node, augmenting the use of sequence numbers and the vector clock([context](https://github.com/bnewbold/dat-deps/blob/dep-hyperdb/proposals/0000-hyperdb.md#reference-documentation), [explanation](https://github.com/bnewbold/dat-deps/blob/dep-multiwriter/proposals/0000-multiwriter.md#concepts-behavior-and-usage)). This should be verified when new nodes are read. The hash should be used when the `HyperDB.prototype.version` and `HyperDB.prototype.checkout` functions are used, to identify and verify versioned snapshots of the database.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with HyperDB.prototype.version and HyperDB.prototype.checkout, then review the linked hypercore rootHashes API discussion and the vector-clock references. Done means newly generated nodes carry a root hash, reads verify it, and versioned snapshots use it alongside sequence numbers to identify and verify history.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cryptography, databases, distributed-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.