Expansion of Layer0 layer to be the CDN of the blockchain

Recently researched the Bloxroute project, which is relatively unique in the expansion plan. It refers to the idea of ​​the CDN in the Internet era. It basically does not move things related to consensus, but re-constructs a centralized network through certain technologies. To accelerate the spread of the entire block, the scalability and performance improvement are very good, and the entire technical solution is also very interesting.

Blockchain distribution network

 

Bloxroute builds a high-throughput, low-latency network by deploying servers around the world. The servers in this network are called relays. This network is optimized to quickly propagate transactions and blocks in the blockchain. In order to allow the nodes of the blockchain to communicate with this network, a set of gateway software has also been developed that allows messages in the blockchain to interact with the BDN protocol. The details are shown in the following figure:

Role in the network

There are several roles in the entire BDN network:

1.Gateway

2. Relay (transaction relay and block relay)

Control plane

4.Remote blockchain nodes

Gateway:

The gateway is an application that can connect your blockchain full node to the BDN. The gateway can transfer blocks and transactions to your full node faster than the blockchain's P2P network. For a blockchain full node connected to the gateway, the gateway is transparent, just like another node, but because the gateway does not save the state of the blockchain, the gateway needs a remote blockchain node to respond to the node's request .

When the gateway is turned on, the user needs to specify an IP, and then the gateway connects to the control plane and provides its IP. The control plane returns a set of relay server lists closest to the gateway based on the geographic location of the IP provided by the gateway, and pings To confirm the lowest latency relay server, thereby improving the efficiency of transmission.

relay:

Relay is the backbone of BDN. Relay servers are located all over the world, providing faster transmission services to blockchain nodes in various places.

In order to improve the transmission efficiency, two types of relays–transaction relays and block relays–are designed to transmit transactions and blocks in the blockchain respectively. This design can ensure that transactions and block transmissions do not affect each other.

Although the transaction relay and block relay are logically separated, they can physically provide transactions and block transmission services through different ports on the same machine.

Control plane:

The control plane is mainly responsible for providing the gateway with the lowest delay to the gateway connected to the BDN (based on geographic location information)

Remote blockchain nodes:

When the gateway communicates with the full node, it uses the native P2P protocol of the blockchain, but because they are not full nodes, they cannot complete some full node functions, such as verifying whether a block is legal. At this time, if The nodes connected to it cannot respond to the gateway's request for information. Therefore, some remote blockchain nodes need to be deployed to help the gateway respond to normal blockchain requests.

From the whole design, I saw the design method of high-end routing, that is, the idea of ​​control plane and data plane, which is of course related to the team's own network background.

Through a set of networks established by these four roles, servers that are closer in location and lower in latency can be used to propagate blocks, thereby achieving the purpose of improving performance. Of course, this is only to improve performance from the network topology itself. In fact, Bloxroute also further improves the transmission performance from other aspects.

The key to high performance and scalability

In addition to network topology optimization, Bloxroute also uses transaction index-based block compression technology and straight-through routing technology to improve performance.

Block compression technology based on transaction index

We know that in the blockchain, after each transaction is generated, it will first enter a transaction pool, then spread through the P2P network, enter the transaction pool of each node, and wait for packaging by miners. In Bloxroute's scheme, when an unverified transaction is transmitted to the relay, a unique short ID (transaction index) is generated to correspond to this transaction, and then this sID and transaction are transmitted to other relays together. Then, the relay synchronizes the transaction index pair to other gateways connected to it. The specific process is shown in the figure:

After this round of propagation, all the gateways contain transactions and transaction indexes. At this time, it can't play a role. You need to wait for the miners to mine the block.

We know that after the POW competition, miners include unconfirmed transactions in the block and spread them. When the miner sends its new block to the gateway, the gateway will send the The transaction part is replaced with an index (if there is no index, the original transaction remains unchanged), because the transaction index is generally only 4 bytes in capacity, so replacing it all at once reduces the size of the block a lot, so as to achieve the purpose of capacity expansion .

Then the gateway will say that the compressed block is propagated to the relay and further to other gateways. At this time, the gateway needs to restore the compressed block. First, it will find its own cache according to the index. , It will request the connected gateway to restore, if it still cannot restore, it will directly discard the compressed block. If the compressed block is successfully restored, the gateway will transfer the restored block to the full node connected to it.

Bloxroute's transaction compression is a very colorful part. In the entire block itself, the block header occupies only a very small part, while the transaction in the block body occupies the bulk, which is very difficult to compress in the P2P network of the blockchain itself, because It also involves the issue of block and transaction verification, and there is no need to manage these things in BDN. As long as the correspondence between transactions and transaction indexes is not wrong, compression can be very convenient.

Straight-through technology

In the blockchain's P2P network, any block needs to verify its validity before being transmitted, so each node must accept all the information of the block, and then it can be transmitted to the next node after verification. In the BDN, there is no need to verify the validity of the block, so when the relay receives a network packet from a block, it does not need to wait for other network packets to arrive to form a complete block, but immediately transmits this packet to the next A relay or gateway to go, thereby improving the efficiency of transmission.

We can see in the figure that the relay does not wait until all the blocks are received and then propagate. Instead, the relay propagates immediately after receiving a part.

end

Bloxroute has used very delicate methods to expand the capacity. It is less invasive to the blockchain, highly scalable, and has improved a lot of performance, but good technology also needs market promotion. We wait and see for this project.