How do one store its data on peer nodes


I joined IPFS p2p network by running “ipfs daemon” for 3 hours.
I added some log in the flatfs datastore codes.
From my own logging, I can see I received a lot of “GetSize” requests, which all return -1. I think this is because many other peers are trying to check if my node has the data that they want.

However, I never receive “Put” requests during those 3 hours. So I assume no peer tries to store their data on my node.
This is weird to me because I thought peers can request to store data on each others’ nodes in this distributed network.

So my questions is:
If I want to store my data on a peer node, how should I do that and what will happen?


This is incorrect. You only store data that you access. So for another node to store your data, you’d have to have data they’re interested in, and once they retrieve it, that data will be re-served on their node until garbage collection. If another node pins your data or adds it to their MFS, it will be retained through garbage collection.

I hope that helps :slight_smile:. Feel free to ask more questions, happy to help!

1 Like

By storing you mean caching, I assume.

your node will never store any data on it’s own. The data which is already available with other nodes will be accessed and then saved on your node only when you access the data using your node.
After this happened, that data will be cached on your node for the time/storage volume setting set on your node. After that, it will be garbage cleaned.