Open Data Hack - Questions, comments, and discussions from the hackathon!

hey @SgtPooki i was digging around and found this Helia Example doesn't work - #6 by SgtPooki so i tried my cid with the networking 301 and i got the same hang on the for await (const buffer of fs.cat('cid') using PL Diagnose
i’m wondering what the difference is between a provider and a peer in the dht - my understanding was peers are providers, but they seem different

That’s a good question, peers may not be providers of content you’re requesting.

  • A peer is another IPFS node you’re connected to.
  • A provider is an IPFS node that has explicitly announced they will provide some CID(s)
  • A content provider is not a peer unless you’re connected to them.

If you request CID “foobar” and are connected to 5 peers that don’t have that content and aren’t DHT servers, then they need to propagate your request to DHT servers to find out who does have that content. This is the “findProviders” operation on the DHT. You can also check https://cid.contact/ for finding providers, or use GitHub - libp2p/js-ipni-content-routing: Use an IPNI service to discover content providers with Helia to programmatically call cid.contact to get providers.

Once you have some providers of your content, you can then request that content from those providers, which will require you to connect to those providers (making them a peer) and then request the content from them.