Edits
This commit is contained in:
parent
27467776f6
commit
4b9a5a3565
|
@ -1,32 +1,36 @@
|
|||
# GUN
|
||||
|
||||
GUN is a distributed database with a graph structure. It includes a library of tools for merging conflicting data and handling routing, security, and storage.
|
||||
GUN is a decentralized graph database with a conflict resolution algorithm (CRDT) and synchronization protocol. It includes a library of tools for merging conflicting data and handling routing, security, and storage.
|
||||
|
||||
In GUN's graph store, entries are [JSON objects under UUID keys](https://gun.eco/docs/Porting-GUN).
|
||||
In GUN's graph store, entries are [javascript objects under UUID keys](https://gun.eco/docs/Porting-GUN). Objects can be data of any type, including key-value, files, JSON, documents, tables, relational, and graph or hyper-graph data.
|
||||
|
||||
There is a public space and a user space. In the public space are all graphs without a public key as their ID. In the user space, graphs are signed with the user's keys, and their IDs must include the user's public key.
|
||||
|
||||
Data is stored in the browser by default, with backup "superpeers" to ensure persistence. Peers connect to other peers, and choose what data to synchronize and persist.
|
||||
|
||||
### Identity
|
||||
|
||||
GUN's SEA (Security, Encryption, Authorization) module provides the capability to create a [public/private keypair](https://github.com/amark/gun/wiki/Auth) for a user.
|
||||
Gun's [User System](https://gun.eco/docs/Auth) creates a username and password. Usernames are global but not unique.
|
||||
|
||||
[Multi-device login](https://gun.eco/docs/Auth) is handled by encrypting a user's crytographic keypair, which is stored in the GUN graph. Keypairs are not derived from the password. PBDKF proof is derived from the password, and AES is derived from that to encrypt the keypair. GUN treats this method as "secure enough" for applications in which private keys do not control financial information. "Auth" is doing a GUN query for that account, subscribing to it, and then attempts to brute force decrypt the keys of all accounts that match that username. Once loaded once, it's cached on that device, loading from localstorage or local harddrive.
|
||||
|
||||
GUN's SEA (Security, Encryption, Authorization) module provides the capability to directly create a [public/private keypair](https://gun.eco/docs/SEA) for a user, without a username and account.
|
||||
|
||||
### Network structure
|
||||
|
||||
[DAM](https://gun.eco/docs/DAM) (Daisy-chain ad-hoc mesh-network) is the message [routing](https://gun.eco/docs/Routing) algorithm used by GUN to sync data between peers. DAM's API allows for the swapping out of transport layers (websockets, WebRTC, multicast UDP etc).
|
||||
GUN uses a gossip protocol along with a topic-based PubSub protocol to sync data between peers. GUN peers fall back to the [gossip-based protocol](https://gun.eco/docs/DAM) when the more optimized PubSub [routing](https://gun.eco/docs/Routing) protocol fails. Messages are routed across different transport layers (websockets, WebRTC, multicast UDP etc).
|
||||
|
||||
When a peer puts something in a graph, a message is sent to the network and other peers that have subscribed to that data pick it up and update their state. Those who are offline will eventually receive those updates.
|
||||
Peers subscribe to graphs relevant to their application's logic, although the global GUN graph is accessible to all peers.
|
||||
|
||||
A proposed future evolution of the routing protocol is called [AXE](https://web.stanford.edu/~nadal/A-Decentralized-Data-Synchronization-Protocol.pdf). It cuts off unnecessary connections, includes a DHT, and has a token for monetization through bandwidth-based payments.
|
||||
Planned future network upgrades include the addition of a DHT. A [tokenized incentivized mesh proposal](https://web.stanford.edu/~nadal/A-Decentralized-Data-Synchronization-Protocol.pdf) is also on the roadmap.
|
||||
|
||||
### Data Storage
|
||||
|
||||
Peers subscribe to the data they need and the network retrieves it from any peer (including browsers, where GUN stores data in localStorage). Running always-online peers, such as a "superpeer", is recommended for most applications to ensure availability of data when most browser-based peers may be offline. A superpeer is an IP addressable machine running node.js that persists data to disk. [RAD](https://gun.eco/docs/RAD), GUN's storage adaptor, saves data to disk using a radix tree.
|
||||
|
||||
Peers connect to graphs relevant to their application's logic. There is no universally shared graph across the network.
|
||||
GUN uses a CRDT (Conflict-free Replicated Data Type) to merge data. Conflicts are handled by a [conflict resolution algorithm](https://gun.eco/docs/Conflict-Resolution-with-Guns) that uses lexical sort. GUN is [strongly eventually consistent](https://pages.lip6.fr/Marc.Shapiro/slides/CRDTs%20Google%20Zurich-2011-09.pdf), meaning that peers will eventually converge upon the last updated value when nodes that are offline eventually receive updates.
|
||||
|
||||
GUN uses a CRDT (Conflict-free Replicated Data Type) to merge data. Conflicts are handled by a [conflict resolution algorithm](https://gun.eco/docs/Conflict-Resolution-with-Guns) that uses lexical sort. GUN is eventually consistent, meaning that peers will eventually converge upon the last updated value.
|
||||
|
||||
GUN focuses on mutability by not using an append-only log, which implements updates, insertions, and deletion as a layer on top. [Deletion](https://stackoverflow.com/questions/37758618/how-to-delete-data-in-gun-db) in GUN works by overwriting bytes with `null`, or by de-referencing portions of a graph.
|
||||
GUN focuses on mutability by not using an append-only log, which implements updates, insertions, and deletion as a layer on top. [Deletion](https://stackoverflow.com/questions/37758618/how-to-delete-data-in-gun-db) in GUN works by overwriting bytes with `null`, or by de-referencing portions of a graph. A content-addressed graph space is used to implement immutable, append-only data.
|
||||
|
||||
#### Filtering
|
||||
|
||||
|
@ -34,11 +38,11 @@ There is a [GraphQL](https://github.com/brysgo/graphql-gun) API for the gun p2p
|
|||
|
||||
### Privacy and Access Control
|
||||
|
||||
Privacy and access control can be built on top of the GUN database graph by encrypting data for the intended user. GUN's encryption utilities, [SEA](https://gun.eco/docs/SEA) (Security, Encryption, and Authorization), intend to make it easier to add private space to applications.
|
||||
Access control is built into the [User system](https://gun.eco/docs/Auth) and can be combined with [SEA](https://gun.eco/docs/SEA), GUN's encryption utilities, for more advanced use cases.
|
||||
|
||||
Cryptographic keypairs are assigned to roles, groups, or data points. This information is either used to derive a shared ECDH secret to decrypt (read), or to load collaborative multi-writer edits (signed).
|
||||
|
||||
Iris, a decentralized social network building on GUN, has a [library](https://github.com/irislib/iris-lib) for end-to-end encrypted chat channels and private contact list management.
|
||||
[Iris-lib](https://github.com/irislib/iris-lib) provides an API for end-to-end encrypted chat channels and private contact list management.
|
||||
|
||||
### Interoperablity
|
||||
|
||||
|
@ -46,6 +50,8 @@ Plugins, such as backup storage on centralized databases or file systems, can be
|
|||
|
||||
### Scalability
|
||||
|
||||
Test relays (superpeers) on GUN can handle about 10k simultaneous connections: http://guntest.herokuapp.com/stats.html
|
||||
|
||||
### Metrics
|
||||
|
||||
- 11K+ [github](https://github.com/amark/gun) stars
|
||||
|
@ -53,7 +59,7 @@ Plugins, such as backup storage on centralized databases or file systems, can be
|
|||
|
||||
### Monetization
|
||||
|
||||
The GUN protocol is developed by a [VC-funded company](https://era.eco/#step1), which funds the development of Iris as well. Business models include consulting and integrations. Future business models include a proposed paid service on AXE, a blockchain-based tokenized bandwidth incentive network.
|
||||
The GUN protocol is developed by a [VC-funded company](https://era.eco/#step1), which funds the development of Iris as well. The business model is based on consulting and integrations. Future business models include a proposed paid service through a blockchain-based [tokenized bandwidth incentive network](https://web.stanford.edu/~nadal/A-Decentralized-Data-Synchronization-Protocol.pdf).
|
||||
|
||||
### Implementations
|
||||
|
||||
|
@ -62,21 +68,11 @@ GUN is used for p2p chat/social apps, encrypted video conferencing, realtime GPS
|
|||
- [Internet Archive](https://news.ycombinator.com/item?id=17685682) uses GUN for their [dWeb library](https://github.com/internetarchive/dweb-transports) metadata
|
||||
- [HackerNoon](https://hackernoon.com/state-of-hacker-noon-2019-2020-8w1ls3axx) integrated GUN for annotations
|
||||
- [Meething](https://meething.space/) is a Mozilla backed secure & decentralized video conferencing that uses GUN
|
||||
- [Party](https://party.lol/), an encrypted messaging browser extension, uses GUN
|
||||
- [Party](https://party.lol/) and [Maskbook](https://maskbook.com/), encrypted browser extensions, use GUN
|
||||
- [Notabug](https://notabug.io/t/notabug/comments/59382d2a08b7d7073415b5b6ae29dfe617690d74/welcome-to-notabug), a decentralized Reddit clone, uses GUN
|
||||
- [DTube](https://d.tube/) uses GUN for messaging
|
||||
- [Unstoppable Domains](https://unstoppabledomains.com/chat) and [DTube](https://d.tube/) use GUN for messaging
|
||||
- [Iris](https://irislib.github.io/), is a web-of-trust based social network built on GUN
|
||||
|
||||
### Related
|
||||
|
||||
Comparisons can be made to other databases designed for p2p use cases:
|
||||
|
||||
[OrbitDB](https://github.com/orbitdb/orbit-db) - see under [IPFS.md](IPFS.md)
|
||||
|
||||
[HyperDB](https://github.com/mafintosh/hyperdb) - see under [hypercore.md](hypercore.md)
|
||||
|
||||
[KappaDB](https://github.com/kappa-db)
|
||||
|
||||
### Links
|
||||
|
||||
[Site](gun.eco)
|
||||
|
|
Loading…
Reference in New Issue