5 ms·
p2p DB in JS using CRDT. That sounds a lot like GUN. How does OrbitDB compare to GUN?
by continuations 6y ago
p2p DB in JS using CRDT. That sounds a lot like GUN.
How does OrbitDB compare to GUN?
- lildata 6y agoOne of the main difference is it is based on IPFS
- ekseda 6y agoAnother one is that the source code of OrbitDB is not completely obfuscated.
- evv 6y agoCan you elaborate? Source code to GUN is right here: https://github.com/amark/gun/tree/master/src https://github.com/amark/gun/tree/master/src
- ekseda 6y agoYes sorry for not doing this. In the source code folder, please open any random file and try to understand what the code does. I once tried to fix a bug that I found in GUN but I gave up after just trying to figure out what the code is supposed to do.
- vorpalhex 6y agoThat's not an issue with the source code linked above which is just basic javascript.
- iovrthoughtthis 6y agoWow. You are right. What the heck.
- xsdklfsdfklj 6y agoThat is very readable javascript. old school javascript like this have an advantage: you can ship as is, without the need to obfuscate under the excuse of performance. if you load two hundred build dependencies and then write twenty word long variables, it might look nice for you at development, but a user trying to debug or validate code on the fly would be in a very bad position as you would have to 'minify' (i.e. obfuscate) to not have a 70mb production file. Code like this is very readable if you know some conventions, things like `cb` being a callback pointer. Its not even close to the cryptic knowledge needed to read assembly on weird platforms, for example. And a far cry from obfuscated.
- ricardobeat 6y ago> without the need to obfuscate under the excuse of performance > load two hundred build dependencies and then write twenty word long variables [...] a very bad position as you would have to 'minify' (i.e. obfuscate) to not have a 70mb production file You defeated your own argument here. You're saying it's nice that the code is obfuscated already (short variables) so you can get better performance, it's really the same thing - except doing it by hand has a lot of downsides. Minifiers and source maps have been around for a long time to get you the best of both worlds, understandable code in development, minified code in production (even though gzip alone gives you 80-90% of the gains). There is absolutely no reason to write obfucasted code like this [1] where you need to guess the meaning of thirty different one-letter variables. Grep'ing the code becomes impossible. This has nothing to do with 'old school' JS, but universal code standards. [1] https://github.com/amark/gun/blob/master/src/type.js https://github.com/amark/gun/blob/master/src/type.js
- ekseda 6y agoNo this is not readable. You can write readable old school javascript, but just try to tell me what this line does: https://github.com/amark/gun/blob/master/src/type.js#L111 https://github.com/amark/gun/blob/master/src/type.js#L111
- kodablah 6y agoI wrote the beginnings of a Gun implementation in Go based on my reverse engineering of the Gun JS code: https://github.com/cretz/esgopeta https://github.com/cretz/esgopeta. I halted development as I am no longer needing it, but the code might give some insight (assuming it's even accurate, never made it to significant testing).
- amelius 6y agoIndeed, the source looks like the output of a transpiler.
- atrilumen 6y agoHave you tried reading it? ( Not sure "obfuscated" is the word I'd use, though. )
- continuations 6y agoWhat does GUN use instead of IPFS? What are the pros and cons of the 2 approaches?
- lildata 6y agoI'm not sure about GUN But one obvious pro of IPFS is you leverage the huge network of IPFS nodes.
- olah_1 6y agoGun is a graph database. I don't think Orbit uses a graph system, but instead uses feeds or KV stores. So that's a another difference. But Gun can use IPFS as a storage adapter if you wanted.
- vaultec81 6y agoThere is also support for a mongodb like datastore. Slightly separated from orbitdb itself. But uses orbitdb as core system. https://github.com/dappkit/aviondb https://github.com/dappkit/aviondb
- haadcode 6y agoTo clarify here, OrbitDB's core is an append-only, immutable log CRDT. While a mouthful, what is gives, is a distributed (decentralized) database operations log. Almost any type of database, or data structure, can be then built on top of that log. The log in OrbitDB is a Merkle-DAG [1], so, a graph. Key-Value databases, feeds, and other data model types that OrbitDB supports by default, are all built on that log. You can also create your custom database types, ie. custom data models. [1] https://discuss.ipfs.io/t/what-is-a-merkle-dag/386/4 https://discuss.ipfs.io/t/what-is-a-merkle-dag/386/4
- sagichmal 6y agoWhat makes it a CRDT?
- haadcode 6y agoPosted this in another reply above, but give this a read: "Merkle CRDTs" (https://arxiv.org/abs/2004.00107 https://arxiv.org/abs/2004.00107).
- haadcode 6y agoThe log described above is this https://github.com/orbitdb/ipfs-log https://github.com/orbitdb/ipfs-log
- gun_throwaway 6y ago> How does OrbitDB compare to GUN? I went to a meetup where the creator of GUN gave a presentation. To this day, it was the single strangest presentation I've ever experienced. The presentation had numerous obvious errors. The audience kept pointing out major misunderstandings and errors about distributed systems. I remember one awkward moment where someone pointed out a glaring error in the author's model of conflict resolution that undermined one of his key points, which the GUN creator tried to gloss over as quickly as possible. To top it off, he ran out of slides before he finished his talk because he hadn't bothered to complete his whole slide deck before presenting. Instead, he just tried to improvise the last 1/3 of his talk about GUN. It was so bad that we all walked out of there wondering if we had just been trolled. To this day, I'm still surprised when I read about GUN on Hacker News. You don't need to take my word for it. I encourage anyone considering GUN to open up the source code and look through some random files: https://github.com/amark/gun/tree/master/src https://github.com/amark/gun/tree/master/src
- olah_1 6y agoIt's humorous to me that Hacker News allows this kind of unsubstantiated slander. No example of "obvious errors", no mention of which talk this even was. I'm not even a Gun fanboy. I've just used it successfully and it has done for me what it claims to do. Could it be that Hacker News has a vested interest in seeing competitors to IPFS fail? I'm not sure, but either way, your comment grosses me out.
- sagichmal 6y agoI wasn't at this specific presentation, but I've seen other presentations by the author, and had basically the same takeaway. Snake oil.
- tecleandor 6y agoWhat are the alternatives for offline-first databases? I have a project in the back of my head where clients to a simple central database would be frequently offline and I had GUN in my notes for doing that.