draeder / easypeers

Easy serverless swarms of WebRTC peers over WebTorrent
MIT License
41 stars 2 forks source link

True P2P #1

Closed worldpeaceenginelabs closed 2 years ago

worldpeaceenginelabs commented 2 years ago

Hi Draeder,

i asked "I am working on a True P2P project (without fixed signaling servers) Does anyone have experience with a combination from GunDB, webtorrent trackers and dyndns, maybe???" in the Gitter amark/gun chat.

Rococtz answered, that you have been trying something like that for a while now.

My definition of True P2P = "A swarm of P2P clients, independent of any dedicated servers, not even dedicated signaling servers"

If i did not super misunderstood this repo https://github.com/subins2000/p2pt, then it will make available the webrtc datachannel for your app, which are already established by webtorrent for file transfer purposes (i guess this is how they do it).

The webtorrents, websockets, bittorrents are free to use, so we are not talking about me, building a relay network, but using bittorrents relay network (75.000) for my p2p swarm, in the same time improving the bittorrent network (more nodes, better scale, better performance/reliability)

The further improvment is to have multiple such entrypoints (free signaling servers) like DHTs of free stun and turn servers, multiple dyndns trackers as fallback option and so on...

Anything wrong in my thinking? Maybe I cant use the trackers for free? I am really not sure, even though reading multiple blogs. But if the trackers are free, it works out, right?

Is there any of your repos already doing this or in development to do so, coincidentally???

This is the repo i am working on: https://github.com/worldpeaceenginelabs/CLOUD-ATLAS-TRUE-P2P

worldpeaceenginelabs commented 2 years ago

This is exactly what I'm imagining for Mishmesh. But the kraken is a new network...

Could Bugout act as a p2p api server? and would data still be available on some way after closing the browser tab?

draeder commented 2 years ago

Mishmesh could lead to a new p2p network of peers that are found from other p2p networks. But I'm not designing it to be that by itself. Something like True-P2P will have to finish that last mile.

Could Bugout act as a p2p api server? and would data still be available on some way after closing the browser tab?

This is what Gun does out of the box!

worldpeaceenginelabs commented 2 years ago

Mishmesh could lead to a new p2p network of peers that are part of other p2p networks. But I'm not designing it to be that by itself. Something like True-P2P will have to finish that last mile.

oh you mean like, if i run an app with mishmesh and another dev runs his own app with mishmesh, we could share resources and profit both from sharing nodes?

draeder commented 2 years ago

For example: if the 'topic' matches on say, Bugout, and there's a matching 'topic' on Gun, the Gun and Bugout peers would just connect to each other over Mishmesh and drop the Bugout and Gun connections.

draeder commented 2 years ago

But if AXE is ultimately successful, it will be AXE as the primary transport for Mishmesh... Mishmesh will just coordinate between other p2p technologies over AXE.

worldpeaceenginelabs commented 2 years ago

Does someone now, when there is a stable GunDB and AXE?

worldpeaceenginelabs commented 2 years ago

I think this is what i imagine for true-p2p. I like the concept, that one is able to set the use or not, and priority and timeouts for the arms. (adapter) This is convinient for a simple code.

image

draeder commented 2 years ago

You understand that all browser-based P2P technology uses WebRTC, right? That includes WebTorrnet, Bugout, Gun, IPFS, etc. (any other p2p libraries that work in the browser). Also, that Bugout and P2PT (and Easypeers) are built on top of WebTorrent....?

WebRTC can work in Node.js but requires a library called wrtc to make that happen. Yet, Node.js doesn't require WebRTC because it is server-side and can access TCP/IP directly. Timebeam, for example, uses hyperbeam and creates a server that can be reached on the provided ports. Theoretically, a browser could be configured to use a Timebeam server as it's web proxy server. I plan to test that soon, actually.

Just some stuff to keep in mind as you're working through True-P2P

worldpeaceenginelabs commented 2 years ago

Yes, but WebRTC is the one you want to replace with AXE in the future, or not?

draeder commented 2 years ago

Until browsers support listening on ports, WebRTC will never be replaced, not even with AXE. What AXE will do, though, is enable communicating with other peers with it's daisy chaining protocol (gossip protocol), by relaying messages through the peers it is already connected to (via WebRTC).

