Gram 백서

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 16쪽 중 8쪽

track of the masterchain state can compute validator task groups for each of the active shards. 2.7.5. Limit on split/merge operations during the period of respon- sibility of original task groups. Ultimately, the new shard conguration will be taken into account, and new dedicated validator subsets (task groups) will automatically be assigned to each shard. Before that happens, one must impose a certain limit on split/merge operations; otherwise, an original task group may end up validating 2k shardchains for a large k at the same time, if the original shard quickly splits into 2k new shards. This is achieved by imposing limits on how far the active shard congu- ration may be removed from the original shard conguration (the one used to select validator task groups currently in charge). For example, one might require that the distance in the shard tree from an active shard (w,s ) to an original shard (w,s′) must not exceed 3, if s′ is a predecessor of s (i.e., s′ is a prex of binary string s), and must not exceed 2, if s′ is a successor of s (i.e., s is a prex of s′). Otherwise, the split or merge operation is not permitted. Roughly speaking, one is imposing a limit on the number of times a shard can be split (e.g., three) or merged (e.g., two) during the period of responsibility of a given collection of validator task groups. Apart from that, after a shard has been created by merging or splitting, it cannot be recongured for some period of time (some number of blocks). 2.7.6. Determining the necessity of split operations. The split oper- ation for a shardchain is triggered by certain formal conditions (e.g., if for 64 consecutive blocks the shardchain blocks are at least 90% full). These conditions are monitored by the shardchain task group. If they are met, 59 2.7. Splitting and Merging Shardchains rst a split preparation ag is included in the header of a new shardchain block (and propagated to the masterchain block referring to this shardchain block). Then, several blocks afterwards, the split commit ag is included in the header of the shardchain block (and propagated to the next masterchain block). 2.7.7. Performing split operations. After the split commit ag is in- cluded in a block B of shardchain (w,s ), there cannot be a subsequent block B′ in that shardchain. Instead, two blocks B′0 and B′1 of shardchains (w,s. 0) and (w,s. 1), respectively, will be created, both referring to block B as their previous block (and both of them will indicate by a ag in the header that the shard has been just split). The next masterchain block will contain hashes of blocks B′0 and B′1 of the new shardchains; it is not allowed to contain the hash of a new block B′ of shardchain (w,s ), because a split commit event has already been committed into the previous masterchain block. Notice that both new shardchains will be validated by the same validator task group as the old one, so they will automatically have a copy of their state. The state splitting operation itself is quite simple from the perspective of the Innite Sharding Paradigm (cf. 2.5.2 ). 2.7.8. Determining the necessity of merge operations. The necessity of shard merge operations is also detected by certain formal conditions (e.g., if for 64 consecutive blocks the sum of the sizes of the two blocks of sibling shardchains does not exceed 60% of maximal block size). These formal con- ditions should also take into account the total gas spent by these blocks and compare it to the current block gas limit, otherwise the blocks may happen to be small because there are some computation-intensive transactions that prevent the inclusion of more transactions. These conditions are monitored by validator task groups of both sibling shards (w,s. 0) and (w,s. 1). Notice that siblings are necessarily neighbors with respect to hypercube routing (cf. 2.4.19 ), so validators from the task group of any shard will be monitoring the sibling shard to some extent any- ways. When these conditions are met, either one of the validator subgroups can suggest to the other that they merge by sending a special message. Then they combine into a provisional merged task group, with combined mem- bership, capable of running BFT consensus algorithms and of propagating block updates and block candidates if necessary. 60 2.8. Classification of Blockchain Projects If they reach consensus on the necessity and readiness of merging, merge prepare ags are committed into the headers of some blocks of each shard- chain, along with the signatures of at least two-thirds of the validators of the sibling's task group (and are propagated to the next masterchain blocks, so that everybody can get ready for the imminent reconguration). How- ever, they continue to create separate shardchain blocks for some predened number of blocks. 2.7.9. Performing merge operations. After that, when the validators from the union of the two original task groups are ready to become validators for the merged shardchain (this might involve a state transfer from the sibling shardchain and a state merge operation), they commit a merge commit ag in the headers of blocks of their shardchain (this event is propagated to the next masterchain blocks), and stop creating new blocks in separate shardchains (once the merge commit ag appears, creating blocks in separate shardchains is forbidden). Instead, a merged shardchain block is created (by the union of the two original task groups), referring to both of its preceding blocks in its header. This is reected in the next masterchain block, which will contain the hash of the newly created block of the merged shardchain. After that, the merged task group continues creating blocks in the merged shardchain. 2.8 Classication of Blockchain Projects We will conclude our brief discussion of the TON Blockchain by comparing it with existing and proposed blockchain projects. Before doing this, however, we must introduce a suciently general classication of blockchain projects. The comparison of particular blockchain projects, based on this classication, is postponed until 2.9 . 2.8.1. Classication of blockchain projects. As a rst step, we suggest some classication criteria for blockchains (i.e., for blockchain projects). Any such classication is somewhat incomplete and supercial, because it must ignore some of the most specic and unique features of the projects under consideration. However, we feel that this is a necessary rst step in provid- ing at least a very rough and approximate map of the blockchain projects territory. The list of criteria we consider is the following: 61 2.8. Classification of Blockchain Projects ˆ Single-blockchain vs. multi-blockchain architecture (cf. 2.8.2 ) ˆ Consensus algorithm: Proof-of-Stake vs. Proof-of-Work (cf. 2.8.3 ) ˆ For Proof-of-Stake systems, the exact block generation, validation and consensus algorithm used (the two principal options are DPOS vs. BFT; cf. 2.8.4 ) ˆ Support for arbitrary (Turing-complete) smart contracts (cf. 2.8.6 ) Multi-blockchain systems have additional classication criteria (cf. 2.8.7 ): ˆ Type and rules of member blockchains: homogeneous, heterogeneous (cf. 2.8.8 ), mixed (cf. 2.8.9 ). Confederations (cf. 2.8.10 ). ˆ Absence or presence of a masterchain , internal or external (cf. 2.8.11 ) ˆ Native support for sharding (cf. 2.8.12 ). Static or dynamic sharding (cf. 2.8.13 ). ˆ Interaction between member blockchains: loosely-coupled and tightly- coupled systems (cf. 2.8.14 ) 2.8.2. Single-blockchain vs. multi-blockchain projects. The rst clas- sication criterion is the quantity of blockchains in the system. The oldest and simplest projects consist of a single blockchain (singlechain projects for short); more sophisticated projects use (or, rather, plan to use) multiple blockchains (multichain projects). Singlechain projects are generally simpler and better tested; they have withstood the test of time. Their main drawback is low performance, or at least transaction throughput, which is on the level of ten (Bitcoin) to less than one hundred 24 (Ethereum) transactions per second for general-purpose systems. Some specialized systems (such as Bitshares) are capable of process- ing tens of thousands of specialized transactions per second, at the expense of requiring the blockchain state to t into memory, and limiting the pro- cessing to a predened special set of transactions, which are then executed by highly-optimized code written in languages like C++ (no VMs here). Multichain projects promise the scalability everybody craves. They may support larger total states and more transactions per second, at the expense 24 More like 15, for the time being. However, some upgrades are being planned to make Ethereum transaction throughput several times larger. 62 2.8. Classification of Blockchain Projects of making the project much more complex, and its implementation more chal- lenging. As a result, there are few multichain projects already running, but most proposed projects are multichain. We believe that the future belongs to multichain projects. 2.8.3. Creating and validating blocks: Proof-of-Work vs. Proof-of- Stake. Another important distinction is the algorithm and protocol used to create and propagate new blocks, check their validity, and select one of several forks if they appear. The two most common paradigms are Proof-of-Work (PoW) and Proof-of- Stake (PoS) . The Proof-of-Work approach usually allows any node to create (mine) a new block (and obtain some reward associated with mining a block) if it is lucky enough to solve an otherwise useless computational prob- lem (usually involving the computation of a large amount of hashes) before other competitors manage to do this. In the case of forks (for example, if two nodes publish two otherwise valid but dierent blocks to follow the previous one) the longest fork wins. In this way, the guarantee of immutability of the blockchain is based on the amount of work (computational resources) spent to generate the blockchain: anybody who would like to create a fork of this blockchain would need to re-do this work to create alternative versions of the already committed blocks. For this, one would need to control more than 50% of the total computing power spent creating new blocks, otherwise the alternative fork will have exponentially low chances of becoming the longest. The Proof-of-Stake approach is based on large stakes (nominated in cryp- tocurrency) made by some special nodes ( validators ) to assert that they have checked ( validated ) some blocks and have found them correct. Validators sign blocks, and receive some small rewards for this; however, if a validator is ever caught signing an incorrect block, and a proof of this is presented, part or all of its stake is forfeit. In this way, the guarantee of validity and immutability of the blockchain is given by the total volume of stakes put by validators on the validity of the blockchain. The Proof-of-Stake approach is more natural in the respect that it incen- tivizes the validators (which replace PoW miners) to perform useful compu- tation (needed to check or create new blocks, in particular, by performing all transactions listed in a block) instead of computing otherwise useless hashes. In this way, validators would purchase hardware that is better adapted to processing user transactions, in order to receive rewards associated with these transactions, which seems quite a useful investment from the perspective of 63 2.8. Classification of Blockchain Projects the system as a whole. However, Proof-of-Stake systems are somewhat more challenging to im- plement, because one must provide for many rare but possible conditions. For example, some malicious validators might conspire to disrupt the system to extract some prot (e.g., by altering their own cryptocurrency balances). This leads to some non-trivial game-theoretic problems. In short, Proof-of-Stake is more natural and more promising, especially for multichain projects (because Proof-of-Work would require prohibitive amounts of computational resources if there are many blockchains), but must be more carefully thought out and implemented. Most currently running blockchain projects, especially the oldest ones (such as Bitcoin and at least the original Ethereum), use Proof-of-Work. 2.8.4. Variants of Proof-of-Stake. DPOS vs. BFT. While Proof-of- Work algorithms are very similar to each other and dier mostly in the hash functions that must be computed for mining new blocks, there are more possibilities for Proof-of-Stake algorithms. They merit a sub-classication of their own. Essentially, one must answer the following questions about a Proof-of- Stake algorithm: ˆ Who can produce (mine) a new blockany full node, or only a mem- ber of a (relatively) small subset of validators? (Most PoS systems require new blocks to be generated and signed by one of several desig- nated validators.) ˆ Do validators guarantee the validity of the blocks by their signatures, or are all full nodes expected to validate all blocks by themselves? (Scal- able PoS systems must rely on validator signatures instead of requiring all nodes to validate all blocks of all blockchains.) ˆ Is there a designated producer for the next blockchain block, known in advance, such that nobody else can produce that block instead? ˆ Is a newly-created block originally signed by only one validator (its producer), or must it collect a majority of validator signatures from the very beginning? While there seem to be 24 possible classes of PoS algorithms depending on the answers to these questions, the distinction in practice boils down to two 64 2.8. Classification of Blockchain Projects major approaches to PoS. In fact, most modern PoS algorithms, designed to be used in scalable multi-chain systems, answer the rst two questions in the same fashion: only validators can produce new blocks, and they guarantee block validity without requiring all full nodes to check the validity of all blocks by themselves. As to the two last questions, their answers turn out to be highly corre- lated, leaving essentially only two basic options: ˆ Delegated Proof-of-Stake (DPOS) : There is a universally known desig- nated producer for every block; no one else can produce that block; the new block is originally signed only by its producing validator. ˆ Byzantine Fault Tolerant (BFT) PoS algorithms: There is a known subset of validators, any of which can suggest a new block; the choice of the actual next block among several suggested candidates, which must be validated and signed by a majority of validators before being released to the other nodes, is achieved by a version of Byzantine Fault Tolerant consensus protocol. 2.8.5. Comparison of DPOS and BFT PoS. The BFT approach has the advantage that a newly-produced block has from the very beginning the signatures of a majority of validators testifying to its validity. Another advan- tage is that, if a majority of validators executes the BFT consensus protocol correctly, no forks can appear at all. On the other hand, BFT algorithms tend to be quite convoluted and require more time for the subset of valida- tors to reach consensus. Therefore, blocks cannot be generated too often. This is why we expect the TON Blockchain (which is a BFT project from the perspective of this classication) to produce a block only once every ve seconds. In practice, this interval might be decreased to 23 seconds (though we do not promise this), but not further, if validators are spread across the globe. The DPOS algorithm has the advantage of being quite simple and straight- forward. It can generate new blocks quite oftensay, once every two seconds, or maybe even once every second, 25 because of its reliance on designated block producers known in advance. However, DPOS requires all nodesor at least all validatorsto validate all blocks received, because a validator producing and signing a new block 25 Some people even claim DPOS block generation times of half a second, which does not seem realistic if validators are scattered across several continents. 65 2.8. Classification of Blockchain Projects conrms not only the relative validity of this block, but also the validity of the previous block it refers to, and all the blocks further back in the chain (maybe up to the beginning of the period of responsibility of the current subset of validators). There is a predetermined order on the current subset of validators, so that for each block there is a designated producer (i.e., validator expected to generate that block); these designated producers are rotated in a round-robin fashion. In this way, a block is at rst signed only by its producing validator; then, when the next block is mined, and its producer chooses to refer to this block and not to one of its predecessors (otherwise its block would lie in a shorter chain, which might lose the longest fork competition in the future), the signature of the next block is essentially an additional signature on the previous block as well. In this way, a new block gradually collects the signatures of more validatorssay, twenty signatures in the time needed to generate the next twenty blocks. A full node will either need to wait for these twenty signatures, or validate the block by itself, starting from a suciently conrmed block (say, twenty blocks back), which might be not so easy. The obvious disadvantage of the DPOS algorithm is that a new block (and transactions committed into it) achieves the same level of trust (re- cursive reliability as discussed in 2.6.28 ) only after twenty more blocks are mined, compared to the BFT algorithms, which deliver this level of trust (say, twenty signatures) immediately. Another disadvantage is that DPOS uses the longest fork wins approach for switching to other forks; this makes forks quite probable if at least some producers fail to produce subsequent blocks after the one we are interested in (or we fail to observe these blocks because of a network partition or a sophisticated attack). We believe that the BFT approach, while more sophisticated to imple- ment and requiring longer time intervals between blocks than DPOS, is bet- ter adapted to tightly-coupled (cf. 2.8.14 ) multichain systems, because other blockchains can start acting almost immediately after seeing a com- mitted transaction (e.g., generating a message intended for them) in a new block, without waiting for twenty conrmations of validity (i.e., the next twenty blocks), or waiting for the next six blocks to be sure that no forks appear and verifying the new block by themselves (verifying blocks of other blockchains may become prohibitive in a scalable multi-chain system). Thus they can achieve scalability while preserving high reliability and availability (cf. 2.8.12 ). On the other hand, DPOS might be a good choice for a loosely-coupled 66 2.8. Classification of Blockchain Projects multi-chain system, where fast interaction between blockchains is not re- quired  e.g., if each blockchain (workchain) represents a separate dis- tributed exchange, and inter-blockchain interaction is limited to rare transfers of tokens from one workchain into another (or, rather, trading one altcoin residing in one workchain for another at a rate approaching 1 : 1 ). This is what is actually done in the BitShares project, which uses DPOS quite successfully. To summarize, while DPOS can generate new blocks and include trans- actions into them faster (with smaller intervals between blocks), these trans- actions reach the level of trust required to use them in other blockchains and o-chain applications as committed and immutable much more slowly than in the BFT systemssay, in thirty seconds 26 instead of ve. Faster transaction inclusion does not mean faster transaction commitment . This could become a huge problem if fast inter-blockchain interact
프로젝트로 돌아가기