mit-dci / lit

Lightning Network node software
MIT License
551 stars 119 forks source link

libp2p project from the hackathon #169

Closed kulpreet closed 6 years ago

kulpreet commented 6 years ago

Hi all,

On the spreadsheet listing projects for the L2 hackathon, I saw a suggestion of trying out libp2p for the p2p communication for lit. Also, on the road map (https://github.com/mit-dci/lit/issues/30), I saw a mention of NAT traversal and hole punching.

I wonder if there is any interest in this as importing libp2p goes against the "not invented here" syndrome pointed to in the contributions guidelines.

Thoughts on trying libp2p, as an experiment?

Varunram commented 6 years ago

@kulpreet yeah, libp2p is nice, I have an implementation ready, but it has a few kinks such as not being able to serve a rpc connection (issue: https://github.com/hsanjuan/go-libp2p-gorpc/issues/12). Once that's done with, I'll put in a PR and we should be good.

Varunram commented 6 years ago

Okay, so I was talking to a few folks from libp2p while trying to implement this and found a couple of things:

  1. We need our own peer discovery thing if we are to use libp2p. For e.g say I have a URL like /ip4/<ip>/tcp/8001/ipfs/QmUsWKBMNckswS4gzTCYhTbwkv2cUBPSxShL6pEfnofnKN and I want to connect to it, I have to write my own s tuff which actually looks up at that ip and says hey, I want to connect to this node. This defeats the point because you essentially need to write wrappers on top of something which we can assume should be done implicitly ie I need to be able to connect to you if I gave you the id and the ip.

  2. The NAT traversal package seems to be not that well maintained, so some of the stuff may be incompatible with what we want

  3. The entire process seems to be a drag: for eg. once you give an URL, I need to decode it and convert it into something which is known as a peerID and then I have to use that peerID in order to call the ip and then connect.

  4. libp2p can't make queries if both the server and the client are on the same host. So you need to pass in an ugly param along with lit-af in order to make this run. Or store the local address somewhere and call it from that.

This being said, I do have a some what okayish implementation over at https://github.com/Varunram/lit/tree/libp2p. It doesn't get the rpc client right because I didn't want to write a "peer routing" protocol (as in ipfs). However if someone can build upon this and get NAT traversal (which is like the only bonus we'd get), that'd be good.

alindr commented 6 years ago

@Varunram what's the status on this? should we prioritize it or remove it?

Varunram commented 6 years ago

@alindr I think it would be better we close this for now as libp2p doesn't seem to be a good fit into the current lit codebase.

gertjaap commented 6 years ago

Closing this by suggestion of @Varunram