Block Compression
Last updated
Last updated
bloXroute uses compression to enable faster propagation by reducing the size of blocks. Compression is enabled through the use of transaction caching and indexing. A unique feature of bloXrouteβs BDN is that it propagates and indexes transactions in addition to blocks. As a result, transactions are already known when itβs time to send out the block (as an unconfirmed transaction stored in the mempool, rather than send a block with βrawβ transactions), the BDN sends just a few bytes representing the transaction. It does this by indexing the transactions, and then utilizing the indexes when transmitting blocks.
The transaction propagation process operates as shown in the figure below. A transaction is generated from a blockchain node and sent to its peers including a Gateway. The Gateway then sends the transaction to its Transaction Relay server for propagation. The Transaction Relay assigns the transaction a 4-byte internal ID, called a short-ID or SID, and sends the transaction/ID pair to the rest of the BDN (including both Relays and Gateways). Occasionally two Transaction Relays will receive a transaction at the same time and each issue the transaction a separate SID. However, because each SID uniquely maps to a single transaction, these redundant SID assignments are not an issue, and the redundant SID assignments will be stored in the transaction cache without issues.
The receiving Relays and Gateways keep track of the transaction/short-ID pair in their transaction cache. Additionally, the Gateways forward the transaction to the blockchain full node. The blockchain full node then validates the transaction and adds the transaction to its mempool, if appropriate.
When a miner builds a block, its blockchain node sends the block to its peers including the Gateway. The Gateway replaces each transaction with a 4-byte SID, effectively compressing the block size by more than 100x (given that the average raw transaction is approximately 500 bytes, the index size is 4 bytes and the Gateway has a full mapping of the transactions that exist in the block). If a transaction in a block has no SID, it is not replaced in the block.
After compression, the Gateway sends the compressed block to its Block Relay which propagates the block throughout the BDN using cut-through routing. The block is received by other Gateways, which reconstruct the original block.
For each SID in the compressed block, the Gateway looks up the SID in the transaction cache. If the SID is found in the transaction cache, the SID is replaced with the corresponding transaction. If a SID is not found in the transaction cache, the Gateway requests the missing SID/transaction pair from its Transaction Relay. If the Relay provides the SID/transaction pair, the Gateway replaces the SID with the newly received transaction. If the Relay does not provide the SID/transaction pair, the Gateway discards the compressed block. In the case that the Gateway was able to decompress the block, the decompressed block is then sent to the blockchain full node.