Hacker News new | ask | show | jobs
by oscargrouch 1615 days ago
>That's interesting. Are you aware of the absurd-sql project?

No, thanks for pointing that out, will take a look into it.

> Also, how do peers find each other?

The idea is to use the torrents as a common shareable resource where given the peers have the same interest in that torrent, lets say the torrents works as a "meta-database" with just enough immutable metadata info, giving the developers of that application a list of peers that will have the same RPC service you designed, with a interface that suits your purpose according to your application goals (a distributed Youtube for instance), and giving you know and designed that API yourself whatever you want from each node, lets say a piece of data, be it a file or a database key-value range, you can ask your API for it, combining the torrent peers and whatever distribution combo you need.

> And finally, do you intend to open source it?

I've just did

https://github.com/mumba-org/mumba

It's badly documented given i'm on the final touches before a proper launch, but the "documentation" of the storage layer is planned for today, giving how important it is for the whole thing.

The first thing i've tried to get right was the storage layer, and the capacity to use mutable sqlite databases over torrent (together with files which are simpler given they are meant to be immutable).

Given theres no proper doc yet, i can point out to the source at

https://github.com/mumba-org/mumba/tree/main/lib/storage

where:

https://github.com/mumba-org/mumba/tree/main/lib/storage/bac...

is a modified chrome cache storage layer (which is the real underlying disk storage) that abstract the files and databases storages that from the bit-torrent layer perspective are on the disk.

https://github.com/mumba-org/mumba/blob/main/lib/storage/sto...

is the front end

and the:

https://github.com/mumba-org/mumba/blob/main/lib/storage/tor...

is the main abstraction that may be a "fileset"(collection of files as in torrent) or a dataset/database, which in this case you can get the sqlite db handle from the torrent object and deal with it as normal database.

I've take care to enable a key-value store over the sqlite btree, so both form of databases are possible, a key-value and a normal SQL database.

Key-values are important for the distributed case where you may want the nodes to have partial data and abstract a SQL layer (or whatever) on top of the distributed nodes, which is a better solution for distributed storage.

For the database distribution, a 64k SQLite memory page maps to a torrent piece of the same size, which can be synchronized over other peers that knows what's the root of the merkle tree of the given database is (you can use the RPC layer to coordinate this or use the bit-torrent DHT updating your slot with the new merkle root)

BTW This is what i'm using to distribute the applications, the DHT which points to a "database torrent" which in turn is a index to other files and database torrents. The application owner have write permissions over that particular DHT slot and can change the root merkle anytime the application itself changes (a new version, or some of the assets).

What im finishing right now is exactly the higher level layers that automate this whole thing and make it work "under the hood" without the users or applications distributors need to understand how it is implemented.

Of course the developers will have access to iterating over the peers of a giving torrent to group them over RPC interfaces, and the idea is also to give access to the DHT so solutions that need a access to mutable ever-changing merkle root is also possible (even though the torrent based solution cover most if not all of the ground), but the idea is to give the devs the tools to be creative about their solutions.

(The solution is a whole browser-based UI/web applications platform, that use torrents and the torrent DHT for the p2p storage layer)

2 comments

Thanks, super interesting. When I get time to work on my side project again I'll try it out. I have a server-less frontend app and have been thinking about a way to allow sync of data between users. I had been looking at webrtc, but the need for a stun server makes the UX ugly. Having a torrent (and/or IPFS) to either be the direct data layer and/or to at least serve as a common point to sync webrtc info seems like a good approach.
Yes, it can even serve to expose the others WebRTC api's that are meant for media, where you can have a initial RPC booststrap interface, that will call your application service, that in turns its programmed by you to use the WebRTC api to stream audio and video from that peer. (or use the datastream if you want)
Good luck with this, I've been reading all the various HN posts on this topic and you seem to be the closest to the holy grail.

Counter to Moxie's argument[0], I think a lot more people would be willing to host a server, if all they had to do to host a server is to seed a torrent. We already know many people are willing to do that.

I think this would be interesting if the application itself was just a Docker container that could output to a browser, similar to many other local-hosted approaches[1].

[0]: https://news.ycombinator.com/item?id=29845208

[1]: https://registry.hub.docker.com/r/plexinc/pms-docker#!

> Good luck with this, I've been reading all the various HN posts on this topic and you seem to be the closest to the holy grail.

Thanks, its nice to hear that after all those years working on it and keep going by understanding how important is for all of us to get out of this rigged game where the cloud computer(+ web clients rulers) FAANG's are controlling where we are heading and a future where we(hackers) have less options technologically, not having enough freedom to program services that can ignore the mothership and create the same sort of services only relying on peers, is a goal being pursuit by them.

> I think this would be interesting if the application itself was just a Docker container that could output to a browser, similar to many other local-hosted approaches[1].

What my solution do is that the application have a "service" process that works like daemon to the application, being able to resolve route requests both locally (when over IPC) and remotely (when over RPC).

The routes are meant to serve html or any other content to the UI application (which is also another process akin to the Chrome renderer).

But the fact that every application might have a ever-running process, means that in some cases it can create other kind of services. For instance:

You can create a PostgreSQL wrapper application where you present the the database SQL api over RPC as a service, and manage the PostgreSQL instance with your service process.

The same works for Docker or QEMU for instance. Your application can be docker-based and can be deployed only on Linux.

Your applications (the service and the UI process) are natives by the way, and even the UI application controls the Web layer (rendering, layout, etc) nativelly talking directly to it (as a first SDK enabled over Swift for now).

This architecture will allow you to do those things, and present a way for the users to interact with your solution in a UX that is packed and develop together with the "backend".

With this hole thing you program the frontend and the backend as a whole, in the same programming language.