When will the block exchange by BitSwap?

When will the block exchange by BitSwap?

In the IPFS white paper, it was written that blocks were exchanged by BitSwap.
In my understanding is, The block is
・Uploaded data itself
・Files linked to Merkle dag format
・ Or part of the file divided into Merkle dag format

It seems to be written that these blocks are distributed among nodes.
When will it be distributed (or exchanged?)?

If it is distributed when another node downloads the file,
After downloading the file
・Uploaded node
・Downloaded node
・Nodes distributed by BitSwap
the file (or part of it) is cached and distributed in above nodes?
is this understanding is correct?

It will be shared when other peers request the block.

Just to be clear, when you upload a file it doesn’t get pushed to other peers in vanilla IPFS. So I think the second and third point in this list are the same if only one peer has requested a block from the uploading peer.

@leerspace
I think when downloading the file, it will looking for the node where the file exists in the P2P network.
If the file is found, does it establish a P2P network connection directly with the node that has file when downloading?

when download, are file(or the part divided by Merkle DAG) spread only to the following nodes?
1:download node.
2:node that has the file.
In other words, actually file are spread to only one node when download?
Is the file spread by traffic the network when downloading or searching for files?

Yes, it uses the DHT to find peers who say they can provide the requested content.

I think this is the case, except for instances where the peer is advertising addresses through a relay (if it has poor connectivity).

Yes, my understanding is that this is currently the case.

If only one peer requests it, then yes. But, for example, if thousands of peers want the content then it’s spread to thousands of peers.

I’m not sure I understand this question.

@leerspace
What does “exchange” written in Document mean?

If the other node just downloads the file, I think it hasn’t exchanged anything.

For example,

  • As a result of file search by node A, download from node B
  • At this time, if A has a file that B does not have, send that file to A instead.
    Does this mean that this happens automatically?

I had forgotten some of the details in the draft v3 of the whitepaper so I looked through it to refresh myyself. I think a the bartering and especially the part about requesting rare blocks on behalf of other nodes are not reflective of the current implementation of bitswap. Having other nodes request data on behalf of your node could be a problem in cases of regulated content (e.g., copies of copyrighted works, etc).

I think the document is referring to an exchange of blocks between peers – where each peer is getting a block that it wants as part of the transaction. However, I don’t think this is how bitswap currently works; rather, my understanding is that peers altruistically provide blocks to whoever wants them without requiring blocks in return.

I think you’re technically right in practice, since it’s a one-way transaction. The downloading peer didn’t need to give anything to the providing node in order to get what it wants.