Support in using Libp2p in the best way

Hello Libp2p community,

I am facing design issues when i am working on my project. Could someone answer my questions with few examples or gist to use the available libp2p resources the best way.

Below Project Description

I am working on a project which involves 4 main components:

1) Peer Discovery via browsers (even the devices behind NAT).

I am fine with using any protocol suggested either QUIC, WEBRTC etc.

2) Order Sharing (Json order streaming between two browsers)

I am looking for the JSON format of order sharing, I was looking for pubsub techniques. I am okay for any suggestions in this. If it is real time streaming or event driven streaming. I am okay with both implementations.

3) Want to have my Own Bootstrap Server for the private peerstore.(Optional)

I prefer to have a own Bootstrap Server setup, It should only act as peer discovery supporter but not as relay.

4) Only flexible to use Libp2p in either Golang or Js but not other languages(unfortunately)

I am only flexible to use js or go, as I am trying bind the functionality to a website.


  • Could Somone guide which would be better to use either the js libp2p or go libp2p and provide which transport protocol would be best to use?
  • Which routing technique is better Kad-DHT or MDNS?
  • How to enable the order streaming mechanism behind NAT devices?

Irrelvant to answer the above

Currently I was using the 0x-mesh(deprecated version) which uses the go libp2p rendezevous server setup with kad-dht with websocket, I managed to let the peer discovery in it but could not find a solution for the order streaming in it.

I’m not really an expert on anything, but I can say at one time Cobol, BASIC, and JSON were all really popular… but at some point it has to be said if you’re starting a new project with any of these, plz stop.

Thanks for suggestions.
However, we are not coding json. We are just using json format orders to share in js. If it confuses everyone, I must have written normal order data streaming mechanisms

I never understood why anyone with use PHP and not use a WYSIWYG editor… either. It’s like JSON is perfect for editing with an editor and you plan on using JSON, but never plan to use it’s only redeemable feature… I’ll just never understand.

Thanks for your response, I agree with your points but this answer is a bit irrelevant to the current design choice questions. If you could comment about the libp2p js or go comparisions and benefits of using anyone and gist or examples along that would be really great.


  1. For peers behind a NAT, you need a relay node in the Public Address space, at least for determining Server reflexive address,
  2. Order sharing - I don’t see it as a p2p problem, but anyway, once you are able to implement some TURN tricks, then it is as simple as connecting to relay and then sending your packet. If you’re using libp2p, then simple streams would do wonders.
  3. Peer discovery - This is tricky, In libp2p you may use kad-dht, or implement your own routing mechanism, Libp2p is flexible enough to implement your own protocols over streams.

For behind NATs, libp2p already has autonat and auto relays, enable the flags while building host, sit back and enjoy.