Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the difference between orbitdb (based on IPFS) and gun ?

I'm looking for a decentralized database for my Dapp. I found two helpful solutions orbitdb and gun but I couldn't realize the main difference and which one is more suitable for a social-media-like application that use ethereum smart contract.

like image 675
maroodb Avatar asked Apr 23 '18 16:04

maroodb


People also ask

What is Gunjs?

GUN. js is a real-time, decentralized, offline first, graph database. Sure is a mouthful. Knowing a little bit about decentralized architecture we can understand the other features. Under the hood, GUN allows for data synchronization to happen seamlessly between all connected nodes by default.

What is GunDB?

GunDB is the Open Source Firebase alternative, a web3 data protocol. How it works. (1) Sync directly between your devices & friends. (2) Reclaim ownership and control of your data. (3) Experience a web that is truly free and open.


1 Answers

I'm the author of gun. I've seen OrbitDB floating around (ha, pardon the pun!) but obviously am not intimately knowledgable about it enough to speak about it. I'll leave that for them to answer. :)

It does look like OrbitDB also uses CRDTs, which means they are probably doing things right/correct. Very few people are using CRDTs, which is sad, but makes GUN pretty unique! Despite the last 4 years I've been trying to evangelize to people that they should use CRDTs, I welcome it.

Maybe a practical way to answer your question, @maroodb , is around GUN's use case for social media:

Yes, GUN is already being used for P2P social media dApps. You can do:

  • User account systems, including traditional username/password, and password reset (no server, fully P2P).
  • Published user data, like tweets, etc. that cannot be tampered with by anybody else (signature encryption, but not private).
  • Private data to the user (cypher encryption).
  • Secret data between 2 users, like private messages (diffie-hellman).
  • And we're currently working on making it easier to do group read/write data, which is possible, but no demos yet.

Here are some links that show demos, and other resources, that might be helpful in building your app:

  • Conceptual understanding of P2P security, done in 1 minute animated cartoon explainers - https://gun.eco/explainers/data/security.html
  • Short, fast article on how to get started with user accounts for a P2P Twitter - https://hackernoon.com/so-you-want-to-build-a-p2p-twitter-with-e2e-encryption-f90505b2ff8
  • A 4 minute and 40 line of code interactive coding tutorial, on how to build a super basic P2P Twitter - https://scrimba.com/c/c2gBgt4
  • Social network idea - https://d.tube/#!/v/marknadal/lanz4e6z (d.tube itself is a P2P youtube)
  • P2P user account management system - https://d.tube/#!/v/marknadal/gfqglxvd
  • Super basic Private Message demo in 75 lines of code - https://d.tube/#!/v/marknadal/ganoayt8
  • Documentation on how to use the security API - https://gun.eco/docs/SEA

And of course, a super friendly chat room of Open Source developers helping each other out build these kind of stuff, https://github.com/amark/gun ! :)

You'll have to ask OrbitDB for their examples/use case for P2P social networking dApps, maybe they know what makes gun different.

Note: A GUN+IPFS adapter will be out soon.


Ethereum is great, but your social network might not scale up if it is implemented primarily as an ethereum smart contract, just as a warning.

We recommend you use Ethereum for any cryptocurrency payments or transactions for your user (not GUN or Orbit).

But we do not recommend building basic social network features (profile info, posts, messages, etc.) using Ethereum.

Likely, 90 to 95% of your app will be GUN or Orbit, and possibly only 3 to 5% smart contracts.

like image 104
marknadal Avatar answered Sep 30 '22 03:09

marknadal