From what I understand how IPFS works, adding files on IPFS works like this:
We put a file to IPFS on computer A, it computes [hash]
We enter ipfs://[hash] on computer B
Computer B starts the search on DHT where [hash] is located, this takes a while
When it does, it connects to the peer containing the [hash] and starts to download it (assuming it’s a single chunk file)
OK, but the thing is that when we first enter the IPFS address on the first other computer, i.e. computer B in this case, it takes 10-20 min for smaller files to several hours for bigger files to be quickly available to computer B, because of the slow DHT search. After that, it is quickly available to computer C, D, …
This I think is unacceptable for quickly sharing files with someone or dynamic applications.
Instead, a more rational way for this would be to optionally add to the URI a hint where the file is available, i.e. which peer is the originator. This would hasten the download while the file isn’t popular yet.
For example instead of ipfs://[hash]/ we could have ipfs://[hash]?peer=18.104.22.168/4001 or something similar. Which would mean that the peer 22.214.171.124:4001 has the [hash]. That way IPFS could do a DHT search + automatically add the 126.96.36.199 peer as having the [hash] and thereby speed up the whole process of initially puting files on IPFS.
What do you think?
Am I misunderstanding how IPFS works?
Is this a bad idea?
I bounced the idea on #ipfs@freenode and the ones that responded seemed to like it.
There are some unknowns, so if we introduce support for this type of hint to tools like IPFS Companion, we should make it an opt-in experiment (ipfs-companion/issues/722)
While I see the appeal of this speeding up things like sharing apps, I am bit worried that this type of hint becomes a p2p version of ping attribute used for tracking. Imagine link-specific peers that are listed as provs but do not host data, just log IDs of peers connecting to it
IPFS team is considering to implement similar feature in IPFS gateway.
So after we ipfs add some data in node A, then we can fetch it in IPFS gateway, with the IP address of node A specified, so as to help the gateway find the data faster.