Ipfs CID still accessible after gc

Hello community!

I am very new to ipfs project and currently testing and trying, so i can wrap my head around it.

To the situation:

I have 2 computers on my desk. On PC1 created a file and added it to ipfs (ipfs add filename). On PC2 i created the same file and added to ipfs also. Now i have same CID on both peers

In my browser https://ipfs.io/ipfs/CID show me the file content.

On PC1 and PC2, when i run the command:

ipfs dht findprovs CID

i see both PC1/2 peerIDs. So far, so good

Then, on both PCs:

ipfs pin rm CID


ipfs repo gc

After pin removal and G.C., on both PCs i check if the CID is there:

ipfs refs local | grep CID

no result. So garbage collector works. None of the peers have it locally

https://ipfs.io/ipfs/CID (no cache)
is still working.Where is the content served from, since both peers garbage collected it?


ipfs dht findprovs CID

still show my both PCs peerIDs

I cannot understand. Am i missing something?

Thank you in advance and excuse me, if the question is badly explained!

The gateway still has the file cached so that’s why you can still get it.

As for the DHT the record expire after a certain time.

It expires after 24h, by default.

Records on the DHT won’t expire for 8-24hrs. so someone might request it from your node when you don’t have it but it just won’t respond and it will get the file from some other node.

The gateway will cache it assuming someone (possibly you) request it. If you didn’t request it there is the possibility that what you added was so common or trivial that it was already being hosted by someone else like if you added a file that said, “hello world”.