One of the popular analysis of DAG system block size and block generation time
Soteria
2020-03-06 10:58
本文约2529字,阅读全文需要约10分钟
Block size and block generation time are a pair of design variables that directly determine the capacity of the blockchain system.

Hello everyone, today we will talk about the issue of block size and block generation time. By the way, we will talk about how we deal with this issue in the design of Soteria DAG.

Scaling is the key to the problem

Block size and block generation time are a pair of design variables that directly determine the capacity of the blockchain system. Take the Bitcoin system as an example:

The Bitcoin system mines a 1MB block approximately every 10 minutes. And each transaction occupies an average of 250 bytes. So a block can hold 4000 transactions. There are 4000 transactions in 10 minutes, so there is a well-known figure for the system capacity of 7 transactions per second. If we want to expand the capacity by a thousand times, can we adjust these two parameters? For example, the block size becomes 100MB, and the block generation time becomes one per second, so there is a new system capacity figure: 400000/60 ~ 7000 transactions per second, killing PayPal and Visa in seconds. The answer is obviously NO. And the problem is not storage, but network transmission.

Network Transmission and Security Fundamentals

The security foundation of POW is based on the fact that personal computing power does not exceed 50% of the entire network computing power. The underlying necessary condition is that any node should compete fairly with other nodes in the network. It's like running a race, everyone has to start together. The blockchain system is an asynchronous system, and the security of POW can only be guaranteed when the system state is nearly synchronized. In fact, an important principle of POW mining rewards is to reward miners to broadcast the blocks they have dug out as soon as possible and be received by the network; at the same time, they are actively receiving other blocks transmitted from the network instead of wasting computing power on The chain that cannot be climated (the longest chain principle). The essence of this in and out (TX/RX) is to use the natural behavior of miners under the system framework to ensure the synchronization of the network.

From issuing test papers to mining

There are two variables here: the first is the time to pass the papers, and the second is the time to do the questions. The scroll can be a sheet of paper, or it can be a thick stack. Suppose we have to pass the papers one by one, because when the teacher prints the papers, he prints the amount of the whole class on each page. Therefore, the test paper can be passed in half a minute, or it can be passed in 10 minutes without all being sent out. Similarly, the topic is also difficult and easy. A smart child can finish it in ten minutes with a calculator, and a rigorous child can do it completely by mouth, and it may take two hours to finish.

There are two variables here: the first is the time to pass the papers, and the second is the time to do the questions. The scroll can be a sheet of paper, or it can be a thick stack. Suppose we have to pass the papers one by one, because when the teacher prints the papers, he prints the amount of the whole class on each page. Therefore, the test paper can be passed in half a minute, or it can be passed in 10 minutes without all being sent out. Similarly, the topic is also difficult and easy. A smart child can finish it in ten minutes with a calculator, and a rigorous child can do it completely by mouth, and it may take two hours to finish.

Now you probably understand why I said that the examination papers will be issued. The test paper corresponds to our block size, and the difficulty of the question corresponds to our block generation time. The small difference is: in the block system, there is no teacher to tell everyone "start counting the time now"; instead, children's shoes start to do it as soon as they get the test paper. Specifically, there is such a rhythm: for each newly generated block, the network propagation time is half a minute (network broadcast radius). Each miner starts mining on it after receiving the new block and verifying that it is correct. A new block is like a new test paper, and network dissemination is the issuance of the test paper. And it takes at least half a minute for this paper to be distributed to all the students. However, in each round of mining, someone will always get the paper half a minute earlier than others. But the miners think it doesn’t matter. First of all, the questions are quite difficult. The test time is ten minutes, and getting the test paper half a minute late will not have much impact; second, unlike the test in the classroom, everyone’s seat is random and often In the exchange, the person who gets the test paper first is different every time, so there is no problem. Some unlucky miners have produced new blocks on the other side of the network for half a minute when TA digs out a new block, and the new block has not yet been propagated to him. So his new block was ruthlessly dropped, that is, it became an orphan block. TA's work was ruthlessly wasted. But there is no way around this, the design is the winner takes all, but TA has actually contributed to the security of the entire network objectively (500 words of game theory analysis are omitted here)

Expansion

If we want to expand, what we can do is to either increase the block size, shorten the block generation time, or change both. Let's try to change the block production speed from 10 minutes to half a minute. This is a mess, some children's shoes are finished before the exam papers are distributed, and they start to get the next set of exam papers. As a result, the chaotic scene in the classroom was uncontrollable for a while: half of the test papers were done all over the floor, and everyone was busy collecting the new test papers. The adjustment of this parameter leads to a large number of orphan blocks and forks. Not only is a large amount of network computing power wasted, but more importantly, the security model brought about by the synchronization we mentioned earlier is also gone: each new set The test papers were not distributed to the whole class yet, so a small bunch of children's shoes were made. So reissue the next set of test papers. In other words, on average, each child's shoe only has 15 seconds to complete the question, and it has to be completed or done in vain. The direct result of this is that only half of the computing power is doing useful work, and the other half is doing wrong test papers. From the perspective of a network attacker, as shown in the figure below, TA is actually only fighting with half of the computing power, that is to say, as long as his computing power accounts for 33% of the entire network, TA may win, not us 50% of what is usually said

Then let's try to increase the block size to twenty times the previous one, that is, it also becomes 10 minutes. In the same way, if the number of pages in each set of papers increases, the time for issuing papers becomes longer, that is, the time for transmission becomes longer, but the time for making papers remains the same, that is, the speed of block production remains the same, then the final classroom It's still the same chaos: there are still a lot of orphaned blocks and forks, and a similar waste of computing power. So we can see that as long as the transmission speed is comparable to the block generation speed, many features designed by the system at the beginning cannot be guaranteed, especially security. Is it okay when the two parameters are not comparable? For example, increasing the block size by 4 times is still far from 20 times, is it possible? Of course, it's not very good. Because the size of the block has changed, it means that I am working under two sets of protocols. Before the moment I change, there are a lot of various software engineering and community issues that need to be considered and dealt with, such as deployment compatibility. This is a very thorny road. Let's find an opportunity to do a careful science popularization in "Popular Analysis of StoteriaDAG and Forks". In any case, everyone should now understand that the matter of capacity expansion is actually the result of a compromise between the mutual constraints and interactions of these two parameters. This problem is even more interesting in the context of a DAG.

The beauty of tolerance

When we do BlockDAG, one of the important goals is actually expansion. It is obvious from our previous discussion that capacity expansion is constrained by a pair of mutually exclusive parameters. The reason why they are so complicated in the blockchain system is, in the final analysis, caused by the two principles of network synchronization and winner-take-all. Just imagine, if the children’s shoes in the back row receive the papers, even if the children’s shoes in the front row are finished and the next set of test papers is ready, they still insist on finishing and get the scores they want, so that there are no more orphans and points for lamas. Fork, how wonderful this would be. BlockDAG solves this problem. Miners can mine in parallel. They don’t have to worry that their new block will be useless after someone else digs out a new block; The block is broadcast. In the next article, we will discuss in detail how these two parameters interact under the premise of DAG.

Soteria
作者文库