4.1 Download with GetBlockList and GetBlocks Exchanges

Scenario: Peer P1 is trying to download blocks BN0 -:- BN1 and BN2 -:- BN3 of segment S1 from peer P2.

Download using GetBlockList and GetBlocks request/response pairs

Figure 2: Download using GetBlockList and GetBlocks request/response pairs

Sequence of events:

  1. Peer P1 sends a GetBlockList message (MSG_GETBLKLIST (section 2.2.4.2)) to P2, specifying two block ranges of interest, one for BN0 -:- BN1 and one for BN2 -:- BN3.

  2. Upon receiving the GetBlockList message, P2 gathers the list of blocks it currently has for the target segment S1, it intersects that with the list of needed blocks specified by P1 in the GetBlockList message, and it sends back to P1 a BlockList message (MSG_BLKLIST (section 2.2.5.2)) containing the set resulting from the previous intersection.

  3. Upon receiving the BlockList message from P2, P1 starts downloading blocks by sending a GetBlocks message (MSG_GETBLKS (section 2.2.4.3)) for one block at a time.

  4. Upon receiving the GetBlocks message for a given block, P2 replies with a Block message (MSG_BLK (section 2.2.5.3)) containing the actual block of data encrypted using the crypto algorithm selected locally on the server-role peer P2. The encryption key was previously provisioned on both P1 and P2. Refer to section 5.1 for the detailed requirements on encryption and initialization vector generation.

    The encrypted block and initialization vector are added to the Block message and sent back to the client-role peer. The requesting peer will be able to decrypt the data only if it knows the hash of data of the segment.