Some homework: what is Partial Mesh?

worldpeaceenginelabs commented 2 years ago

partial mesh is were groupes of nodes acting, while in a full mesh you have one big group only.

for instance, in my cloud atlas project, people collaborate on places or areas. so why should someone from new york be a node for an event in cologne?

here comes partial mesh into play and builds a fast network of short distance nodes.

draeder commented 2 years ago

Partial mesh is Alice, Bob and Carl are all in a group and Carl, Dale and Ed are all in a group. Alice can talk to Ed through Carl. That is the Gossip Protocol, or Daisy Chaining, in a Partial Mesh network.

If you used WebRTC connections between all peers, it would be a massive performance problem for all of the connected peers.

worldpeaceenginelabs commented 2 years ago

image

ok, this would be my perfect high level abstraction of a true-p2p client.

i know from our conversation, that i still got wrong concepts in my mind 😅

  1. Does the crypto part of AXE cost the user or developer money? Because i want to go non-profit, so i need AXE to have no cost at all. Is it using a blockchain, or is it using just a blockchain mechanism?

  2. What exactly is Bugout used for in your concept? Which use case do you use it for i mean?

  3. Do i understand right, that SEA is what i have here with the three thirdparty logins, but p2p? Distributed on my users, so i dont need to run a centralized server for user login/profile data? https://cloud-atlas.app/

  4. Webtorrents reconnect via a distributed DHT. Is there a repo or concept already, which would have already connected peers via WebRTC, share a distributed WebRTC DHT with the swarm? Like if the client looses one WebRTC direct connection, it has a list with minium 100 other WebRTC ip/port pairs? Or is WebRTC or the p2p repos all using WebRTC (you explained to me) already doing this and i dont get it? 😅 Maybe the gossip does that already? But would a dedicated WebRTC DHT be an advantage or a disadvantage anyway?

worldpeaceenginelabs commented 2 years ago

one of my other fallbacks i was thinking about: "volunteers adding nodes for fallback support (for instance downloadable exe with autostart option)"

i would totally support my favourite website with installing this on my pc. for instance, if i could support wikipedia with this, i would run one of these background windows clients, of course.

same could work for a very reliable p2p maptile server, for a decentralized Google Earth/Maps

btw: whatever api you use for showing map tiles in a map application(cesium js for instance), with adding mishmesh/true-p2p to an application, the downloaded maptiles get distributed(like saved offline forever), without having to write an interface for the tile api and your p2p network. I think that is an interesting finding.

I am sure there is more about to pop up in the future. Like weird, but great side effects of connecting p2p with the website/app environment/concepts of today. (with an eye on storing and caching, which is p2p all about)

Esspecially when it comes in combination with JAMStack and PWA (which are both great concepts for themself already)

draeder commented 2 years ago

Speaking of which, Mishmesh is working between Gun & Bugout!

worldpeaceenginelabs commented 2 years ago

Motivation is everthing :D

worldpeaceenginelabs commented 2 years ago

image NOW i get what mishmesh does. Wooooooow!!! Thats decent. And with so little code. Great!

worldpeaceenginelabs commented 2 years ago

Hope to learn from your commits, how to write adapters

draeder commented 2 years ago

Hope to learn from your commits, how to write adapters

One of the problems with Mishmesh is if you leave the adapter running, it has an event listener leak. Anyway, if you have any comments, problems with Mishmesh, open an issue over there.. 👍

worldpeaceenginelabs commented 2 years ago

Thank you so much for coding Mishmesh, and even in just one night. :D I am instant able to start trying out stuff now.

if you leave the adapter running, it has an event listener leak

something with unregister the event handler if not in use. a heartbeat could tact the scanner rate in general.

I will use it as an opportunity to learn something ;) I have my problems starting a project from ground up, but adding and reconnecting functions of a core repo is what i really grasp and like.

https://github.com/draeder/easypeers/issues/1#issuecomment-1080547585 Could you answer my, i hope, last annoying questions, please? 😅 Because it feels like, i still got some basic assumptions wrong?

draeder commented 2 years ago

Does the crypto part of AXE cost the user or developer money? Because i want to go non-profit, so i need AXE to have no cost at all. Is it using a blockchain, or is it using just a blockchain mechanism?

There is no cost, and it does not use a blockchain.

What exactly is Bugout used for in your concept? Which use case do you use it for i mean?

It can be used for whatever you want. I have used it for a chatting app, Hyperbole, which runs in the browser only, with no server at all, and can even be launched by just opening the index.html file.

Do i understand right, that SEA is what i have here with the three thirdparty logins, but p2p? Distributed on my users, so i dont need to run a centralized server for user login/profile data? https://cloud-atlas.app/

SEA is a security suite that Gun uses for authenticating users. But it can be used independently of Gun for encryption/decryption, too.

Webtorrents reconnect via a distributed DHT. Is there a repo or concept already, which would have already connected peers via WebRTC, share a distributed WebRTC DHT with the swarm? Like if the client looses one WebRTC direct connection, it has a list with minium 100 other WebRTC ip/port pairs? Or is WebRTC or the p2p repos all using WebRTC (you explained to me) already doing this and i dont get it? 😅 Maybe the gossip does that already? But would a dedicated WebRTC DHT be an advantage or a disadvantage anyway?

Bugout, P2PT and Easypeers all do this. WebRTC DHTs have been discussed with WebTorrent. I see you found that issue. If I recall correctly, the WebTorrent developers decided WebRTC is not performant or reliable enough to serve as a protocol for DHT.

worldpeaceenginelabs commented 2 years ago

There is no cost, and it does not use a blockchain.

i meanwhile found some info. its similar to my priority/timeout/ distance/responsetime approach i am thinking of. it has to do with the cloud atlas app, were techniques like pinning(ipfs) for instance come into practical play. (whichs potential use cases is far underestimated)

for instance posts(missions) are related to an area, so i will only connect nodes from the same area of course, which will optimize the dataflow already. nodes are only subscribed to a post, not to another user.

ergo= more users supporting a mission (with joining it, which pins the post), the more available the post gets. this equals more viewers= put post on top of the page i hope you get my point.

It can be used for whatever you want. I have used it for a chatting app, Hyperbole, which runs in the browser only, with no server at all, and can even be launched by just opening the index.html file.

could it emulate or be a p2p node.js server?

SEA is a security suite that Gun uses for authenticating users. But it can be used independently of Gun for encryption/decryption, too.

so it replaces my third-party "sign in with", but i have to store the profile somewhere, for instance gundb.

Bugout, P2PT and Easypeers all do this. WebRTC DHTs have been discussed with WebTorrent. I see you found that issue. If I recall correctly, the WebTorrent developers decided WebRTC is not performant or reliable enough to serve as a protocol for DHT.

yes, i was wondering, why is there no direct connection dht running between the nodes. That he said its not worth it, does not mean, its not worth it ;D

Like with spinach: 100 years long, people were convinced, spinach is rich in iron. A few years ago, someone made a second measure. Its not! :D

worldpeaceenginelabs commented 2 years ago

Since you seem to be obsessed with true open-sourceness (which is good), i am sure you will have a oppionion about this:

I usually dont think in terms of limiting or forcing people, but i thought, why not combining the MIT License and Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) into one "for-nonprofit only" license. (not for this repo, like in general, for ALL open-source software)

The idea behind it is not limiting business. But it would "force" people softly, to do the right thing.

For instance if you do a for profit supermarket, you go for profit no matter what. But with a MIT license but for non-profit only, you as a supermarket, are expected to be fair, sustainable, and the money goes to the fair payed coworkers, the rest to the common good.

its just such a little change in licensing and thinking, but it would totally shift the agendas of business. (and peoples minds, become rich doing good)

its like banning this unfair unsustainable machines we call businesses.

Because non-profit, doesnt mean, you not allowed to make a profit (thats a misconception) but in the case of a non-profit, the money flows were it belongs(legally and morally)

I really love to know your oppinion to this one.

worldpeaceenginelabs commented 2 years ago

https://worldpeaceenginelabs.org/decentralized-non-profit-as-a-service/

