About the platform

Published 16 October 2018

Distribution of blocks over the network

Distribution of blocks over the network

The principle of block distribution to all network participants:

A node that needs to send an N block over the network breaks it into packets.

The packer format is provided in table 1 (UDP headers are not included in the packet structure).

Table 1: Packet block structure

Field

Size (bytes)

Description

Num

2

Counting number of the packet block

Total

2

Total number of packets to which the block was split

ID

8

The unique identifier of the block generated by the sender node [1] when splitting the block into packets. Uniqueness is provided within the sender node.

pub_sender

32

Node public key of the block creator. The field is added to test forwarding

DATA

Block contents


The main stages of block distribution in the form of packets between network nodes:
 

  • Node "1" has formed a block, broke it into packets and sends it to neighbouring nodes.
  • Node "2", having received the packet, creates a local buffer for the block N and adds a record to it that "packet #1 of block N" was the first to arrive from node "1".
  • Node "2" sequentially distributes the received "packet #1 of block N" to its neighbouring nodes (excluding the sender node). For clarity, node "2" passed this packet to node "4".
  • Node "4" creates its local buffer for block N and writes to it that "packet #1 of block N" came first time from node "2", after which the packet is sent to node "3".
  • After some time (simultaneous reception of packets is impossible) "packet #1 of block N" arrives on node "3". Node "3" should add a record in its local buffer for block N that "packet #1 of block N" (or block packet with any number) came from node "1" as second, and send to node "1" the "rejection of block N reception" packet. (the structure of the "rejection of block N reception" is shown in table 2). Having received another packet of block N (with any number) node "2" should bring the sender of the package third to the local buffer for block N, reply to the sender with packet "rejection of block N reception" and act in the same way for all the following packets of block N.
  • Node "1" after receiving the "rejection of block N reception" packet from node "2" stops the transfer of the rest of the block packets.

In the considered situation, node "3" reduced the traffic on its network interface by not reaccepting the whole block from node "1".

Table 2: Structure of the "rejection of block N reception" packet

Field name

Length (bytes)

Description

#hash

32

Fields hash (ID, Total, pub_sender) by which the node can identify the block


Each node should have a simultaneous storage of up to 64 local buffers of blocks, which will allow to carry out parallel reception/forwarding up to 64 blocks. The local buffer is cleared when the whole block is received, or by timeout.

0 Useful article

Contents