Incomprehension of ipfs


Here’s my problem…

echo “helloworld” > test.txt
ipfs add test.txt
ipfs cat (That return helloworld)
ipfs pin rm
rm test.txt
ipfs cat (That return helloworld again,…)

and on to…

Can you explain that to me?

With default settings, your test text file hashes to QmUU2HcUBVSXkfWPUc3WUSeCMrWWeEJTuAgR9uyWBhh9Nf. I can’t currently find any nodes with that hash and it doesn’t currently resolve for me on The only reason I mention this is because it doesn’t seem like anyone else has that file; your node was likely the provider in both instances.

ipfs pin rm <hash> doesn’t delete the content itself from your node’s repository. It only unpins it and makes it subject to garbage collection. If you wanted to remove the content from your node before trying ipfs cat <hash> or retrieving it through, then you should run ipfs repo gc to run garbage collection to delete all of the unpinned content on your node.

Because you didn’t run garbage collection after adding the file to IPFS with ipfs add test.txt, when you ran ipfs cat <hash> it would have just pulled it from the IPFS cache on your node. When you tried to retrieve it through, likely would have pulled it from your node and then sent it to you through the gateway.

1 Like