automenta / telepathine

p2p gossip protocol w/ incremental diffs & failure detection for a fault-tolerant, self-managing cluster or mesh (for node.js)
Other
14 stars 1 forks source link

When a node connects to a network, does it sync pre-existing the kv pairs from other nodes? #10

Closed distbit0 closed 2 years ago

distbit0 commented 6 years ago

When a node connects to a network, does it sync pre-existing the kv pairs from other nodes or does it start with nothing and wait for new entries to be added to the database?

If it does not auto-sync current entries, is there a way to implement this on top or as an addition to this library?

automenta commented 6 years ago

i dont remember but in node.js you are probably better off using https://scuttlebot.io which is actively developed. https://webtorrent.io DHT might work too. i can suggest some other libs for java

distbit0 commented 6 years ago

Thanks for answering. Hmm ok. I don't know if a dht would be useful for my purposes. If you don't mind, I would be interested in hearing any libs that you think might be applicable to my use-case seeing I have little experience in this area and you probably know a lot.

I want to find a library that allows a network of nodes to maintain a database (really just a list of objects in this case) between them, where they all have a full copy of it and can all edit it but all edits are reviewed and ensured to be valid (that the resulting db entry fits the specifications for a valid one) before they are stored and accepted by each node. This network also needs to be completely p2p so it can't use a server to maintain state and the library should allow new nodes to auto-sync the current state of the database from current nodes in the network that already have it.

Thanks so much, I am not sure yet if what I want to do is a standard and common task or if it is very obscure. @automenta

automenta commented 6 years ago

yes that is how the internet should work :D

https://github.com/ssbc/secure-scuttlebutt probably can do what you're describing. generally you have to make a tradeoff between how distributed and how 'valid' the database is. but something like scuttlebutt is completely p2p and designed for it. many tools are described as "distributed" but fewer actually are truly decentralized. this is because it's so powerful but it comes with a cost of fault tolerance and performance.

are you specifically working in node.js or any language? you may be able to get something working quickly with IPFS.org since it can be used like an ordinary file system.

https://en.wikipedia.org/wiki/List_of_P2P_protocols https://en.wikipedia.org/wiki/Category:Peer-to-peer_computing

distbit0 commented 6 years ago

I am specifically working in node.js only. I do not think that ssb is helpful for my application as it isn't a library for replicating a data structure in a p2p network but instead its purpose seems more like a general purpose secured gossip network and not specifically for kv pair data replication. Do you know of any node.js libs that allow for p2p replication of a kv pair dataset among a network of nodes where each node can verify every change before syncing it and where nodes can pull off of other nodes the latest state of the db when they join the network?

automenta commented 6 years ago

not having used ssb i cant say much more about it other than what it describes here https://github.com/ssbc/secure-scuttlebutt#feeds seems like it can emulate a verified versioned key value store. each value would be represented by a new 'feed' in its terminology. either that or some lower level API which that uses would implement a distributed key value store aka distributed hashtable.

another thing you might look for is called 'raft consensus' algorithm. anything implementing that or something like it, in a decentralized way, would fit these requirements. that might be closer to what you described when you mean 'verify before synching' and yes that is different from the 'forget and fire' sort of gossip protocol. i dont know of any specific node.js libraries for that but im sure they exist. ive seen some for java