I am just following the Helia Example, Helia-101.
I cloned the repo. Installed the dependencies by running npm install. And modified the data which generates CID at this line. And once I have new CID, I am unable to retrieve the content from a gateway like ipfs.io.
Now I understand that my node is not accessible through the IPFS network. But as these are examples for beginners I expect them to show a warning or error stating that there is some issue and my node is not accessible.
How to resolve this ? Has anybody tried this before ? Is this to do with firewall ?
EDIT:
After the guide:
I was able to fetch my content from gateways.
But I still am not able to fetch content stored on IPFS with a in browser Helia node.
This is my CID: QmaypwhCRNyfLbZhNhvyBgjjPdkJVa4c5noUVuUUSLCc7p
I am able to fetch the file from a gateway. But not from a Helia Node, maybe I am doing something wrong. From the Helia Script tag example, I am running the following code block in browsers console, it doesn’t show anything, even after waiting for longer duration.
async function catFile () {
const textDecoder = new TextDecoder()
for await (const data of heliaFs.cat('QmaypwhCRNyfLbZhNhvyBgjjPdkJVa4c5noUVuUUSLCc7p')) {
console.log(textDecoder.decode(data))
}
}
await catFile()
I am not sure if a helia node is already connected to the Network by default or should some configuration be done so that it can fetch content from other nodes.
If possible please give me a minimal example where I enter a CID and get the contents of file. Thanks
The exercise mentioned to retrieve data from a in browser Helia node, is also useful when you want the in browser Helia node to fetch content from the network. When you manually dial to the browser node from your native IPFS node, and your native IPFS node has that CID then the browser node is able to fetch it.
Still WebRTC is not completed rolled out it seems, and till WebRTC isn’t fully propogated throughout the IPFS network, a helia browser node won’t be able to fetch data from a native IPFS node. Or vice versa.
as @SgtPooki , I am unable to fetch data directly in a Helia node. According to what I observed it seems that fetching data is also not supported properly (I wasn’t able to fetch data in a browser helia node).
As for fetching data from IPFS with Helia, this should not be a problem assuming your Helia node can make connections, and the provider of the CID has publicly diable addresses.
If so, is your node publicly diable? I can’t seem to access it from my Kubo node, but ipfs.io can for some reason. @achingbrain or @adin might have better ideas about what’s happening.
The output of the “Fetch content” util is really messy right now but you can see entries confirming that helia gets the blocks and adds them to it’s blockstore:
bafyreigs4qq4w4lmjmqr7eagage77biquyb2qg5ptnhc4jc4uwfk4abrbi and bafybeiaxuasctnq3sgwwgtgdk6q2rlvuwe4s37bfzin7z7cnt6byesdpvq both return the following output:
bitswap:want-block:block: CID
bitswap:want-block:block: CID
blocks:get:blockstore:put: CID
NotAFileError: not a file
The Error there is just because i’m calling fs.cat(CID) on a CID that isn’t unixfs. If I were to use dag-cbor (or whatever appropriate codec), it would return the appropriate results.
Testing a unixfs image I have pinned at web3.storage, via CID bafybeien3lgc32mbdtjmggs6mssvic35ho5r7zavsutckkyo4qyn6jd7e4, breaks the page, but checking the console, you can see that we’re getting the actual content:
If you haven’t seen https://pl-diagnose.on.fleek.co/, I would highly recommend checking it out. I tried debugging your CID on pl-diagnose and wasn’t able to get to a success on " 4. Is my node serving the content?" even though the rest were successful. Maybe you will have better luck?
I was able to retrieve your content from my local kubo node though, with
> npx -y kubo dag get QmXnnyufdzAWL5CqZ2RnSNgPbvCc1ALT73s6epPrRnZ1Xy
{"Data":{"/":{"bytes":"CAISFEknbSB0cnlpbmcgb3V0IElQRlMKGBQ"}},"Links":[]}%
> npx -y kubo cat QmXnnyufdzAWL5CqZ2RnSNgPbvCc1ALT73s6epPrRnZ1Xy
I'm trying out IPFS
@polus-arcticus one problem with fs.cat on that CID is that the CID is a directory. Using kubo and trying to cat the content results in Error: this dag node is a directory