About the availability and distribution of IPFS

Nice to meet you.

I want to know about the availability and distribution of IPFS.

For example, if you build an IPFS node yourself and do “ipfs add” from that node
Unless other nodes do “ipfs cat” and download, I think that it will not be distributed save actually.

In other words, even if node A add file x with "“ipfs add”, file x is exists only node A,
File x is not exist at other nodes at this point.

And if node A deletes file x with “pin rm” and “block rm”, file x will be lost on the IPFS network.

Is this understanding correct?

Also, upload the file via infura.io getway, then if no one download with “ipfs cat”, will that file disappear?

Hi, Satoshi.

You are correct to an extent. When you build your IPFS node and you add a file to IPFS from your node, the peers you are connected to will pick up the file as well.

If you do not want IPFS to “garbage collect” your file, you need to pin the hash after you add it to the network.

That can be done by using this command:

**ipfs pin add -r [hash]**

That way, your file will stay on your IPFS node.

You can also see what files you’ve added or pinned from other hashes by typing in this command

**ipfs pin ls --type=recursive**

Remove the flag --type=recursive from the code above and you’ll be able to see all the files YOUR node picked up from other peers. They will be designated by “indirect”.

Hope this helps. Let em know if you have any other questions and I’ll do my best to help since I am still learning IPFS as well.

Pavon

Hi Pavon.

Thank you for information.

>the peers you are connected to will pick up the file as well.
I think the pick up is not actively picking up.
It mean, the peers will not picking up as automatically.
So, the file that is uploaded to IPFS is not saved distributed if no one else of “upload node” pick up the file.

And,

This is the same even with “ipfs add pin”,
If that node does “ipfs add pin rm”, I think that the file is not saved permanently.
Or, if the node that did “ipfs pin add” is disconnected from the network or if the disk or file is bloken, I also think that the file is not stored permanently.

Also, About the availability and distribution if using infura.io,
Is file persistence the same as above?
Is anyone familiar with it?

Hi Satoshi,
I agree with your findings. The pick by the peers is not automatic.
If nodeA adds a file <D> to the IPFS through ipfs add <D>, then this file will be present only with nodeA, unless some other peer (say nodeB) fetches it using the hash. Fetching can be done using ipfs cat <hash> or ipfs get <hash> (I know these two methods only).

When we execute ipfs add <D> there is a flag pin which is by default true. It pins the hash with the node after generating it. Pinning refers to the fact that the garbage collector can not delete this data.
If you want to disable the default behavior, modify the command to ipfs add --pin=false <D>.

This can be verified by executing the garbage collector voluntarily by ipfs repo gc command and then checking the pinned hashes using ipfs pin ls command.

When the nodeB fetches some hash from the peer nodeA, by default it gets the unpinned data, meaning, when the garbage collector runs, this data will be deleted from nodeB.

Since the data is not automatically replicated across the peers, if the parent node (nodeA in our case) deletes the data before anyone else replicates it, the data will be lost.

I have not come across infura.io.