AgregoreWeb / agregore-browser

A minimal browser for the distributed web (Desktop version)
https://www.youtube.com/watch?v=TnYKvOQB0ts&list=PL7sG5SCUNyeYx8wnfMOUpsh7rM_g0w_cu&index=14
GNU Affero General Public License v3.0
738 stars 66 forks source link

Expose DHTs #119

Open RangerMauve opened 3 years ago

RangerMauve commented 3 years ago

It could be cool to expose something like IPFS's smart record API which lets you do fancy things with their DHT and store data without a central DB.

Could also be useful for other DHTs like Hyperswarm's PUT/GET

resession commented 3 years ago

if you are thinking of hyperswarm dht, then also think about webtorrent/bittorrent-dht bep44. all of them seems to have a way of storing records. might as well add them all if it's possible

RangerMauve commented 3 years ago

Interesting idea. Would you imagine that a GET dht://somehash call would fetch data from all DHTs at once? And PUT would somehow add to all of them at once?

resession commented 3 years ago

wondering if there are differences between the hashes the dhts as far as length, thought i read that hyperswarm dht creates a 32 character length hash(not sure though, might be wrong). but ideally that would make the most sense. have a hash to search for and look up? so GET dht://somehash, you have a hash to put/save? PUT dht://somehash. now if there is any difference between the dhts in the character length of the hashes or other things, then that would have to be handled somehow.

unrelated thought by the way, had a thought. the homepage can a hub for general network/dht interaction. get/put dht, upload torrent site, basically homepage can be the way folks interact with the networks themselves. a new user would be able to start playing with it immediately. maybe not now, but as things get added, it would make sense. or maybe this homepage idea can be optional. kind of like regular browsers give you option how a new tab will look. a thought for the future. not important but a nice convenience for new users maybe

RangerMauve commented 3 years ago

Sadly, I think the DHTs in Agregore right now all use different hashing methods and peer IDs, so it'd be kinda hard to unify them. 🤔

bittorrent:// is using Mainline which uses 20 bytes for identifiers (sha-1)

hyper:// uses the Hyperswarm DHT which uses 32 byte keys for identifers (I think it uses blake2b for hashes_

ipfs:// and ipns:// use the libp2p DHT which also uses 32 byte identifiers (using sha256)

On top of this I think they all use slightly different algorithms for mutable GET/PUT.

Maybe we could use different DHT protocol handlers? Like ipfs+dht:// to specify protocol specific APIs?

Regarding the homepage stuff, would you be interested in drafting up a separate issue for the idea? This reminds me of something I wanted to make in the past as part of a Mozilla devgrant thing where we could use local peer discovery to find content we want to share with folks. Could be cool to start it off as an app and see about merging into the homepage after we have something basic working. I think the extension messages in hyper could also be useful for this.

resession commented 3 years ago

yeah that can work, also dht://chosenNetwork/hash should work as well

RangerMauve commented 2 years ago

One question would be what the use case would be. For DHT lookups where we get the IP+Port, it's not clear what our next step would be since there's no easy way to expose raw p2p connections without using something like pubsub or extension messages. 🤔

One common thing between DHTs is PUT/GET for immutable content, and for public key protected content. Though I'm not certain what the point of these APIs would be beyond implementing something like IPNS. 🤔