News for hackers. Stuff that matters.
Re:OrbitDB: Peer-to-peer databases for the decentralized web by continuations on Sunday April 19, 2020 @04:55PM (#22918714)
p2p DB in JS using CRDT. That sounds a lot like GUN.

How does OrbitDB compare to GUN?

Re:OrbitDB: Peer-to-peer databases for the decentralized web by gun_throwaway on Sunday April 19, 2020 @10:57PM (#22920719)
> 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

Re:OrbitDB: Peer-to-peer databases for the decentralized web by olah_1 on Saturday April 25, 2020 @12:06PM (#22979084)
It'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.

Re:OrbitDB: Peer-to-peer databases for the decentralized web by sagichmal on Sunday April 19, 2020 @11:17PM (#22920833)
I wasn't at this specific presentation, but I've seen other presentations by the author, and had basically the same takeaway. Snake oil.
Re:OrbitDB: Peer-to-peer databases for the decentralized web by tecleandor on Monday April 20, 2020 @07:33AM (#22922942)
What 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.
Re:OrbitDB: Peer-to-peer databases for the decentralized web by olah_1 on Saturday April 25, 2020 @12:08PM (#22979102)
I'd say another option might be PouchDB in combination with CouchDB. That's what Hoodie uses.

But I don't see why you couldn't try GUN if you wanted to. It's disturbing how HN seems to demand a kind of "brand loyalty" regarding technology. Just use what works.

Re:OrbitDB: Peer-to-peer databases for the decentralized web by olah_1 on Sunday April 19, 2020 @06:52PM (#22919469)
Gun 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.
Re:OrbitDB: Peer-to-peer databases for the decentralized web by vaultec81 on Sunday April 19, 2020 @08:58PM (#22920190)
There is also support for a mongodb like datastore. Slightly separated from orbitdb itself. But uses orbitdb as core system. https://github.com/dappkit/aviondb
Re:OrbitDB: Peer-to-peer databases for the decentralized web by haadcode on Monday April 20, 2020 @12:16AM (#22921050)
To 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

Re:OrbitDB: Peer-to-peer databases for the decentralized web by haadcode on Monday April 20, 2020 @03:04AM (#22921798)
The log described above is this https://github.com/orbitdb/ipfs-log
Re:OrbitDB: Peer-to-peer databases for the decentralized web by sagichmal on Monday April 20, 2020 @12:37AM (#22921131)
What makes it a CRDT?
Re:OrbitDB: Peer-to-peer databases for the decentralized web by haadcode on Monday April 20, 2020 @01:11AM (#22921295)
Posted this in another reply above, but give this a read: "Merkle CRDTs" (https://arxiv.org/abs/2004.00107).
Re:OrbitDB: Peer-to-peer databases for the decentralized web by lildata on Sunday April 19, 2020 @05:07PM (#22918793)
One of the main difference is it is based on IPFS
Re:OrbitDB: Peer-to-peer databases for the decentralized web by ekseda on Sunday April 19, 2020 @05:12PM (#22918835)
Another one is that the source code of OrbitDB is not completely obfuscated.
Re:OrbitDB: Peer-to-peer databases for the decentralized web by evv on Sunday April 19, 2020 @05:55PM (#22919114)
Can you elaborate? Source code to GUN is right here: https://github.com/amark/gun/tree/master/src
Re:OrbitDB: Peer-to-peer databases for the decentralized web by ekseda on Sunday April 19, 2020 @07:00PM (#22919515)
Yes 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.

Re:OrbitDB: Peer-to-peer databases for the decentralized web by iovrthoughtthis on Sunday April 19, 2020 @07:50PM (#22919789)
Wow. You are right. What the heck.
Re:OrbitDB: Peer-to-peer databases for the decentralized web by kodablah on Monday April 20, 2020 @12:11AM (#22921035)
I wrote the beginnings of a Gun implementation in Go based on my reverse engineering of the Gun JS code: 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).
Re:OrbitDB: Peer-to-peer databases for the decentralized web by amelius on Monday April 20, 2020 @05:44AM (#22922455)
Indeed, the source looks like the output of a transpiler.
Re:OrbitDB: Peer-to-peer databases for the decentralized web by vorpalhex on Sunday April 19, 2020 @08:37PM (#22920073)
That's not an issue with the source code linked above which is just basic javascript.
Re:OrbitDB: Peer-to-peer databases for the decentralized web by xsdklfsdfklj on Sunday April 19, 2020 @08:18PM (#22919966)
That 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.

Re:OrbitDB: Peer-to-peer databases for the decentralized web by ricardobeat on Sunday April 19, 2020 @09:10PM (#22920251)
> 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

Re:OrbitDB: Peer-to-peer databases for the decentralized web by ekseda on Monday April 20, 2020 @07:50AM (#22923024)
No 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
Re:OrbitDB: Peer-to-peer databases for the decentralized web by atrilumen on Sunday April 19, 2020 @07:01PM (#22919517)
Have you tried reading it?

( Not sure "obfuscated" is the word I'd use, though. )

Re:OrbitDB: Peer-to-peer databases for the decentralized web by continuations on Sunday April 19, 2020 @06:45PM (#22919429)
What does GUN use instead of IPFS? What are the pros and cons of the 2 approaches?
Re:OrbitDB: Peer-to-peer databases for the decentralized web by lildata on Monday April 20, 2020 @11:32AM (#22924765)
I'm not sure about GUN But one obvious pro of IPFS is you leverage the huge network of IPFS nodes.