Gram 백서

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

), with the dierence that all validators (or at least two-thirds of them) must participate in this process. Because the headers and signatures of new shardchain blocks are propagated to all validators, hashes of the newest blocks in each shardchain can and must be included in the new masterchain block. Once these hashes are committed into the masterchain block, outside observers and other shardchains may consider the new shardchain blocks committed and immutable (cf. 2.1.13 ). 2.6.16. Validators must keep the state of masterchain. A noteworthy dierence between the masterchain and the shardchains is that all validators are expected to keep track of the masterchain state, without relying on col- lated data. This is important because the knowledge of validator task groups is derived from the masterchain state. 2.6.17. Shardchain blocks are generated and propagated in parallel. Normally, each validator is a member of several shardchain task groups; their quantity (hence the load on the validator) is approximately proportional to the validator's stake. This means that the validator runs several instances of new shardchain block generation protocol in parallel. 51 2.6. Creating and V alidating New Blocks 2.6.18. Mitigation of block retention attacks. Because the total set of validators inserts a new shardchain block's hash into the masterchain after having seen only its header and signatures, there is a small probability that the validators that have generated this block will conspire and try to avoid publishing the new block in its entirety. This would result in the inability of validators of neighboring shardchains to create new blocks, because they must know at least the output message queue of the new block, once its hash has been committed into the masterchain. In order to mitigate this, the new block must collect signatures from some other validators (e.g., two-thirds of the union of task groups of neighboring shardchains) testifying that these validators do have copies of this block and are willing to send them to any other validators if required. Only after these signatures are presented may the new block's hash be included in the masterchain. 2.6.19. Masterchain blocks are generated later than shardchain blocks. Masterchain blocks are generated approximately once every ve seconds, as are shardchain blocks. However, while the generation of new blocks in all shardchains runs essentially at the same time (normally trig- gered by the release of a new masterchain block), the generation of new masterchain blocks is deliberately delayed, to allow the inclusion of hashes of newly-generated shardchain blocks in the masterchain. 2.6.20. Slow validators may receive lower rewards. If a validator is slow, it may fail to validate new block candidates, and two-thirds of the signatures required to commit the new block may be gathered without its participation. In this case, it will receive a lower share of the reward associated with this block. This provides an incentive for the validators to optimize their hardware, software, and network connection in order to process user transactions as fast as possible. However, if a validator fails to sign a block before it is committed, its signature may be included in one of the next blocks, and then a part of the reward (exponentially decreasing depending on how many blocks have been generated sincee.g., 0.9k if the validator is k blocks late) will be still given to this validator. 2.6.21. Depth of validator signatures. Normally, when a validator signs a block, the signature testies only to the relative validity of a block: 52 2.6. Creating and V alidating New Blocks this block is valid provided all previous blocks in this and other shardchains are valid. The validator cannot be punished for taking for granted invalid data committed into previous blocks. However, the validator signature of a block has an integer parameter called depth. If it is non-zero, it means that the validator asserts the (relative) validity of the specied number of previous blocks as well. This is a way for slow or temporarily oine validators to catch up and sign some of the blocks that have been committed without their signatures. Then some part of the block reward will still be given to them (cf. 2.6.20 ). 2.6.22. Validators are responsible for relative validity of signed shardchain blocks; absolute validity follows. We would like to empha- size once again that a validator's signature on a shardchain block B testies to only the relative validity of that block (or maybe of d previous blocks as well, if the signature has depth d, cf. 2.6.21 ; but this does not aect the following discussion much). In other words, the validator asserts that the next state s′ of the shardchain is obtained from the previous state s by applying the block evaluation function ev_block described in 2.2.6 : s′ = ev_block (B)(s) (24) In this way, the validator that signed block B cannot be punished if the original state s turns out to be incorrect (e.g., because of the invalidity of one of the previous blocks). A sherman (cf. 2.6.4 ) should complain only if it nds a block that is relatively invalid. The PoS system as a whole endeavors to make every block relatively valid, not recursively (or absolutely) valid. Notice, however, that if all blocks in a blockchain are relatively valid, then all of them and the blockchain as a whole are absolutely valid ; this statement is easily shown using mathematical induction on the length of the blockchain. In this way, easily veriable assertions of relative validity of blocks together demonstrate the much stronger absolute validity of the whole blockchain. Note that by signing a block B the validator asserts that the block is valid given the original state s (i.e., that the result of (24) is not the value ⊥ indicating that the next state cannot be computed). In this way, the validator must perform minimal formal checks of the cells of the original state that are accessed during the evaluation of (24). For example, imagine that the cell expected to contain the original bal- ance of an account accessed from a transaction committed into a block turns out to have zero raw bytes instead of the expected 8 or 16. Then the original 53 2.6. Creating and V alidating New Blocks balance simply cannot be retrieved from the cell, and an unhandled excep- tion happens while trying to process the block. In this case, the validator should not sign such a block on pain of being punished. 2.6.23. Signing masterchain blocks. The situation with the masterchain blocks is somewhat dierent: by signing a masterchain block, the valida- tor asserts not only its relative validity, but also the relative validity of all preceding blocks up to the very rst block when this validator assumed its responsibility (but not further back). 2.6.24. The total number of validators. The upper limit T for the total number of validators to be elected (cf. 2.6.7 ) cannot become, in the system described so far, more than, say, several hundred or a thousand, because all validators are expected to participate in a BFT consensus protocol to cre- ate each new masterchain block, and it is not clear whether such protocols can scale to thousands of participants. Even more importantly, masterchain blocks must collect the signatures of at least two-thirds of all the validators (by stake), and these signatures must be included in the new block (other- wise all other nodes in the system would have no reason to trust the new block without validating it by themselves). If more than, say, one thousand validator signatures would have to be included in each masterchain block, this would imply more data in each masterchain block, to be stored by all full nodes and propagated through the network, and more processing power spent to check these signatures (in a PoS system, full nodes do not need to validate blocks by themselves, but they need to check the validators' signa- tures instead). While limiting T to a thousand validators seems more than sucient for the rst phase of the deployment of the TON Blockchain, a provision must be made for future growth, when the total number of shardchains becomes so large that several hundred validators will not suce to process all of them. To this end, we introduce an additional congurable parameter T′≤T (originally equal to T ), and only the top T′ elected validators (by stake) are expected to create and sign new masterchain blocks. 2.6.25. Decentralization of the system. One might suspect that a Proof- of-Stake system such as the TON Blockchain, relying on T≈ 1000 validators to create all shardchain and masterchain blocks, is bound to become too centralized, as opposed to conventional Proof-of-Work blockchains like Bit- coin or Ethereum, where everybody (in principle) might mine a new block, 54 2.6. Creating and V alidating New Blocks without an explicit upper limit on the total number of miners. However, popular Proof-of-Work blockchains, such as Bitcoin and Ether- eum, currently require vast amounts of computing power (high hash rates) to mine new blocks with non-negligible probability of success. Thus, the mining of new blocks tends to be concentrated in the hands of several large players, who invest huge amounts money into datacenters lled with custom- designed hardware optimized for mining; and in the hands of several large mining pools, which concentrate and coordinate the eorts of larger groups of people who are not able to provide a sucient hash rate by themselves. Therefore, as of 2017, more than 75% of new Ethereum or Bitcoin blocks are produced by less than ten miners. In fact, the two largest Ethereum mining pools produce together more than half of all new blocks! Clearly, such a system is much more centralized than one relying on T≈ 1000 nodes to produce new blocks. One might also note that the investment required to become a TON Blockchain validatori.e., to buy the hardware (say, several high-performance servers) and the stake (which can be easily collected through a pool of nom- inators if necessary; cf. 2.6.3 )is much lower than that required to become a successful stand-alone Bitcoin or Ethereum miner. In fact, the parame- ter L of 2.6.7 will force nominators not to join the largest mining pool (i.e., the validator that has amassed the largest stake), but rather to look for smaller validators currently accepting funds from nominators, or even to create new validators, because this would allow a higher proportion s′i/si of the validator'sand by extension also the nominator'sstake to be used, hence yielding larger rewards from mining. In this way, the TON Proof-of- Stake system actually encourages decentralization (creating and using more validators) and punishes centralization. 2.6.26. Relative reliability of a block. The (relative) reliability of a block is simply the total stake of all validators that have signed this block. In other words, this is the amount of money certain actors would lose if this block turns out to be invalid. If one is concerned with transactions transferring value lower than the reliability of the block, one can consider them to be safe enough. In this sense, the relative reliability is a measure of trust an outside observer can have in a particular block. Note that we speak of the relative reliability of a block, because it is a guarantee that the block is valid provided the previous block and all other shardchains' blocks referred to are valid (cf. 2.6.22 ). 55 2.6. Creating and V alidating New Blocks The relative reliability of a block can grow after it is committedfor example, when belated validators' signatures are added (cf. 2.6.21 ). On the other hand, if one of these validators loses part or all of its stake because of its misbehavior related to some other blocks, the relative reliability of a block may decrease . 2.6.27. Strengthening the blockchain. It is important to provide in- centives for validators to increase the relative reliability of blocks as much as possible. One way of doing this is by allocating a small reward to validators for adding signatures to blocks of other shardchains. Even would-be valida- tors, who have deposited a stake insucient to get into the top T validators by stake and to be included in the global set of validators (cf. 2.6.7 ), might participate in this activity (if they agree to keep their stake frozen instead of withdrawing it after having lost the election). Such would-be validators might double as shermen (cf. 2.6.4 ): if they have to check the validity of certain blocks anyway, they might as well opt to report invalid blocks and collect the associated rewards. 2.6.28. Recursive reliability of a block. One can also dene the recursive reliability of a block to be the minimum of its relative reliability and the recursive reliabilities of all blocks it refers to (i.e., the masterchain block, the previous shardchain block, and some blocks of neighboring shardchains). In other words, if the block turns out to be invalid, either because it is invalid by itself or because one of the blocks it depends on is invalid, then at least this amount of money would be lost by someone. If one is truly unsure whether to trust a specic transaction in a block, one should compute the recursive reliability of this block, not just the relative one. It does not make sense to go too far back when computing recursive reliability, because, if we look too far back, we will see blocks signed by validators whose stakes have already been unfrozen and withdrawn. In any case, we do not allow the validators to automatically reconsider blocks that are that old (i.e., created more than two months ago, if current values of congurable parameters are used), and create forks starting from them or correct them with the aid of vertical blockchains (cf. 2.1.17 ), even if they turn out to be invalid. We assume that a period of two months provides ample opportunities for detecting and reporting any invalid blocks, so that if a block is not challenged during this period, it is unlikely to be challenged at all. 56 2.7. Splitting and Merging Shardchains 2.6.29. Consequence of Proof-of-Stake for light nodes. An important consequence of the Proof-of-Stake approach used by the TON Blockchain is that a light node (running light client software) for the TON Blockchain does not need to download the headers of all shardchain or even masterchain blocks in order to be able to check by itself the validity of Merkle proofs provided to it by full nodes as answers to its queries. Indeed, because the most recent shardchain block hashes are included in the masterchain blocks, a full node can easily provide a Merkle proof that a given shardchain block is valid starting from a known hash of a masterchain block. Next, the light node needs to know only the very rst block of the masterchain (where the very rst set of validators is announced), which (or at least the hash of which) might be built-in into the client software, and only one masterchain block approximately every month afterwards, where newly-elected validator sets are announced, because this block will have been signed by the previous set of validators. Starting from that, it can obtain the several most recent masterchain blocks, or at least their headers and validator signatures, and use them as a base for checking Merkle proofs provided by full nodes. 2.7 Splitting and Merging Shardchains One of the most characteristic and unique features of the TON Blockchain is its ability to automatically split a shardchain in two when the load becomes too high, and merge them back if the load subsides (cf. 2.1.10 ). We must discuss it in some detail because of its uniqueness and its importance to the scalability of the whole project. 2.7.1. Shard conguration. Recall that, at any given moment of time, each workchain w is split into one or several shardchains (w,s ) (cf. 2.1.8 ). These shardchains may be represented by leaves of a binary tree, with root (w,∅), and each non-leaf node (w,s ) having children (w,s. 0) and (w,s. 1). In this way, every account belonging to workchain w is assigned to exactly one shard, and everybody who knows the current shardchain conguration can determine the shard (w,s ) containing account account_id : it is the only shard with binary string s being a prex of account_id . The shard congurationi.e., this shard binary tree , or the collection of all active (w,s ) for a given w (corresponding to the leaves of the shard binary tree)is part of the masterchain state and is available to everybody 57 2.7. Splitting and Merging Shardchains who keeps track of the masterchain. 22 2.7.2. Most recent shard conguration and state. Recall that hashes of the most recent shardchain blocks are included in each masterchain block. These hashes are organized in a shard binary tree (actually, a collection of trees, one for each workchain). In this way, each masterchain block contains the most recent shard conguration. 2.7.3. Announcing and performing changes in the shard congura- tion. The shard conguration may be changed in two ways: either a shard (w,s ) can be split into two shards (w,s. 0) and (w,s. 1), or two sibling shards (w,s. 0) and (w,s. 1) can be merged into one shard (w,s ). These split/merge operations are announced several (e.g., 26; this is a congurable parameter) blocks in advance, rst in the headers of the cor- responding shardchain blocks, and then in the masterchain block that refers to these shardchain blocks. This advance announcement is needed for all parties concerned to prepare for the planned change (e.g., build an overlay multicast network to distribute new blocks of the newly-created shardchains, as discussed in 3.3 ). Then the change is committed, rst into the (header of the) shardchain block (in case of a split; for a merge, blocks of both shard- chains should commit the change), and then propagated to the masterchain block. In this way, the masterchain block denes not only the most recent shard conguration before its creation, but also the next immediate shard conguration. 2.7.4. Validator task groups for new shardchains. Recall that each shard, i.e., each shardchain, normally is assigned a subset of validators (a validator task group) dedicated to creating and validating new blocks in the corresponding shardchain (cf. 2.6.8 ). These task groups are elected for some period of time (approximately one hour) and are known some time in advance (also approximately one hour), and are immutable during this period. 23 However, the actual shard conguration may change during this period because of split/merge operations. One must assign task groups to newly created shards. This is done as follows: 22 Actually, the shard conguration is completely determined by the last masterchain block; this simplies getting access to the shard conguration. 23 Unless some validators are temporarily or permanently banned because of signing invalid blocksthen they are automatically excluded from all task groups. 58 2.7. Splitting and Merging Shardchains Notice that any active shard (w,s ) will either be a descendant of some uniquely determined original shard (w,s′), meaning that s′ is a prex of s, or it will be the root of a subtree of original shards (w,s′), where s will be a prex of every s′. In the rst case, we simply take the task group of the original shard (w,s′) to double as the task group of the new shard (w,s ). In the latter case, the task group of the new shard (w,s ) will be the union of task groups of all original shards (w,s′) that are descendants of (w,s ) in the shard tree. In this way, every active shard (w,s ) gets assigned a well-dened subset of validators (task group). When a shard is split, both children inherit the whole of the task group from the original shard. When two shards are merged, their task groups are also merged. Anyone who keeps
프로젝트로 돌아가기