wolff makes a strong point in the video. i think what he says could work out with non-profit open source licensing as a standard. becoming the new normal.

draeder commented 2 years ago

As a true free market capitalist, I'm perfectly okay with corporations and businesses making obscene amounts of money. But we as a society don't really have true free market capitalism. We have central economic planning through central banks, governments who set policies that only benefit large corporations, which in turn benefits the government officials through bribes, insider trading (e.g. the US congress legalized insider trading for itself a few years ago, and the president signed it into law). Meanwhile, the average American can't even do day trading unless their account has $25,000 in it.

To me, unrestricted open source software provides equal opportunity for all.

worldpeaceenginelabs commented 2 years ago

I think a MIT-for-nonprofit-only license would keep the unrestrictedness, even stay capitalistic, but without the bad side of capitalistic behaviour. Just removing the psychopathic for money agenda, and replacing it with a makes sense business, earning a shitload of money (because best product in town, for real, not by media propagation)

Dont you think?

Or would i be (unknowingly) the new enemy of freedom, with establishing this movement? 😅

draeder commented 2 years ago

At a philosophical, moral, ethical, and even legally enforceable level, who exactly would decide what is a 'psychopathic for money agenda'? With the MIT license as it is, that choice is up to left up to the developer who uses MIT licensed software. To me, liberty is: not blocking others' ability to exercise their own. See: Negative Rights

worldpeaceenginelabs commented 2 years ago

we are on the same side. but i cant see, how this could block others ability to exercise their own. (which is super important to me)

i am not against anything, not capitalism, nor free market (both cultural technologies we need to improve, and not banishing it) just shifting the purpose of a business endevour. And with that letting our moral abilities come into play again.

no one should decide whats psycho, but some things are obviously not right(kidswork, slavery, dept slavery, money printing, amm)

today, you cant tell nestle to stop stealing water from small villages, and we just accept that some way, even there is some resistance of course.

but if wwf (classic non-profit giant) would go hunt pandas, or greenpeace starts investing into oil, someone would come, cut their power, right? :D

Because its logic! a non-profit doesnt do that. if a non-profit does the opposite of its written down statues, you could even cut their tax deduction for non-profits! ;)

but in a classic business, doing bad things is handled as business as always. an with politicians having shares in this companies, makes it even worse.

But that all said, just by incepting open-source for non-profit only. The already existing machinery does the rest.

draeder commented 2 years ago

When you start to peal back the layers behind non-profits, you'll find many members secretly do the things they claim to be against. The non-profit organization serves as cover for their wickedness. Evil will always exist, no matter what it hides behind.

Your idea is fine, I just personally won't use that kind of license.

worldpeaceenginelabs commented 2 years ago

When you start to peal back the layers behind non-profits, you'll find many members secretly do the things they claim to be against. The non-profit organization serves as cover for their wickedness. Evil will always exist, no matter what it hides behind.

exactly this came to my mind too. we do not living on a ponyfarm, were everybody obeys the moral and laws, because he says so. but the things they do behind closed doors is stuff related to the narrative today.

But if the new narritive was sustainable, non profit open-source, in my oppinion, money would become rather a tool, instead of being the goal. (and third world countries would get vaccin production instructions for free, if it was oh oh oh so dangerous as say said)

And with JAMStack already and coming P2P esspecially, everybody is able to start a global business without cost.

So why not taking what bothers you, look if others have that issue too, develop a solution and make money with solving their problem? Thats a good thing. ( and the actual intention of business in a free market)

I wouldnt even sue someone, not using it for non-profit purposes. Never ever :D

Just want to change the narrative, because people love to do good. And if we tell them, they can be a super hero with starting a non-profit business(which is sexy we say), they probably do.

You get me? ;D

*imagine kids. if you tell them, people like people who do good, they do. we as a species are kids too.

Your idea is fine, I just personally won't use that kind of license.

fair enough :)

worldpeaceenginelabs commented 2 years ago

its not limiting anything. just the narrative changed. sell it for drugs and rock and roll if you like, nobody cares :D

but i want kids say: if i am grown up, i want to start a non-profit like my father. (and get rich)