I’m looking for a simple demo of a network of decentralized nodejs servers that use Helia/IPFS to share JSON data. Thanks!
I don’t think we have exactly this kind of demo, but there are a number of Helia examples here GitHub - ipfs-examples/helia-examples: How to do most anything with your Helia node
Thank you, yes I found the Helia examples but didn’t see anything resembling an actual demo. Maybe I missed it?
The following example:
- Shares JSON data using Helia in a local network
- mDNS is used for the two Node.js Helia nodes to discover each other
- A custom libp2p protocol is used to inform the client about the CID
- The bytes for CID is fetched using Bitswap
To make this work over public networks, you’d probably want to use the DHT for peer discovery and each of the nodes would need to know the Peer IDs of the other nodes (so that they can look up the DHT to find the addresses and connect). Another thing to consider is that if you’re behind NAT or Firewall, you will need to add port forwarding or use DCUtR to hole punch.
I was unable to get the helia-lan-discovery example to work, so logged an issue.
Even if it did work, using DHT for peer discovery and how to deal with firewalls is precisely the demo I’m looking for.
I found universal-connectivity which looks very promising, but could not get that to work either. The js-peer runs, but the client get stuck on initializing libp2p.
It seems the project creator (who looks remarkably like you @danieln) can’t get it working either
I’ll try to get something up soon as soon as I have more time.
Can you be more specific about what is not working?
Out of the box, the frontend requires a bootstrapper (either the Go or Rust peers). The hosted one we had running is no longer running. But you can run the Go or Rust peers and update the default bootstrappers in the frontend.
Another thing worth pointing out is that node.js and browsers don’t support the same transports. Node.js is limited to TCP, UDP, WebRTC and WebSockets. Browsers are limited to WebSockets, WebTransport (Chrome only), and WebRTC (see https://connectivity.libp2p.io/)
That would be much appreciated, thanks!
Yes, that would explain the issue I was having. Since the hosted nodes are no longer running, the js-peer no longer works without code changes.