Skip to content

Rock-Lee-520/p2pdb

Repository files navigation

License License GoDoc platform

P2PDB

standard-readme compliant

English | 中文

Introduction

P2PDB is a decentralized, distributed, peer-to-peer relational database for web3. eventually consistent algorithm was implemented using Merker-CRDT. It uses IPFS Pubsub to automatically sync databases with peers and uses IPFS libp2p to build a decentralized p2p network, it's a relational database that uses CRDT, POW, POS for conflict resolution. P2PDB vision is to build a decentralized database of industrial grade , making P2PDB an outstanding choice for local-first web applications, decentralized applications (DAPP) and blockchain applications, it's developed based on whitebook.

Using the tutorial

tutorial

Core module

  • ✅ p2pdb-server: p2pdb-server is a server side of mysql syntax, compatible with 90%mysql syntax, and can use any kind of mysql client connection, including compatibility of PHP, JAVA, GO, RUBY, PYTHON and other mainstream languages

  • ✅ p2pdb-log: an immutable log component based on the merker-crdt protocol. P2pdb-log is a log component that only allows additional writes and cannot be tampered with. Implementation of operation-based conflict-free replication data structure (CRDT) and Merkle DAG (directed acyclic graph). If all P2PDB database types do not meet your needs and / or you need case-specific functionality, you can easily use the log module to implement the database you want

  • ✅ p2pdb-pubsub: message broadcast component based on libp2p-pubsub for active data transmission in peer nodes. It adopts Gossip gossip broadcast algorithm and has a built-in message queue, which can listen for data changes through webhook and support Websocket protocol links. In the future, it plans to dock to Kafka, RabbitMq, Nsq, Nats and other mainstream message queues to achieve a wider range of data consumption applications. At the same time, it is also a scalable module. The secondary development can be carried out according to the interface provided by the module to meet more business scenarios.

  • 🔲 p2pdb-consistency: a component used to judge the consistency of message order based on protocols such as crdt,ot, which is mainly used when events have no causality (concurrency). As a module for full order judgment, it integrates commonly used sequence judgment rules. If the built-in rules cannot be satisfied, you can also add new protocols according to the module specification.

  • ✅ p2pdb-discovery: p2pdb-discovery is the service discovery registration of the peer node, which is used to retrieve the peer node, and is implemented by the mdns module based on libp2p.

  • ✅ p2pdb-store: p2pdb-store for actual data storage module, similar to mysql data storage, provide index retrieval, data addition, deletion, modification and query, this is an abstract module, the purpose is in the future if the current storage engine can not meet your storage needs, you can provide more DB drivers such as clickhouse, postgresql, TDngine and other databases, currently provide memory storage (development mode use) as well as file storage (production use).

Goal

The goal of this database is:

  • A Dapp application data storage solution

  • A decentralized distributed database solution

  • An edge data storage solution

  • An offline application data storage solution

Features

  1. Compatible with mysql general SQL syntax, can be connected with any mysql client

  2. Decentralized, no central server

  3. Once the historical data is generated, it cannot be tampered with

  4. Data encryption transmission, public and private key encryption and decryption, authorization support to field level

  5. Ultimate consistency, supporting strong ultimate consistency

  6. Fault recovery, timed snapshot copy and automatic synchronization of data

  7. Version proofing similar to blockchain algorithm to ensure that once the data is generated it will never be lost.

Use Cases

  1. Offline web application storage

  2. Multi-player interactive games

  3. Multi-person collaborative documents

  4. Multi-person chat applications

  5. Edge cache storage

  6. Dapp application storage

  7. NFT application storage

  8. More.........

Thanks

Thanks to these excellent organizations

Explanation: Due to the code used in this project, such as IPFS and Libp2p, some of the referenced code follows the relevant code protocols. Thanks to Protocol Labs for their contribution to Web3.0. The remaining codes referenced in independent modules or using codes are included in the LICENSE of independent modules with reference instructions.

Reference description

p2pdb is a project from 0 to 1, and also one of the earliest research projects in the field of decentralized databases. In the process of implementation, we have googled all articles and code implementations about decentralized databases around the world. It can be said that p2pdb stands on the shoulders of giants because many excellent predecessors paved the way for p2pdb. Here we sincerely thank all predecessors who have studied decentralized databases, as well as IPFS team and Protocol Labs for their contributions. If there are any references to codes or implementation ideas not mentioned in this project, please contact us and we will be very happy to acknowledge them with great honor.

Maintenance instructions

Currently, the kkguan organization is maintaining the P2PDB project. Due to certain considerations, the repository is temporarily in private status. Note that the project is still in a rapid iteration phase, which means that most of the API are at risk of being refactored. It can currently be used for learning and research purposes, but it is not recommended for production use. The development team will do their best to push out version 1.0.0, but we cannot predict when a stable version will be released.

Licensing

P2PDB is licensed under the Apache License Version 2.0,See LICENSE for the full license text.

Apache License Version 2.0 see http://www.apache.org/licenses/LICENSE-2.0.html

Contributors ✨

All Contributors

Thanks to these wonderful people :


她和她的猫

🚇 ⚠️ 💻

Rock

🚇 ⚠️ 💻

pandaLIU

🚇 ⚠️ 💻

CbYip

🚇 ⚠️ 💻

This project follows the all-contributors specification. Contributions of any kind welcome!

About

decentralized, distributed, peer-to-peer relational database for web3

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages