I will attempt to keep this thread up to date with questions & comments from the Open Data Hack to help the Helia community benefit from all the great hackers from the Open Data Hack. Shoutout to encode.club!
- Is there any easy to follow tutorial maybe? First Time working with Helia
A great set of starter projects is at GitHub - ipfs-examples/helia-examples: How to do most anything with your Helia node
the helia-101 goes through the basics, and other examples show use with particular frameworks or accomplishing certain tasks.
I’m using helia to fetch content generated from lilypad. My ipfs daemon fetches the content fine, but ipfs.io/ipfs and my helia node are having trouble. Looking into the libp2p methods its not clear how I can manually add my daemon inside helia to speed up the fetching, any advice?
You’re talking about hooking them up with a Kubo daemon, right?
You’ll want to use GitHub - libp2p/js-libp2p-delegated-content-routing: Leverage other peers in the network to perform Content Routing calls. and GitHub - libp2p/js-libp2p-delegated-peer-routing: Leverage other peers in the network to perform Peer Routing calls. with the kubo-rpc-client library (shown in the README as an example)
We use the delegated routing with helia in explore.ipld.io and it works pretty great: https://github.com/ipfs/ipld-explorer-components/blob/73799f8f895c60479e931175d0a1496d6d5a35ee/src/lib/init-helia.ts#L28-L35
Okay, i dont know if you remember this, but i’m running into the same error when fs.cat is in a suspend state so it hangs the thread Feature/ Helia React Vite Example by polus-arcticus · Pull Request #16 · ipfs-examples/helia-examples · GitHub
given this issue was resolved by putting fs in the react hook, i suspect it has something to do with putting fs on the class object https://github.com/polus-arcticus/obsidian-lilypad/blob/442cc13dd0553fa00c577f98242709a73f4278a8/main.tsx#L105 going to try to start helia in an auto execute function next and make it global in scope, perhaps this will help in my situation (edited)
That issue seems familiar but I don’t remember the exact cause. One reason fs.cat can hang is because it’s trying to get the content and waiting forever. You can pass a signal
so that the request times out after a given time.
Also, you can enable debug logging via localStorage.setItem('debug', 'libp2p:*,-libp2p:connection-manager,helia:*,-*:trace')
or similar to see what is happening behind the scenes (you may need to adjust debug scopes to get the logs you want/need)
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.
also with the kubo delegate i’m hitting a cors issue, wouldn’t be a problem but i’m building a plugin for a program that uses chromium on its backend that has special rules around getting around the policy
You may need to update your ipfs config for kubo to allow the appropriate origins and methods:
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://localhost:3000", "http://127.0.0.1:5001", "https://webui.ipfs.io", "YOUR_DOMAIN" ]'
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "POST", "YOUR_METHOD"]'
gave a cors a try, i think this one has to do with the app i’m plugging helia into. Its a stand alone app thats built on top of chromium, their solution to getting around cors is CORS problem with library - #2 by Licat - Developers & API - Obsidian Forum using a special request library that skips cors checks
NOTE: The user above is building a plugin for obsidian; is an electron app that forwards some requests to the kubo node behind the scenes. There is still an ongoing investigation to what is going on here. Some sample code was pushed to GitHub - polus-arcticus/obsidian-lilypad at test/cors-kubo