Please note that I am sorry if this question is based on ipfs
, where I am using integrated to Ethereum but in a very basic manner.
In this following example: a client stores a ipfs hash value inside a contract at ethereum. Server would access to already stored ipfs hash value by using the same contract. When ipfs hash value is obtained at the server, server node could obtain the ipfs file by using ipfs {ls||cat||get} < hash_value >
. But when I use ipfs {ls||cat||get} < hash_value >
there may occur a halt. Since I am doing all this process inside a script halt problem locks my script.
On the contrary I could obtain the files from ipfs.gateway
(which uses public gateways) using wget
(this process force gateways to cache the content till its garbage collector clear up the disk space).
[Q] Should I try to retrieve files using wget -r "https://ipfs.io/ipfs/< some_hash >"
since its connection seems more reliable than using ipfs {cat||ls||get} < my_hash >
? I am not questioning ipfs
, I just want to learn what my cause this problem or where I made a mistake and come up with a solution. So far using wget
through ipfs.gateway
solved the halt problem I am facing with.
Please note that my server runs behind a firewall (on a university domain, so there has to be a firewall). On my case if my client on the same LAN behind the same firewall, there is not halt issue between my client and server. But if the client is outside of the LAN, it halts as I explained. The problem may arise because of the firewall, but the public gateways still could retrieve the added data via ipfs, from my server?
Explanation of this question as follows:
I have a client and server node. On both machines, on the background I am running the following command as guided on the ipfs
tutorials:
ipfs daemon &
On my client machine, I have add a file into ipfs:
[~]$ ipfs add hello.c
added < my_hash > hello.c
After that on my server, I do try to retrieve the file:
[~]$ ipfs {cat||ls||get} < my_hash >
//HALTS.
Following error message showed up multiple times.
14:18:59.986 ERROR dht: no addresses on peer being sent!
[local:<peer.ID UjQJqD>]
[sending:<peer.ID aYb9MJ>]
[remote:<peer.ID Z86ow1>] handlers.go:75
ipfs {cat||get||ls} < my_hash >
halts and I do wait a long time but nothing happens, maybe after few hours it works (The system acting unreliably on my case). This situation is weird because same process was working before without any problem and suddenly it may stop working as it should be.
On the other hand, I can see the file right away at my browser after ipfs add
is done: url:https://gateway.ipfs.io/ipfs/< some_hash >
or could download the file using wget -r "https://ipfs.io/ipfs/< my_hash >"
".
Please note that if a folder added into the ipfs add -r folder_name
it could retrieved from folder's hash with the following command:
wget -nH --cut-dirs=2 --no-parent -r -l 0 -nc "https://ipfs.io/ipfs/< folders_hash >"
Thank you for your valuable time and help.