Viewing a single comment thread. View all comments

3

go1dfish wrote

Sure.

The core of nab is the gun database system:

https://gun.eco

It's a distributed p2p graph database in javascript.

It handles real time replication of data and changes.

Nab is built by defining additional validation rules for the incoming gun data to define a schema for the data that clients/peers enforce on each other.

Part of this schema is that the identifier for post data is based on a cryptographic hash of the post data, this and the validation makes post content effectively immutable. (For legal or other takedowns peers can replace their local data, but other peers can recognize the tampering since the hash wont match)

Voting is accomplished by a proof of work problem on those identifiers + "ups" or "downs" or whatever type of vote you want to track (nsfw marking will likely work similarly)

The most interesting code is here:

https://github.com/notabugio/notabug/blob/master/src/lib/nab/validate.js

https://github.com/notabugio/notabug/blob/master/src/lib/nab/read.js

https://github.com/notabugio/notabug/blob/master/src/lib/nab/write.js

All the details of the networking and replication are handled by gun, which is what made this so simple to develop.

Currently gun has some pretty major performance issues serverside, but the dev behind it is working hard to address.