holepunchto / hypercore

Hypercore is a secure, distributed append-only log.
https://docs.holepunch.to
MIT License
2.59k stars 182 forks source link

Handling conflicts #174

Closed EGreg closed 2 years ago

EGreg commented 6 years ago

How does hypercore handle conflicting transactions submitted at roughly the same time to different Dats, both signed by an authorized writer? Does it require a quorum before committing a transaction, to avoid forks and netsplits?

Also, how would hypercore handle a fork that is discovered later due to a malicious Dat nodes colluding with the writer to prepare and reveal a fork much later? Is Dat Byzantine Fault Tolerant against malicious nodes?

pfrazee commented 6 years ago

Currently any conflicting writes are rejected by receiving peers, causing the hypercore to stop making global progress when a split occurs in the history.

I’m currently proposing a data-structure-specific resolution process. https://github.com/datprotocol/DEPs/pull/43

Hypercores are designed to have a single writer. Splits are failure conditions.

On Oct 7, 2018, at 12:52 AM, Gregory Magarshak notifications@github.com wrote:

How does hypercore handle conflicting transactions submitted at roughly the same time to different Dats, both signed by an authorized writer? Does it require a quorum before committing a transaction, to avoid forks and netsplits?

Also, how would hypercore handle a fork that is discovered later due to a malicious Dat nodes colluding with the writer to prepare and reveal a fork much later? Is Dat Byzantine Fault Tolerant against malicious nodes?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

emilbayes commented 6 years ago

@EGreg Are you aware of hyperdb? What you describe sounds more like hyperdb than hypercore. As Paul said, hypercore is single-writer, unless you have the secret key in multiple places, but doing that can cause forks/splits which currently is pretty much undefined behaviour.

EGreg commented 6 years ago

I am not aware of hyperdb, just took a look. Does it support multiple writers etc? We may have a different use case!

I am interested in working with some hypercore contibutors to understand hypercore code and see if I can fork it and build upon it and contribute back. Is there documentation on how hypercore code works? What is the best way to start building compatible extensions to it?

iamyellow commented 6 years ago

may i ask what's the meaning of 'writer' here? i mean, if i have a multiple remote peer feeds replicating (bidirectionally) to a central / server feed, are they considered writers? or you mean feeds actually using the same random access storage?

emilbayes commented 6 years ago

@iamyellow So in hypercore every block is essentially signed with a cryptographic signature (not exactly what happens), so a writer is anyone possessing the private key required to make a signature, and hence write to the feed. Despite it being possible for this key to exist in multiple places at the same time, it is undefined behaviour if two distinct places sign at the same time, making a fork in the history as Paul outlined here, and is proposing functionality for resolving: https://github.com/datprotocol/DEPs/pull/43

mafintosh commented 2 years ago

Closing cause old and lots have changed (see autobase for something like this)