The Compact Blocks or Compact Blocks is nothing more than a small adaptation to the way in which the protocol can transmit the information of the blocks between the nodes that make up the network.
UOne of the main tasks of developers of Bitcoin is to make the network more efficient and scalable, so they research and develop different techniques to make this possible without breaking the base of the Bitcoin protocol, which has led them to different ideas and among them we have the Compact Blocks.
The Compact Blocks or Compact Blocks is nothing more than a small adaptation to the way in which the protocol can transmit the information of the blocks between the nodes that make up the network. The objective of this modification is to make the data transmission more efficient, reducing the bandwidth necessary for this task. A situation that leads to reducing latency and the network requirements necessary to reach a fast consensus in the network at a global level. Thanks to these advantages, compact blocks have been with us since the release of version 0.13.0 of Bitcoin Core, allowing us to enjoy its advantages.
But how does this technology work? What exactly does it offer us? Let's learn more about this proposal and everything it means for Bitcoin.
Compact Blocks, making data transmission in Bitcoin more efficient
Before getting into compact blocks, it is first important to understand why it is necessary to be efficient in transmitting data within a network like Bitcoin. As we know, Bitcoin is a distributed network of thousands of nodes that are spread all over the world. In fact, about 10900 Bitcoin nodes are publicly known, a data that we can review on the web Bitnodes.
Now let's wonder for a moment How much information is handled in this huge network? If we take into account the number of nodes, in addition to the fact that every second the network receives hundreds of transactions and that every 10 minutes a block is generated that contains an average of 1 MB of information, we can deduce that the network has high information traffic globally. But how much exactly?
If we do the calculations using this data, the Bitcoin network handles an average of 1,58 TB of data globally daily. Obtaining this data is simple:
First of all, we must bear in mind that on average about 144 blocks are produced each day, with 1 MB per block. That is, an average of 144 MB of data per day. However, these must be replicated in the 11 thousand nodes that make up the network. In other words, all the blocks and their data travel through the network so that each node can have an exact copy of it, so we have:
11000 (nodes) * 144 (MB) = 1584000 MB (data replicated across all nodes)
If we take this data to TB, we obtain:
1584000 / 1000000 = 1,58 TB
Thus we can know the approximate data mobilized throughout the Bitcoin network. That's a huge amount of bandwidth consuming information. But not only that, additionally this generates two problems: it slows down the network in terms of network performance and complicates the creation of a consensus throughout the network and the nodes that comprise it.
If we add that the problems can only increase in scale with a greater number of nodes and people using the network, then we understand why it is urgent to solve this problem. In fact, developers like Greg Maxwell have been very emphatic in this regard, saying:
The decentralized Bitcoin blockchain is a globally shared medium of transmission, which is probably the most incredibly inefficient mode of communication ever devised by man.
Many may believe that Maxwell's words attack the decentralization of the network. But in reality they attack a problem known to all, P2P networks are a rather inefficient means to send information in networks that must always be synchronized. Faced with this situation, it is best to make the transmission medium more efficient and for this there are several proposals such as Relay Network, Erlay and of course Compact Blocks.
The three advantages that compact blocks offer us are:
- It does not modify the Bitcoin protocol.
- Doesn't break the scheme P2P of the current network, protecting its decentralization.
- It considerably reduces bandwidth needs and the amount of data transmitted within the network.
- Without a doubt, they are not arguments of little weight and that keep Bitcoin in line with its philosophical line: decentralized money available to everyone.
How do Compact Blocks work?
What the Compact Blocks seek is to divide the information of the mined blocks in the network into two processes, which we explain below:
Generating a valid block on the network
The first process is the generation of the block, where the miners will create a valid block within the consensus rules of the network. At this point, the miners include all the information that this block would normally have. That is, your block hash or Block ID, its Merkle Root, the complete information of the header of the block and of course the whole set of transactions that have been validated by it. At this point there is no modification of any kind in the process, it remains the same block generation process without any changes.
This means that the miners do their work, generate the block and send it to the network. At that point, the first node to receive said block verifies it, and begins to send the compact blocks following the solution described below.
Sending the information to the rest of the network
Then the second process begins, which is the transmission of that information, and be careful because this is where the innovation of compact blocks lies. As we well know, each node in the blockchain has a space called mempool, where the transactions that are waiting to be processed are stored. This mempool is present in all nodes without exception. This situation allows us to deduce the following: many of the transactions of the recently generated block are in the mempool of each and every one of the nodes of the network.
This deduction is very important because the current process of transmission of the blocks what it does is; send said block with all this set of transactions in duplicate. It is precisely this duplication that makes the process of transmitting data on the network less efficient. Faced with this, the following question is valid: Can't we take advantage of the fact that the nodes already have many of these transactions in their mempool and thus reduce the amount of data sent to the nodes and that they consolidate the new block by themselves? The answer is yes, it can be done. And in fact, this is precisely what happens in the second compact block process.
Nodes that make use of compact blocks propagate the block by means of a "minimum block" of the mined block. This "minimum block" actually contains vital information, among which we can find the following:
- The 80-byte header of the new block. Here is the information of the Block ID or block hash, the merkel root, the nuncio and the number of transactions. And also, the date and time it has been mined.
- Transaction identifiers or TXID (without data from the scripts of those transactions).
- Some complete transactions (with all the information from the scripts of those transactions) that the sending node predicts that the receiving node does not have in its mempool yet.
In total, these minimum blocks occupy a maximum of 20 KB of data. What is a drastic reduction of information compared to 1 MB of data that on average occupies a block.
Rebuilding the block
As we can see, the amount of information in this “minimum block” is much less than what a complete block normally has. However, this information would perfectly allow the rest of the nodes to accurately reconstruct the mined block. And for this, it should only use the information received in that minimum block and its mempool. In this way, the node uses this data to completely recreate the final block, which can be verified without problems.
Even if it is not possible to rebuild the block locally, the node will make the information requests to achieve this. To do this, the node will require said transaction (or transactions) to another full node to rebuild the index and form the block unequivocally. This prevents, for example, that the nodes build disparate blocks and thus break the consensus of the network.
This process of sending information piecemeal and using local data to fill in the information in the validated blocks makes it possible to drastically reduce the size of network messages. You can see it as sending small signals that you can completely rebuild. Something that is possible thanks to the fact that you have in your possession the elements used to build these signals. Also, thanks to the use of cryptography you can be sure that your reconstructed message will be identical to the original.
How much do you know, cryptonuta?
Do Compact Blocks really help optimize the data usage of the Bitcoin network?TRUE!
Because compact blocks are designed to more intelligently use data stored in the node's mempool, they can help significantly optimize network data usage, greatly reducing the need for bandwidth for your network. effective operation.
Impact of Compacts Blocks on Bitcoin
Among the pros of compact blocks we can mention:
- It greatly reduces the need for network bandwidth to transmit information to all nodes. In fact, on average now the network's data consumption reaches 1,4 TB of data per day. This is a reduction of more than 90% in the data consumption of the entire network.
- It allows the propagation of data over the network is faster. In fact, it takes about 15 seconds for all the nodes of the network to have the information of the new block.
- Another point in favor of compact blocks is that it reduces data consumption for those who have a limited connection. In this way, they can participate in the network without major problems or excessive costs.
- Additionally, it improves network security, since the rapid transmission of information prevents attackers from sending false information.