I’ve been looking into IPFS for quite some time now, but recently I’ve been wondering what exactly happens when I call "ipfs get ".
The code is quite helpful for answering this, but I’m somewhat confused by the interplay of bitswap and the DHT.
What I though was happening:
- “ipfs get < h1 >”, where h1 is a multihash
- Propagate h1 to the network subsystem, resolving it in the process
- Find providers for h1 (or its children)
- Query these providers for the corresponding block(s)
In my understanding, bitswap only came into play in step 4). But the specs say, that the current wantlist is propagated to the peers we are currently connected to. If this is true, wouldn’t this completely bypass the DHT? If I’m asking all my neighbors for blocks anyway, do I even need the DHT in the first place?
I’m sure that I misunderstood something here, so any help or clarification would be greatly appreciated!