I have a question regarding the way IPFS finds content in the network.
I have an IPFS node running with let’s say the peer ID “ABC” and added a file to the network with the CID “XYZ”.
Now I’m trying to access the file “XYZ” through one of the public gateways. If I understood it correctly first the gateways IPFS node sends Bitswap messages to its direct peers and asks for the “XYZ” content. This will most likely fail because my node is presumably not directly connected to the gateway. As a result the gateway will fall back to query the DHT.
In a Kademlia backed DHT it is unlikely that the CID “XYZ” will have its closest distance to my node “ABC” so querying the DHT for “XYZ” will result in a peer with ID e.g. “XYW”.
I’m clearly misunderstanding something here because the public gateway is able to query the content. Did my node put the file onto the peer “XYW” or how is the network able to find my node to fetch the content?
I hope you folks can help me out.