State Validity and Data Availability
State Validity and Data Availability
The core idea in sharded blockchains is that most participants operating or using the network cannot validate blocks in all the shards. As such, whenever any participant needs to interact with a particular shard they generally cannot download and validate the entire history of the shard. The partitioning aspect of sharding, however, raises a significant potential problem: without downloading and validating the entire history of a particular shard the participant cannot necessarily be certain that the state with which 5This section, except for subsection 2.5.3, was previously published at https://near.ai/ shard2. If you read it before, skip to the next section.
they interact is the result of some valid sequence of blocks and that such sequence of blocks is indeed the canonical chain in the shard. A problem that doesn’t exist in a non-sharded blockchain. We will first present a simple solution to this problem that has been proposed by many protocols and then analyze how this solution can break and what attempts have been made to address it. 2.1 Validators rotation The naive solution to state validity is shown on figure 5: let’s say we assume that the entire system has on the order of thousands validators, out of which no more than 20% are malicious or will otherwise fail (such as by failing to be online to produce a block). Then if we sample 200 validators, the probability of more than 1 3 failing for practical purposes can be assumed to be zero. Figure 5: Sampling validators 1 3 is an important threshold. There’s a family of consensus protocols, called BFT consensus protocols, that guarantees that for as long as fewer than 1 3 of participants fail, either by crashing or by acting in some way that violates the protocol, the consensus will be reached. With this assumption of honest validator percentage, if the current set of validators in a shard provides us with some block, the naive solution assumes that the block is valid and that it is built on what the validators believed to be the canonical chain for that shard when they started validating. The validators learned the canonical chain from the previous set of validators, who by the same assumption built on top of the block which was the head of the canonical chain before that. By induction the entire chain is valid, and since no set of validators at any point produced forks, the naive solution is also certain that the current chain is the only chain in the shard. See figure 6 for a visualization.
Figure 6: A blockchain with each block finalized via BFT consensus This simple solution doesn’t work if we assume that the validators can be corrupted adaptively, which is not an unreasonable assumption6. Adaptively corrupting a single shard in a system with 1000 shards is significantly cheaper than corrupting the entire system. Therefore, the security of the protocol decreases linearly with the number of shards. To have certainty in the validity of a block, we must know that at any point in history no shard in the system has a majority of validators colluding; with adaptive adversaries, we no longer have such certainty. As we discussed in section 1.5, colluding validators can exercise two basic malicious behaviors: create forks, and produce invalid blocks. Malicious forks can be addressed by blocks being cross-linked to the Beacon chain that is generally designed to have significantly higher security than the shard chains. Producing invalid blocks, however, is a significantly more challenging problem to tackle. 2.2 State Validity Consider figure 7 on which Shard #1 is corrupted and a malicious actor produces invalid block B. Suppose in this block B 1000 tokens were minted out of thin air on Alice’s account. The malicious actor then produces valid block C (in a sense that the transactions in C are applied correctly) on top of B, obfuscating the invalid block B, and initiates a cross-shard transaction to Shard #2 that transfers those 1000 tokens to Bob’s account. From this moment the improperly created tokens reside on an otherwise completely valid blockchain in Shard #2. Some simple approaches to tackle this problem are: 6Read this article for details on how adaptive corruption can be carried out: https://medium.com/nearprotocol/d859adb464c8. For more details on adaptive corruption, read https://github.com/ethereum/wiki/wiki/Sharding-FAQ# what-are-the-security-models-that-we-are-operating-under
Figure 7: A cross-shard transaction from a chain that has an invalid block 1. For validators of Shard #2 to validate the block from which the transaction is initiated. This won’t work even in the example above, since block C appears to be completely valid. 2. For validators in Shard #2 to validate some large number of blocks preceding the block from which the transaction is initiated. Naturally, for any number of blocks N validated by the receiving shard the malicious validators can create N+1 valid blocks on top of the invalid block they produced. A promising idea to resolve this issue would be to arrange shards into an undirected graph in which each shard is connected to several other shards, and only allow cross-shard transactions between neighboring shards (e.g. this is how Vlad Zamfir’s sharding essentially works7, and similar idea is used in Kadena’s Chainweb [1]). If a cross-shard transaction is needed between shards that are not neighbors, such transaction is routed through multiple shards. In this design a validator in each shard is expected to validate both all the blocks in their shard as well as all the blocks in all the neighboring shards. Consider a figure below with 10 shards, each having four neighbors, and no two shards requiring more than two hops for a cross-shard communication shown on figure 8. Shard #2 is not only validating its own blockchain, but also blockchains of all the neighbors, including Shard #1. So if a malicious actor on Shard #1 is attempting to create an invalid block B, then build block C on top of it and initiate a cross-shard transaction, such cross-shard transaction will not go through since Shard #2 will have validated the entire history of Shard #1 which will cause it to identify invalid block B. 7Read more about the design here: https://medium.com/nearprotocol/37e538177ed9
Figure 8: An invalid cross-shard transaction in chainweb-like system that will get detected While corrupting a single shard is no longer a viable attack, corrupting a few shards remains a problem. On figure 9 an adversary corrupting both Shard
1 and Shard #2 successfully executes a cross-shard transaction to Shard #3
with funds from an invalid block B: Figure 9: An invalid cross-shard transaction in chainweb-like system that will not get detected Shard #3 validates all the blocks in Shard #2, but not in Shard #1, and has no way to detect the malicious block. There are two major directions of properly solving state validity: fishermen
and cryptographic proofs of computation. 2.3 Fisherman The idea behind the first approach is the following: whenever a block header is communicated between chains for any purpose (such as cross-linking to the beacon chain, or a cross-shard transaction), there’s a period of time during which any honest validator can provide a proof that the block is invalid. There are various constructions that enable very succinct proofs that the blocks are invalid, so the communication overhead for the receiving nodes is way smaller than that of receiving a full block. With this approach for as long as there’s at least one honest validator in the shard, the system is secure. Figure 10: Fisherman This is the dominant approach (besides pretending the problem doesn’t exist) among the proposed protocols today. This approach, however, has two major disadvantages: 1. The challenge period needs to be sufficiently long for the honest validator to recognize a block was produced, download it, fully verify it, and prepare the challenge if the block is invalid. Introducing such a period would significantly slow down the cross-shard transactions. 2. The existence of the challenge protocol creates a new vector of attacks when malicious nodes spam with invalid challenges. An obvious solution to this problem is to make challengers deposit some amount of tokens that are returned if the challenge is valid. This is only a partial solution, as it might still be beneficial for the adversary to spam the system (and burn the deposits) with invalid challenges, for example to prevent the valid
challenge from a honest validator from going through. These attacks are called Grieving Attacks. See section 3.7.2 for a way to get around the latter point. 2.4 Succinct Non-interactive Arguments of Knowledge The second solution to multiple-shard corruption is to use some sort of cryptographic constructions that allow one to prove that a certain computation (such as computing a block from a set of transactions) was carried out correctly. Such constructions do exist, e.g. zk-SNARKs, zk-STARKs and a few others, and some are actively used in blockchain protocols today for private payments, most notably ZCash. The primary problem with such primitives is that they are notoriously slow to compute. E.g. Coda Protocol, that uses zk-SNARKs specifically to prove that all the blocks in the blockchain are valid, said in one of the interviews that it can take 30 seconds per transaction to create a proof (this number is probably smaller by now). Interestingly, a proof doesn’t need to be computed by a trusted party, since the proof not only attests to the validity of the computation it is built for, but to the validity of the proof itself. Thus, the computation of such proofs can be split among a set of participants with significantly less redundancy than would be necessary to perform some trustless computation. It also allows for participants who compute zk-SNARKs to run on special hardware without reducing the decentralization of the system. The challenges of zk-SNARKs, besides performance, are: 1. Dependency on less-researched and less-time-tested cryptographic primitives; 2. ”Toxic waste” — zk-SNARKs depend on a trusted setup in which a group of people performs some computation and then discards the intermediate values of that computation. If all the participants of the procedure collude and keep the intermediate values, fake proofs can be created; 3. Extra complexity introduced into the system design; 4. zk-SNARKs only work for a subset of possible computations, so a protocol with a Turing-complete smart contract language wouldn’t be able to use SNARKs to prove the validity of the chain. 2.5 Data Availability The second problem we will touch upon is data availability. Generally nodes operating a particular blockchain are separated into two groups: Full Nodes, those that download every full block and validate every transaction, and Light Nodes, those that only download block headers, and use Merkle proofs for parts of the state and transactions they are interested in, as shown on figure 11.
Figure 11: Merkle Tree Now if a majority of full nodes collude, they can produce a block, valid or invalid, and send its hash to the light nodes, but never disclose the full content of the block. There are various ways they can benefit from it. For example, consider figure 12: Figure 12: Data Availability problem There are three blocks: the previous, A, is produced by honest validators; the current, B, has validators colluding; and the next, C, will be also produced by honest validators (the blockchain is depicted in the bottom right corner). You are a merchant. The validators of the current block (B) received block A from the previous validators, computed a block in which you receive money,
and sent you a header of that block with a Merkle proof of the state in which you have money (or a Merkle proof of a valid transaction that sends the money to you). Confident the transaction is finalized, you provide the service. However, the validators never distribute the full content of the block B to anyone. As such, the honest validators of block C can’t retrieve the block, and are either forced to stall the system or to build on top of A, depriving you as a merchant of money. When we apply the same scenario to sharding, the definitions of full and light node generally apply per shard: validators in each shard download every block in that shard and validate every transaction in that shard, but other nodes in the system, including those that snapshot shard chains state into the beacon chain, only download the headers. Thus the validators in the shard are effectively full nodes for that shard, while other participants in the system, including the beacon chain, operate as light nodes. For the fisherman approach we discussed above to work, honest validators need to be able to download blocks that are cross-linked to the beacon chain. If malicious validators cross-linked a header of an invalid block (or used it to initiate a cross-shard transaction), but never distributed the block, the honest validators have no way to craft a challenge. We will cover three approaches to address this problem that complement each other. 2.5.1 Proofs of Custody The most immediate problem to be solved is whether a block is available once it is published. One proposed idea is to have so-called Notaries that rotate between shards more often than validators whose only job is to download a block and attest to the fact that they were able to download it. They can be rotated more frequently because they don’t need to download the entire state of the shard, unlike the validators who cannot be rotated frequently since they must download the state of the shard each time they rotate, as shown on figure 13. The problem with this naive approach is that it is impossible to prove later whether the Notary was or was not able to download the block, so a Notary can choose to always attest that they were able to download the block without even attempting to retrieve it. One solution to this is for Notaries to provide some evidence or to stake some amount of tokens attesting that the block was downloaded. One such solution is discussed here: https://ethresear.ch/t/ 1-bit-aggregation-friendly-custody-bonds/2236. 2.5.2 Erasure Codes When a particular light node receives a hash of a block, to increase the node’s confidence that the block is available it can attempt to download a few random pieces of the block. This is not a complete solution, since unless the light nodes collectively download the entire block the malicious block producers can choose
Figure 13: Validators need to download state and thus cannot be rotated frequently to withhold the parts of the block that were not downloaded by any light node, thus still making the block unavailable. One solution is to use a construction called Erasure Codes to make it possible to recover the full block even if only some part of the block is available, as shown on figure 14. Figure 14: Merkle tree built on top of erasure coded data Both Polkadot and Ethereum Serenity have designs around this idea that provide a way for light nodes to be reasonably confident the blocks are available. The Ethereum Serenity approach has a detailed description in [2].
2.5.3 Polkadot’s approach to data availability In Polkadot, like in most sharded solutions, each shard (called parachain) snapshots its blocks to the beacon chain (called relay chain). Say there are 2f + 1 validators on the relay chain. The block producers of the parachain blocks, called collators, once the parachain block is produced compute an erasure coded version of the block that consists of 2f +1 parts such that any f parts are sufficient to reconstruct the block. They then distribute one part to each validator on the relay chain. A particular relay chain validator would only sign on a relay chain block if they have their part for each parachain block that is snapshotted to such relay chain block. Thus, if a relay chain block has signatures from 2f + 1 validators, and for as long as no more than f of them violated the protocol, each parachain block can be reconstructed by fetching the parts from the validators that follow the protocol. See figure 15. Figure 15: Polkadot’s data availability 2.5.4 Long term data availability Note that all the approaches discussed above only attest to the fact that a block was published at all, and is available now. Blocks can later become unavailable for a variety of reasons: nodes going offline, nodes intentionally erasing historical data, and others. A whitepaper worth mentioning that addresses this issue is Polyshard [3], which uses erasure codes to make blocks available across shards even if several shards completely lose their data. Unfortunately their specific approach requires all the shards to download blocks from all other shards, which is prohibitively expensive. The long term availability is not as pressing of an issue: since no participant in the system is expected to be capable of validating all the chains in all the
shards, the security of the sharded protocol needs to be designed in such a way that the system is secure even if some old blocks in some shards become completely unavailable.
상태 유효성 및 데이터 가용성
샤딩된 blockchains의 핵심 아이디어는 대부분의 참가자가 네트워크를 사용하면 모든 샤드의 블록을 확인할 수 없습니다. 이처럼, 언제든지 모든 참가자는 일반적으로 사용할 수 없는 특정 샤드와 상호 작용해야 합니다. 샤드의 전체 기록을 다운로드하고 검증합니다. 그러나 샤딩의 파티셔닝 측면은 상당한 잠재력을 불러일으킵니다. 문제: 특정 기록의 전체 기록을 다운로드하고 검증하지 않고 샤드 참가자는 반드시 상태가 무엇인지 확신할 수 없습니다. 5하위 섹션 2.5.3을 제외하고 이 섹션은 이전에 https://near.ai/에 게시되었습니다. 샤드2. 이전에 읽으셨다면 다음 섹션으로 건너뛰세요.
그들이 상호 작용하는 것은 유효한 블록 시퀀스의 결과이며 그러한 시퀀스는 of block은 실제로 샤드의 정식 체인입니다. 그렇지 않은 문제 샤딩되지 않은 blockchain에 존재합니다. 먼저 제안된 이 문제에 대한 간단한 해결책을 제시하겠습니다. 여러 프로토콜을 사용하여 이 솔루션이 어떻게 중단될 수 있는지 분석하고 이를 해결하기 위한 시도가 이루어졌습니다. 2.1 검증인 교체 상태 타당성에 대한 순진한 해결책은 그림 5에 나와 있습니다. 전체 시스템에는 수천 개의 validator이 있으며 그 중 20% 이하가 악의적이거나 다른 방식으로 실패합니다(예: 온라인으로 블록을 생성합니다). 그런 다음 200개의 validator을 샘플링하면 확률은 1개 이상의 실용적인 목적으로 3개의 실패는 0으로 가정될 수 있습니다. 그림 5: 샘플링 validators 1 3은 중요한 기준점이다. 합의 프로토콜 계열이 있습니다. BFT 합의 프로토콜은 1보다 적은 기간 동안 이를 보장합니다. 3개 참가자가 충돌하거나 규정을 위반하는 방식으로 행동하여 실패합니다. 프로토콜을 통해 합의에 도달할 것입니다. 정직한 validator 백분율을 가정하여 현재 세트가 샤드의 validators는 우리에게 일부 블록을 제공하며 순진한 솔루션은 가정합니다. 블록이 유효하고 validators가 믿었던 것을 기반으로 구축되었습니다. 검증을 시작할 때 해당 샤드에 대한 정식 체인입니다. validators 이전 validator 세트에서 표준 체인을 배웠습니다. 캐노니컬 체인의 선두인 블록 위에 구축된 가정 그 전에. 유도에 의해 전체 체인이 유효하며 validators 세트가 없기 때문에 어느 시점에서든 포크가 생성되면 순진한 솔루션은 현재의 체인은 샤드의 유일한 체인입니다. 시각화는 그림 6을 참조하세요.
그림 6: BFT 합의를 통해 확정된 각 블록의 blockchain validators가 다음과 같을 수 있다고 가정하면 이 간단한 솔루션은 작동하지 않습니다. 이는 적응적으로 손상되었으며 이는 불합리한 가정이 아닙니다6. 적응적으로 1000개의 샤드가 있는 시스템에서 단일 샤드를 손상시키는 것이 훨씬 저렴합니다. 전체 시스템을 손상시키는 것보다. 따라서 프로토콜의 보안은 샤드 수에 따라 선형적으로 감소합니다. 타당성에 대한 확신을 갖기 위해 블록을 생성하려면 역사상 어느 시점에서든 시스템의 샤드가 없음을 알아야 합니다. validator의 대다수가 공모하고 있습니다. 적응형 적과 함께라면 우리는 더 이상 그런 확신. 섹션 1.5에서 논의한 것처럼 validators의 공모는 행사할 수 있습니다. 두 가지 기본적인 악의적 행동: 포크 생성 및 유효하지 않은 블록 생성. 악의적인 포크는 일반적으로 기존보다 훨씬 더 높은 보안을 갖도록 설계된 비콘 체인에 블록을 교차 연결하여 처리할 수 있습니다. 샤드 체인. 그러나 유효하지 않은 블록을 생성하는 것은 훨씬 더 많은 것입니다. 해결해야 할 어려운 문제. 2.2 상태 유효성 샤드 #1이 손상되고 악의적인 행위자가 생성하는 그림 7을 생각해 보세요. 유효하지 않은 블록 B. 이 블록 B에서 1000 tokens가 씬에서 생성되었다고 가정합니다. 앨리스 계정으로 방송됩니다. 그런 다음 악의적인 행위자는 유효한 블록 C를 생성합니다( C의 트랜잭션이 올바르게 적용되었음을 감지) B 위에서 난독화 유효하지 않은 블록 B를 삭제하고 샤드 #2에 대한 교차 샤드 트랜잭션을 시작합니다. 1000 token을 Bob의 계좌로 이체합니다. 지금부터 부적절하게 생성된 token은 샤드 #2의 완전히 유효한 blockchain에 상주합니다. 이 문제를 해결하기 위한 몇 가지 간단한 접근 방식은 다음과 같습니다. 6읽기 이 기사 에 대한 세부사항 에 어떻게 적응형 부패 할 수 있다 있다 운반 밖으로: https://medium.com/nearprotocol/d859adb464c8. 에 대한 더 세부사항 에 적응형 부패, 읽다 https://github.com/ethereum/wiki/wiki/Sharding-FAQ# 우리가 운영하고 있는 보안 모델은 무엇입니까?그림 7: 유효하지 않은 블록이 있는 체인의 교차 샤드 트랜잭션 1. 샤드 #2의 validators에 대해 트랜잭션이 발생한 블록을 검증합니다. 시작됩니다. 위의 예에서도 블록 C 때문에 작동하지 않습니다. 완전히 유효한 것 같습니다. 2. 샤드 #2의 validators에서 트랜잭션이 시작되는 블록 이전에 있는 다수의 블록을 검증합니다. 당연히, 수신 샤드에 의해 검증된 블록 수 N validators는 잘못된 블록 위에 N+1개의 유효한 블록을 생성할 수 있습니다. 생산. 이 문제를 해결하기 위한 유망한 아이디어는 샤드를 배열하는 것입니다. 각 샤드가 여러 다른 샤드에 연결된 무방향 그래프 인접한 샤드 간의 교차 샤드 트랜잭션만 허용합니다. Vlad Zamfir의 샤딩은 기본적으로 작동하며7, Kadena의 샤딩에서도 비슷한 아이디어가 사용됩니다. 체인웹 [1]). 샤드 간 교차 샤드 트랜잭션이 필요한 경우 이웃이 아닌 경우 이러한 트랜잭션은 여러 샤드를 통해 라우팅됩니다. 이 디자인에서는 각 샤드의 validator는 샤드의 모든 블록을 모두 검증해야 합니다. 모든 인접 샤드의 모든 블록도 마찬가지입니다. 아래 그림을 고려하십시오 샤드 10개, 각 샤드에는 4개의 이웃이 있고 더 많은 샤드가 필요한 샤드는 2개 없습니다. 그림 8에 표시된 교차 샤드 통신의 경우 홉이 2개 이상입니다. 샤드 #2는 자체 blockchain뿐만 아니라 blockchain도 검증합니다. 샤드 #1을 포함한 모든 이웃. 따라서 샤드 #1의 악의적인 행위자가 유효하지 않은 블록 B를 생성하려고 시도한 다음 그 위에 블록 C를 구축하려고 합니다. 교차 샤드 트랜잭션을 시작하면 이러한 교차 샤드 트랜잭션은 진행되지 않습니다. 샤드 #2가 샤드 #1의 전체 기록을 검증했기 때문에 유효하지 않은 블록 B를 식별하게 됩니다. 7여기에서 디자인에 대해 자세히 알아보세요: https://medium.com/nearprotocol/37e538177ed9
그림 8: 체인웹과 같은 시스템에서 잘못된 교차 샤드 트랜잭션이 발생합니다. 감지되다 단일 샤드를 손상시키는 것은 더 이상 실행 가능한 공격이 아니지만 소수의 샤드가 문제로 남아 있습니다. 그림 9에서는 두 샤드 모두를 손상시키는 적
1과 샤드 #2는 샤드 #3에 대한 교차 샤드 트랜잭션을 성공적으로 실행합니다.
유효하지 않은 블록 B의 자금으로: 그림 9: 체인웹과 같은 시스템에서 잘못된 교차 샤드 트랜잭션이 발생합니다. 감지되지 않음 샤드 #3은 샤드 #2의 모든 블록을 검증하지만 샤드 #1에서는 그렇지 않습니다. 악성 블록을 탐지할 방법이 없습니다. 상태 타당성을 적절하게 해결하는 데에는 두 가지 주요 방향이 있습니다.
및 계산의 암호화 증명. 2.3 어부 첫 번째 접근 방식의 기본 아이디어는 다음과 같습니다. 어떤 목적으로든 체인 간에 통신됩니다(예: 비콘 체인 또는 교차 샤드 트랜잭션)에는 일정 기간이 있습니다. 정직한 validator은 블록이 유효하지 않다는 증거를 제공할 수 있습니다. 거기 블록이 다음과 같다는 매우 간결한 증거를 가능하게 하는 다양한 구성입니다. 유효하지 않으므로 수신 노드의 통신 오버헤드가 훨씬 작습니다. 전체 블록을 받는 것보다 적어도 하나의 정직한 validator이 있는 한 이 접근 방식을 사용합니다. 샤드, 시스템은 안전합니다. 그림 10: 어부 이는 오늘날 제안된 프로토콜 중에서 (문제가 존재하지 않는 척하는 것 외에도) 지배적인 접근 방식입니다. 그러나 이 접근 방식에는 두 가지가 있습니다. 주요 단점: 1. 정직한 validator을 위해서는 도전 기간이 충분히 길어야 합니다. 블록이 생성되었음을 인식하고, 다운로드하고, 완전히 검증하고, 준비하는 것 블록이 유효하지 않은 경우 챌린지입니다. 그러한 기간을 도입하면 샤드 간 트랜잭션 속도가 현저히 느려집니다. 2. 챌린지 프로토콜의 존재로 인해 새로운 공격 벡터가 생성됩니다. 악성 노드가 유효하지 않은 챌린지로 스팸을 보낼 때. 확실한 해결책 이 문제는 도전자가 일정량의 token을 입금하도록 하는 것입니다. 챌린지가 유효한 경우 반환됩니다. 이는 부분적인 해결책일 뿐이므로 공격자가 시스템에 스팸을 보내는 것은 여전히 유익할 수 있습니다. 예금) 유효하지 않은 도전과 함께, 예를 들어 유효한 것을 방지하기 위해정직한 validator의 도전을 통과하세요. 이러한 공격은 애도 공격이라고합니다. 후자의 지점을 우회하는 방법은 섹션 3.7.2를 참조하세요. 2.4 간결한 비대화형 지식 논증 다중 샤드 손상에 대한 두 번째 해결책은 특정 계산(예: 일련의 거래에서 블록을 계산하는 것처럼)이 올바르게 수행되었습니다. 이러한 구조가 존재합니다. zk-SNARK, zk-STARK 및 기타 몇 가지 일부는 오늘날 개인 결제를 위해 blockchain 프로토콜에서 적극적으로 사용됩니다. 가장 주목할만한 것은 ZCash입니다. 이러한 기본 요소의 주요 문제점은 다음과 같습니다. 계산 속도가 매우 느립니다. 예: zk-SNARK를 사용하는 Coda 프로토콜 특히 blockchain의 모든 블록이 유효하다는 것을 증명하기 위해 증거를 만드는 데 거래당 30초가 걸릴 수 있다는 인터뷰 (이 숫자는 아마도 지금쯤에는 더 작을 것입니다). 흥미롭게도, 신뢰할 수 있는 당사자가 증명을 계산할 필요가 없습니다. 증명은 그것이 만들어진 계산의 타당성을 증명할 뿐만 아니라 증명 자체의 타당성. 따라서 그러한 증명의 계산은 분할될 수 있습니다. 것보다 중복성이 훨씬 적은 참가자 집합 중에서 신뢰할 수 없는 계산을 수행하는 데 필요합니다. 참가자에게도 허용됩니다. zk-SNARK를 계산하여 비용을 줄이지 않고 특수 하드웨어에서 실행하는 사람 시스템의 분산화. 성능 외에도 zk-SNARK의 과제는 다음과 같습니다. 1. 덜 연구되고 덜 테스트된 암호화 기본 요소에 대한 의존성 2. "독성 폐기물" — zk-SNARK는 그룹이 신뢰하는 설정에 의존합니다. 의 사람들이 일부 계산을 수행한 다음 중간 결과를 버립니다. 해당 계산의 값. 절차의 모든 참가자가 공모하는 경우 중간 값을 유지하면 가짜 증거가 생성될 수 있습니다. 3. 시스템 설계에 추가 복잡성이 도입되었습니다. 4. zk-SNARK는 가능한 계산의 하위 집합에 대해서만 작동하므로 프로토콜은 Turing-complete smart contract 언어로는 사용할 수 없습니다 SNARK는 체인의 유효성을 증명합니다. 2.5 데이터 가용성 우리가 다룰 두 번째 문제는 데이터 가용성입니다. 일반적으로 노드 특정 blockchain을 운영하는 것은 두 그룹으로 구분됩니다: 전체 노드, 모든 전체 블록을 다운로드하고 모든 거래를 검증하는 것, 그리고 Light 블록 헤더만 다운로드하고 부분에 Merkle 증명을 사용하는 노드 그림 11에서 볼 수 있듯이 그들이 관심을 갖고 있는 상태와 트랜잭션에 대해 설명합니다.
그림 11: 머클 트리 이제 대다수의 전체 노드가 공모하면 유효하거나 유효한 블록을 생성할 수 있습니다. 유효하지 않으며 hash을 라이트 노드로 보내지만 전체 내용을 공개하지 마십시오. 블록의. 그들이 그것으로부터 이익을 얻을 수 있는 방법은 다양합니다. 예를 들어, 그림 12를 살펴보세요. 그림 12: 데이터 가용성 문제 세 가지 블록이 있습니다. 이전 블록 A는 정직한 validators에 의해 생성되었습니다. 현재 B에는 validators가 공모하고 있습니다. 그리고 다음 C도 생산될 것이다. 정직한 validators(blockchain는 오른쪽 하단에 표시되어 있습니다). 당신은 상인입니다. 현재 블록(B)의 validators가 수신된 블록입니다. 이전 validators의 A는 귀하가 돈을 받는 블록을 계산했습니다.상태에 대한 Merkle 증명과 함께 해당 블록의 헤더를 보냈습니다. 당신은 돈이 있습니다 (또는 돈을 보내는 유효한 거래에 대한 머클 증명 당신에게). 거래가 완료되었음을 확신하고 서비스를 제공합니다. 그러나 validators는 블록 B의 전체 내용을 절대 배포하지 않습니다. 누구나. 따라서 블록 C의 정직한 validators는 블록을 검색할 수 없으며, 강제로 시스템을 정지시키거나 A 위에 구축해야 하므로 돈 상인. 동일한 시나리오를 샤딩에 적용할 때 전체 및 샤딩의 정의는 다음과 같습니다. 라이트 노드는 일반적으로 샤드별로 적용됩니다. 각 샤드의 validators는 매 다운로드마다 해당 샤드를 차단하고 해당 샤드의 모든 트랜잭션을 검증하지만 다른 스냅샷 샤드 체인 상태를 포함하는 시스템의 노드 비콘 체인의 경우 헤더만 다운로드하세요. 따라서 샤드의 validator은 다음과 같습니다. 해당 샤드의 노드를 사실상 가득 채우는 반면, 시스템의 다른 참가자는 비콘 체인을 포함하여 라이트 노드로 작동합니다. 위에서 논의한 어부 접근 방식의 경우 정직한 validators 비콘 체인에 교차 연결된 블록을 다운로드할 수 있어야 합니다. 악의적인 validators가 유효하지 않은 블록의 헤더를 교차 연결하거나 이를 사용하여 교차 샤드 트랜잭션을 시작하지만 블록을 배포하지는 않습니다. validators는 도전 과제를 만들 방법이 없습니다. 우리는 이 문제를 보완하는 세 가지 접근 방식을 다룰 것입니다. 서로. 2.5.1 양육권 증명 해결해야 할 가장 시급한 문제는 블록이 한 번만 사용 가능한지 여부입니다. 출판되었습니다. 제안된 아이디어 중 하나는 회전하는 소위 공증인을 갖는 것입니다. 유일한 작업이 다운로드인 validator보다 더 자주 샤드 사이에 다운로드할 수 있었다는 사실을 차단하고 증명합니다. 그들은 수 있습니다 전체 상태를 다운로드할 필요가 없기 때문에 더 자주 회전됩니다. 자주 회전할 수 없는 validator과 달리 샤드의 그림과 같이 샤드가 회전할 때마다 샤드의 상태를 다운로드해야 합니다. 13. 이 순진한 접근 방식의 문제점은 나중에 증명하는 것이 불가능하다는 것입니다. 공증인이 블록을 다운로드했는지 여부에 따라 공증인은 없이 블록을 다운로드할 수 있었다는 것을 항상 증명하도록 선택할 수 있습니다. 그것을 되찾으려고도 합니다. 이에 대한 한 가지 해결책은 공증인이 다음을 제공하는 것입니다. 어떤 증거를 확보하거나 블록이 다운로드되었습니다. 그러한 솔루션 중 하나가 여기에서 논의됩니다: https://ethresear.ch/t/ 1비트 집합 친화적 보관 채권/2236. 2.5.2 삭제 코드 특정 라이트 노드가 블록의 hash을 수신하면 노드의 라이트 노드를 늘리기 위해 블록이 사용 가능하다는 확신이 있으면 몇 가지 무작위 다운로드를 시도할 수 있습니다. 블록 조각. 이것은 완전한 해결책이 아닙니다. 왜냐하면 라이트 노드가 그렇지 않으면 악의적인 블록 생산자가 선택할 수 있는 전체 블록을 집합적으로 다운로드합니다.
그림 13: 유효성 검사기는 상태를 다운로드해야 하므로 회전할 수 없습니다. 자주 라이트 노드에 의해 다운로드되지 않은 블록 부분을 보류하기 위해, 따라서 여전히 블록을 사용할 수 없게 됩니다. 한 가지 해결책은 삭제 코드라는 구성을 사용하여 이를 가능하게 하는 것입니다. 그림과 같이 블록의 일부만 사용할 수 있는 경우에도 전체 블록을 복구하려면 그림 14에서. 그림 14: Merkle tree 삭제 코딩된 데이터 위에 구축됨 Polkadot 및 Ethereum Serenity는 모두 이 아이디어를 바탕으로 디자인했습니다. 라이트 노드가 블록을 사용할 수 있다고 합리적으로 확신할 수 있는 방법을 제공합니다. Ethereum Serenity 접근 방식은 [2]에 자세한 설명이 있습니다.2.5.3 데이터 가용성에 대한 Polkadot의 접근 방식 Polkadot에서는 대부분의 샤드 솔루션과 마찬가지로 각 샤드(파라체인이라고 함)가 비콘 체인(릴레이 체인이라고 함)에 해당 블록의 스냅샷을 찍습니다. 2f + 1이 있다고 가정해 보세요. 릴레이 체인의 validators. 파라체인 블록의 블록 생산자는 콜레이터, 일단 파라체인 블록이 생성되면 모든 f 부분이 충분하도록 2f +1 부분으로 구성된 블록의 삭제 코딩 버전을 계산합니다. 블록을 재구성합니다. 그런 다음 각 validator에 하나의 부품을 배포합니다. 릴레이 체인. 특정 릴레이 체인 validator은 릴레이 체인에만 서명합니다. 스냅샷된 각 파라체인 블록에 해당 부분이 있는 경우 블록을 차단합니다. 그러한 릴레이 체인 블록. 따라서 릴레이 체인 블록에 2f + 1의 서명이 있는 경우 validators, 그리고 그 중 f개 이상이 프로토콜을 위반하지 않는 한, 각각은 파라체인 블록은 validators에서 부품을 가져와서 재구성할 수 있습니다. 프로토콜을 따르는 것입니다. 그림 15를 참조하십시오. 그림 15: Polkadot의 데이터 가용성 2.5.4 장기적인 데이터 가용성 위에서 논의한 모든 접근 방식은 블록이 다음과 같다는 사실만 입증합니다. 전혀 게시되지 않았으며 현재 사용할 수 있습니다. 블록은 나중에 사용할 수 없게 될 수 있습니다. 다양한 이유: 노드가 오프라인 상태가 됨, 노드가 의도적으로 기록을 삭제함 데이터 및 기타. 이 문제를 해결하기 위해 언급할 가치가 있는 백서는 Polyshard [3]입니다. 여러 개의 블록이 있더라도 샤드 전체에서 블록을 사용할 수 있도록 삭제 코드를 사용합니다. 샤드는 데이터를 완전히 잃습니다. 불행하게도 그들의 특정 접근 방식에는 다음이 필요합니다. 모든 샤드는 다른 모든 샤드에서 블록을 다운로드해야 합니다. 비싸다. 장기적인 가용성은 문제만큼 시급하지 않습니다. 참가자가 없기 때문입니다. 시스템의 모든 체인을 검증할 수 있을 것으로 예상됩니다.
샤딩된 프로토콜의 보안은 다음과 같이 설계되어야 합니다. 일부 샤드의 일부 오래된 블록이 손상되더라도 시스템은 안전합니다. 전혀 사용할 수 없습니다.
Nightshade
Nightshade
3.1 From shard chains to shard chunks The sharding model with shard chains and a beacon chain is very powerful but has certain complexities. In particular, the fork choice rule needs to be executed in each chain separately, the fork choice rule in the shard chains and the beacon chain must be built differently and tested separately. In Nightshade we model the system as a single blockchain, in which each block logically contains all the transactions for all the shards, and changes the whole state of all the shards. Physically, however, no participant downloads the full state or the full logical block. Instead, each participant of the network only maintains the state that corresponds to the shards that they validate transactions for, and the list of all the transactions in the block is split into physical chunks, one chunks per shard. Under ideal conditions each block contains exactly one chunk per shard per block, which roughly corresponds to the model with shard chains in which the shard chains produce blocks with the same speed as the beacon chain. However, due to network delays some chunks might be missing, so in practice each block contains either one or zero chunks per shard. See section 3.3 for details on how blocks are produced. Figure 16: A model with shard chains on the left and with one chain having blocks split into chunks on the right
3.2 Consensus The two dominant approaches to the consensus in the blockchains today are the longest (or heaviest) chain, in which the chain that has the most work or stake used to build it is considered canonical, and BFT, in which for each block some set of validators reach a BFT consensus. In the protocols proposed recently the latter is a more dominant approach, since it provides immediate finality, while in the longest chain more blocks need to be built on top of the block to ensure the finality. Often for a meaningful security the time it takes for sufficient number of blocks to be built takes on the order of hours. Using BFT consensus on each block also has disadvantages, such as: 1. BFT consensus involves considerable amount of communication. While recent advances allow the consensus to be reached in linear time in number of participants (see e.g. [4]), it is still noticeable overhead per block; 2. It is unfeasible for all the network participants to participate in the BFT consensus per block, thus usually only a randomly sampled subset of participants reach the consensus. A randomly sampled set can be, in principle, adaptively corrupted, and a fork in theory can be created. The system either needs to be modelled to be ready for such an event, and thus still have a fork-choice rule besides the BFT consensus, or be designed to shut down in such an event. It is worth mentioning that some designs, such as Algorand [5], significantly reduce the probability of adaptive corruption. 3. Most importantly, the system stalls if 1 3 or more of all the participants are offline. Thus, any temporary network glitch or a network split can completely stall the system. Ideally the system must be able to continue to operate for as long as at least half of the participants are online (heaviest chain-based protocols continue operating even if less than half of the participants are online, but the desirability of this property is more debatable within the community). A hybrid model in which the consensus used is some sort of the heaviest chain, but some blocks are periodically finalized using a BFT finality gadget maintain the advantages of both models. Such BFT finality gadgets are Casper FFG [6] used in Ethereum 2.0 8, Casper CBC (see https://vitalik. ca/general/2018/12/05/cbc_casper.html) and GRANDPA (see https:// medium.com/polkadot-network/d08a24a021b5) used in Polkadot. Nightshade uses the heaviest chain consensus. Specifically when a block producer produces a block (see section 3.3), they can collect signatures from other block producers and validators attesting to the previous block. See section 3.8 for details how such large number of signatures is aggregated. The weight 8Also see the whiteboard session with Justin Drake for an indepth overview of Casper FFG, and how it is integrated with the GHOST heaviest chain consensus here: https://www. youtube.com/watch?v=S262StTwkmo
of a block is then the cumulative stake of all the signers whose signatures are included in the block. The weight of a chain is the sum of the block weights. On top of the heaviest chain consensus we use a finality gadget that uses the attestations to finalize the blocks. To reduce the complexity of the system, we use a finality gadget that doesn’t influence the fork choice rule in any way, and instead only introduces extra slashing conditions, such that once a block is finalized by the finality gadget, a fork is impossible unless a very large percentage of the total stake is slashed. Casper CBC is such a finality gadget, and we presently model with Casper CBC in mind. We also work on a separate BFT protocol called TxFlow. At the time of writing this document it is unclear if TxFlow will be used instead of Casper CBC. We note, however, that the choice of the finality gadget is largely orthogonal to the rest of the design. 3.3 Block production In Nightshade there are two roles: block producers and validators. At any point the system contains w block producers, w = 100 in our models, and wv validators, in our model v = 100, wv = 10, 000. The system is Proof-of-Stake, meaning that both block producers and validators have some number of internal currency (referred to as ”tokens”) locked for a duration of time far exceeding the time they spend performing their duties of building and validating the chain. As with all the Proof of Stake systems, not all the w block producers and not all the wv validators are different entities, since that cannot be enforced. Each of the w block producers and the wv validators, however, do have a separate stake. The system contains n shards, n = 1000 in our model. As mentioned in section 3.1, in Nightshade there are no shard chains, instead all the block producers and validators are building a single blockchain, that we refer to as the main chain. The state of the main chain is split into n shards, and each block producer and validator at any moment only have downloaded locally a subset of the state that corresponds to some subset of the shards, and only process and validate transactions that affect those parts of the state. To become a block producer, a participant of the network locks some large amount of tokens (a stake). The maintenance of the network is done in epochs, where an epoch is a period of time on the order of days. The participants with the w largest stakes at the beginning of a particular epoch are the block producers for that epoch. Each block producer is assigned to sw shards, (say sw = 40, which would make sww/n = 4 block producers per shard). The block producer downloads the state of the shard they are assigned to before the epoch starts, and throughout the epoch collects transactions that affect that shard, and applies them to the state. For each block b on the main chain, and for every shards s, there’s one of the assigned block producers to s who is responsible to produce the part of b related to the shard. The part of b related to shard s is called a chunk, and contains the list of the transactions for the shard to be included in b, as well as the merkle
root of the resulting state. b will ultimately only contain a very small header of the chunk, namely the merkle root of all the applied transactions (see section 3.7.1 for exact details), and the merkle root of the final state. Throughout the rest of the document we often refer to the block producer that is responsible to produce a chunk at a particular time for a particular shard as a chunk producer. Chunk producer is always one of the block producers. The block producers and the chunk producers rotate each block according to a fixed schedule. The block producers have an order and repeatedly produce blocks in that order. E.g. if there are 100 block producers, the first block producers is responsible for producing blocks 1, 101, 201 etc, the second is responsible for producing 2, 102, 202 etc). Since chunk production, unlike the block production, requires maintaining the state, and for each shard only sww/n block producers maintain the state per shard, correspondingly only those sww/n block producers rotate to create chunks. E.g. with the constants above with four block producers assigned to each shard, each block producer will be creating chunks once every four blocks. 3.4 Ensuring data availability To ensure the data availability we use an approach similar to that of Polkadot described in section 2.5.3. Once a block producer produces a chunk, they create an erasure coded version of it with an optimal (w, ⌊w/6 + 1⌋) block code of the chunk. They then send one piece of the erasure coded chunk (we call such pieces chunk parts, or just parts) to each block producer. We compute a merkle tree that contains all the parts as the leaves, and the header of each chunk contains the merkle root of such tree. The parts are sent to the validators via onepart messages. Each such message contains the chunk header, the ordinal of the part and the part contents. The message also contains the signature of the block producer who produced the chunk and the merkle path to prove that the part corresponds to the header and is produced by the proper block producer. Once a block producer receives a main chain block, they first check if they have onepart messages for each chunk included in the block. If not, the block is not processed until the missing onepart messages are retrieved. Once all the onepart messages are received, the block producer fetches the remaining parts from the peers and reconstructs the chunks for which they hold the state. The block producer doesn’t process a main chain block if for at least one chunk included in the block they don’t have the corresponding onepart message, or if for at least one shard for which they maintain the state they cannot reconstruct the entire chunk. For a particular chunk to be available it is enough that ⌊w/6⌋+1 of the block producers have their parts and serve them. Thus, for as long as the number of malicious actors doesn’t exceed ⌊w/3⌋no chain that has more than half block producers building it can have unavailable chunks.
Figure 17: Each block contains one or zero chunks per shard, and each chunk is erasure coded. Each part of the erasure coded chunk is sent to a designated block producer via a special onepart message 3.4.1 Dealing with lazy block producers If a block producer has a block for which a onepart message is missing, they might choose to still sign on it, because if the block ends up being on chain it will maximize the reward for the block producer. There’s no risk for the block producer since it is impossible to prove later that the block producer didn’t have the onepart message. To address it we make each chunk producer when creating the chunk to choose a color (red or blue) for each part of the future encoded chunk, and store the bitmask of assigned color in the chunk before it is encoded. Each onepart message then contains the color assigned to the part, and the color is used when computing the merkle root of the encoded parts. If the chunk producer deviates from the protocol, it can be easily proven, since either the merkle root will not correspond to onepart messages, or the colors in the onepart messages that correspond to the merkle root will not match the mask in the chunk. When a block producer signs on a block, they include a bitmask of all the red parts they received for the chunks included in the block. Publishing an incorrect bitmask is a slashable behavior. If a block producer hasn’t received a onepart message, they have no way of knowing the color of the message, and thus have a 50% chance of being slashed if they attempt to blidnly sign the block. 3.5 State transition application The chunk producers only choose which transactions to include in the chunk but do not apply the state transition when they produce a chunk. Correspondingly,
the chunk header contains the merkle root of the merkelized state as of before the transactions in the chunk are applied. The transactions are only applied when a full block that includes the chunk is processed. A participant only processes a block if 1. The previous block was received and processed; 2. For each chunk the participant doesn’t maintain the state for they have seen the onepart message; 3. For each chunk the participant does maintain the state for they have the full chunk. Once the block is being processed, for each shard for which the participant maintains the state for, they apply the transactions and compute the new state as of after the transactions are applied, after which they are ready to produce the chunks for the next block, if they are assigned to any shard, since they have the merkle root of the new merkelized state. 3.6 Cross-shard transactions and receipts If a transaction needs to affect more than one shard, it needs to be consecutively executed in each shard separately. The full transaction is sent to the first shard affected, and once the transaction is included in the chunk for such shard, and is applied after the chunk is included in a block, it generates a so called receipt transaction, that is routed to the next shard in which the transaction need to be executed. If more steps are required, the execution of the receipt transaction generates a new receipt transaction and so on. 3.6.1 Receipt transaction lifetime It is desirable that the receipt transaction is applied in the block that immediately follows the block in which it was generated. The receipt transaction is only generated after the previous block was received and applied by block producers that maintain the originating shard, and needs to be known by the time the chunk for the next block is produced by the block producers of the destination shard. Thus, the receipt must be communicated from the source shard to the destination shard in the short time frame between those two events. Let A be the last produced block which contains a transaction t that generates a receipt r. Let B be the next produced block (i.e. a block that has A as its previous block) that we want to contain r. Let t be in the shard a and r be in the shard b. The lifetime of the receipt, also depicted on figure 18, is the following: Producing and storing the receipts. The chunk producer cpa for shard a receives the block A, applies the transaction t and generates the receipt r. cpa then stores all such produced receipts in its internal persistent storage indexed by the source shard id.
Distributing the receipts. Once cpa is ready to produce the chunk for shard a for block B, they fetch all the receipts generated by applying the transactions from block A for shard a, and included them into the chunk for shrad a in block B. Once such chunk is generated, cpa produces its erasure coded version and all the corresponding onepart messages. cpa knows what block producers maintain the full state for which shards. For a particular block producer bp cpa includes the receipts that resulted from applying transactions in block A for shard a that have any of the shards that bp cares about as their destination in the onepart message when they distributed the chunk for shard a in block B (see figure 17, that shows receipts included in the onepart message). Receiving the receipts. Remember that the participants (both block producers and validators) do not process blocks until they have onepart messages for each chunk included in the block. Thus, by the time any particular particpiant applies the block B, they have all the onepart messages that correspond to chunks in B, and thus they have all the incoming receipts that have the shards the participant maintains state for as their destination. When applying the state transition for a particular shard, the participant apply both the receipts that they have collected for the shard in the onepart messages, as well as all the transactions included in the chunk itself. Figure 18: The lifetime of a receipt transaction 3.6.2 Handling too many receipts It is possible that the number of receipts that target a particular shard in a particular block is too large to be processed. For example, consider figure 19, in which each transaction in each shard generates a receipt that targets shard 1. By the next block the number of receipts that shard 1 needs to process is comparable to the load that all the shards combined processed while handling the previous block.
Figure 19: If all the receipts target the same shard, the shard might not have the capacity to process them To address it we use a technique similar to that used in QuarkChain 9. Specifically, for each shard the last block B and the last shard s within that block from which the receipts were applied is recorded. When the new shard is created, the receipt are applied in order first from the remaining shards in B, and then in blocks that follow B, until the new chunk is full. Under normal circumstances with a balanced load it will generally result in all the receipts being applied (and thus the last shard of the last block will be recorded for each chunk), but during times when the load is not balanced, and a particular shard receives disproportionately many receipts, this technique allows them to be processed while respecting the limits on the number of transactions included. Note that if such unbalanced load remains for a long time, the delay from the receipt creation until application can continue growing indefinitely. One way to address it is to drop any transaction that creates a receipt targeting a shard that has a processing delay that exceeds some constant (e.g. one epoch). Consider figure 20. By block B the shard 4 cannot process all the receipts, so it only processes receipts origination from up to shard 3 in block A, and records it. In block C the receipts up to shard 5 in block B are included, and then by block D the shard catches up, processing all the remaining receipts in block B and all the receipts from block C. 3.7 Chunks validation A chunk produced for a particular shard (or a shard block produced for a particular shard chain in the model with shard chains) can only be validated by the 9See the whiteboard episode with QuarkChain here: https://www.youtube.com/watch? v=opEtG6NM4x4, in which the approach to cross-shard transactions is discussed, among other things
Figure 20: Delayed receipts processing participants that maintain the state. They can be block producers, validators, or just external witnesses that downloaded the state and validate the shard in which they store assets. In this document we assume that majority of the participants cannot store the state for a large fraction of the shards. It is worth mentioning, however, that there are sharded blockchains that are designed with the assumption that most participants do have capacity to store the state for and validate most of the shards, such as QuarkChain. Since only a fraction of the participants have the state to validate the shard chunks, it is possible to adaptive corrupt just the participants that have the state, and apply an invalid state transition. Multiple sharding designs were proposed that sample validators every few days, and within a day any block in the shard chain that has more than 2/3 of signatures of the validators assigned to such shard is immediately considered final. With such approach an adaptive adversary only needs to corrupt 2n/3+1 of the validators in a shard chain to apply an invalid state transition, which, while is likely hard to pull off, is not a level of security sufficient for a public blockchain. As discussed in section 2.3, the common approach is to allow a certain window of time after a block is created for any participant that has state (whether it’s a block producer, a validator, or an external observer) to challenge its validity. Such participants are called Fishermen. For a fisherman to be able to challenge an invalid block, it must be ensured that such a block is available to them. The data availability in Nightshade is discussed in section 3.4. In Nightshade once a block is produced, the chunks were not validated by anyone but the actual chunk producer. In particular, the block producer that suggested the block naturally didn’t have the state for most of the shards, and
was not able to validate the chunks. When the next block is produced, it contains attestations (see section 3.2) of multiple block producers and validators, but since the majority of block producers and validators do not maintain state for most shards as well, a block with just one invalid chunk will collect significantly more than half of the attestations and will continue being on the heaviest chain. To address this issue, we allow any participant that maintains the state of a shard to submit a challenge on-chain for any invalid chunk produced in that shard. 3.7.1 State validity challenge Once a participant detects that a particular chunk is invalid, they need to provide a proof that the chunk is invalid. Since the majority of the network participants do not maintain the state for the shard in which the invalid chunk is produced, the proof needs to have sufficient information to confirm the block is invalid without having the state. We set a limit Ls of the amount of state (in bytes) that a single transaction can cumulatively read or write. Any transaction that touches more than Ls state is considered to be invalid. Remember from the section 3.5 that the chunk in a particular block B only contains the transactions to be applied, but not the new state root. The state root included in the chunk in block B is the state root before applying such transactions, but after applying the transactions from the last chunk in the same shard before the block B. A malicious actor that wishes to apply an invalid state transition would include an incorrect state root in block B that doesn’t correspond to the state root that results from applying the transactions in the preceding chunk. We extend the information that a chunk producer includes in the chunk. Instead of just including the state after applying all the transactions, it instead includes a state root after applying each contiguous set of transactions that collectively read and write Ls bytes of state. With this information for the fisherman to create a challenge that a state transition is applied incorrectly it is sufficient to find the first such invalid state root, and include just Ls bytes of state that are affected by the transactions between the last state root (which was valid) and the current state root with the merkle proofs. Then any participant can validate the transactions in the segment and confirm that the chunk is invalid. Similarly, if the chunk producer attempted to include transactions that read and write more than Ls bytes of state, for the challenge it is enough to include the first Ls bytes it touches with the merkle proofs, which will be enough to apply the transactions and confirm that there’s a moment when an attempt to read or write content beyond Ls bytes is made.
3.7.2 Fishermen and fast cross-shard transactions As discussed in section 2.3, once we assume that the shard chunks (or shard blocks in the model with shard chains) can be invalid and introduce a challenge period, it negatively affects the finality, and thus cross-shard communication. In particular, the destination shard of any cross-shard transction cannot be certain the originating shard chunk or block is final until the challenge period is over (see figure 21). Figure 21: Waiting for the challenge period before applying a receipt The way to address it in a way that makes the cross-shard transactions instantenious is for the destination shard to not wait for the challenge period after the source shard transaction is published, and apply the receipt transaction immediately, but then roll back the destination shard together with the source shard if later the originating chunk or block was found to be invalid (see figure 22). This applies very naturally to the Nightshade design in which the shard chains are not independent, but instead the shard chunks are all published together in the same main chain block. If any chunk is found to be invalid, the entire block with that chunk is considered invalid, and all the blocks built on top of it. See figure 23. Both of the above approaches provide atomicity assuming that the challenge period is sufficiently long. We use the latter approach since providing fast crossshard transactions under normal circumstances outweights the inconvenience of the destination shard rolling back due to an invalid state transition in one of the source shards, which is an extremely rare event. 3.7.3 Hiding validators The existence of the challenges already significantly reduces the probability of adaptive corruption, since to finalize a chunk with an invalid state transition post
Figure 22: Applying receipts immediately and rolling back the destination chain if the source chain had an invalid block Figure 23: Fisherman challenge in Nightshade the challenge period the adaptive adversary needs to corrupt all the participants that maintain the state of the shard, including all the validators. Estimating the likelihood of such an event is extremely complex, since no sharded blockchain has been live sufficiently long for any such attack to be attempted. We argue that the probability, while extremely low, is still sufficiently large for a system that is expected to execute multi-million transactions and run a world-wide financial operations. There are two main reasons for this belief: 1. Most of the validators of the Proof-of-Stake chains and miners of the
Proof-of-Work chains are primarily incentivized by the financial upside. If an adaptive adversary offers them more money then the expected return from operating honestly, it is reasonable to expect that many validators will accept the offer. 2. Many entities do validation of Proof-of-Stake chains professionally, and it is expected that a large percentage of the stake in any chain will be from such entities. The number of such entities is sufficiently small for an adaptive adversary to get to know most of them personally and have a good understanding of their inclanation to be corrupted. We take one step further in reducing the probability of the adaptive corruption by hiding which validators are assigned to which shard. The idea is remotely similar to the way Algorand [5] conceals validators. It is critical to note that even if the validators are concealed, as in Algorand or as described below, the adaptive corruption is still in theory possible. While the adaptive adversary doesn’t know the participants that will create or validate a block or a chunk, the participants themselves do know that they will perform such a task and have a cryptographic proof of it. Thus, the adversary can broadcast their intent to corrupt, and pay to any participant that will provide such a cryptographic proof. We note however, that since the adversary doesn’t know the validators that are assigned to the shard they want to corrupt, they have no other choice but to broadcast their intent to corrupt a particular shard to the entire community. At that point it is economically beneficial for any honest participant to spin up a full node that validates that shard, since there’s a high chance of an invalid block appearing in that shard, which is an opportunity to create a challenge and collect associated reward. To not reveal the validators that are assigned to a particular shard, we do the following (see figure 24): Using VRF to get the assignment. At the beginning of each epoch each validator uses a VRF to get a bitmask of the shards the validator is assigned to. The bitmask of each validator will have Sw bits (see section 3.3 for the definition of Sw). The validator then fetches the state of the corresponding shards, and during the epoch for each block received validates the chunks that correspond to the shards that the validator is assigned to. Sign on blocks instead of chunks. Since the shards assignment is concealed, the validator cannot sign on chunks. Instead it always signs on the entire block, thus not revealing what shards it validates. Specifically, when the validator receives a block and validates all the chunks, it either creates a message that attests that all the chunks in all the shards the validator is assigned to are valid (without indicating in any way what those shards are), or a message that contains a proof of an invalid state transition if any chunk is invalid. See the section 3.8 for the details on how such messages are aggregated, section 3.7.4 for the details on how to prevent validators from piggy-backing on messages from other validators, and section 3.7.5 for the details how to reward and punish validators should a successful invalid state transition challenge actually happen.
Figure 24: Concealing the validators in Nightshade 3.7.4 Commit-Reveal One of the common problems with validators is that a validator can skip downloading the state and actually validating the chunks and blocks, and instead observe the network, see what the other validators submit and repeat their messages. A validator that follows such a strategy doesn’t provide any extra security for the network, but collects rewards. A common solution for this problem is for each validator to provide a proof that they actually validated the block, for example by providing a unique trace of applying the state transition, but such proofs significantly increase the cost of validation. Figure 25: Commit-reveal
Instead we make the validators first commit to the validation result (either the message that attests to the validity of the chunks, or the proof of an invalid state transition), wait for a certain period, and only then reveal the actual validation result, as shown on figure 25. The commit period doesn’t intersect with the reveal period, and thus a lazy validator cannot copycat honest validators. Moreover, if a dishonest validator committed to a message that attests to the validity of the assigned chunks, and at least one chunk was invalid, once it is shown that the chunk is invalid the validator cannot avoid the slashing, since, as we show in section 3.7.5, the only way to not get slashed in such a situation is to present a message that contains a proof of the invalid state transition that matches the commit. 3.7.5 Handling challenges As discussed above, once a validator receives a block with an invalid chunk, they first prepare a proof of the invalid state transition (see section 3.7.1), then commit to such a proof (see 3.7.4), and after some period reveal the challenge. Once the revealed challenge is included in a block, the following happens: 1. All the state transitions that happened from the block containing the invalid chunk until the block in which the revealed challenge is included get nullyfied. The state before the block that includes the revealed challenge is considered to be the same as the state before the block that contained the invalid chunk. 2. Within a certain period of time each validator must reveal their bitmask of the shards they validate. Since the bitmask is created via a VRF, if they were assigned to the shard that had the invalid state transition, they cannot avoid revealing it. Any validator that fails to reveal the bitmask is assumed to be assigned to the shard. 3. Each validator that after such period is found to be assigned to the shard, that did commit to some validation result for the block containing the invalid chunk and that didn’t reveal the proof of invalid state transition that corresponds to their commit is slashed. 4. Each validator gets a new shards assignment, and a new epoch is scheduled to start after some time sufficient for all the validators to download the state, as shown on figure 26. Note that from the moment the validators reveal the shards they are assigned to until the new epoch starts the security of the system is reduced since the shards assignment is revealed. The participants of the network need to keep it in mind while using the network during such period. 3.8 Signature Aggregation For a system with hudreds of shards to operate securely, we want to have on the order of 10, 000 or more validators. As discussed in section 3.7, we want each
Figure 26: Handling the challenge validator to publish a commit to a certain message and a signature on average once per block. Even if the commit messages were the same, aggregating such a BLS-signature and validating it would have been prohibitively expensive. But naturally the commit and reveal messages are not the same across validators, and thus we need some way to aggregate such messages and the signatures in a way that allows for fast validation later. The specific approach we use is the following: Validators joining block producers. The block producers are known some time before the epoch starts, since they need some time to download the state before the epoch starts, and unlike the validators the block producers are not concealed. Each block producer has v validator slots. Validators submit off-chain proposals to the block producers to get included as one of their v validators. If a block producer wishes to include a validator, they submit a transaction that contains the initial off-chainrequest from the validator, and the block producer’s signature that makes the validator join the block producer. Note that the validators assigned to the block producers do not necessarily validate the same shards that the block producer produces chunks for. If a validator applied to join multiple block producers, only the transaction from the first block producer will succeed. Block producers collect commits. The block producer constantly collects the commit and reveal messages from the validators. Once a certain number of such messages are accumulated, the block producer computes a merkle tree of these messages, and sends to each validator the merkle root and the merkle path to their message. The validator validates the path and signs on the merkle root. The block producer then accumulates a BLS signature on the merkle root from the validators, and publishes only the merkle root and the accumulated signature. The block producer also signs on the validity of the multisignature using a cheap ECDSA signature. If the multisignature doesn’t match the merkle root submitted or the bitmask of the validators participating, it is a slashable behavior. When synchronizing the chain, a participant can choose to validate all the BLS signatures from the validators (which is extremely expensive since it involves aggregating validators public keys), or only
the ECDMA signatures from the block producers and rely on the fact that the block producer was not challenged and slashed. Using on-chain transactions and merkle proofs for challenges. It can be noted that there’s no value in revealing messages from validators if no invalid state transition was detected. Only the messages that contain the actual proofs of invalid state transition need to be revealed, and only for such messages it needs to be shown that they match the prior commit. The message needs to be revealed for two purposes: 1. To actually initiate the rollback of the chain to the moment before the invalid state transition (see section 3.7.5). 2. To prove that the validator didn’t attempt to attest to the validity of the invalid chunk. In either case we need to address two issues: 1. The actual commit was not included on chain, only the merkle root of the commit aggregated with other messages. The validator needs to use the merkle path provided by the block producer and their original commit to prove that they committed to the challenge. 2. It is possible that all the validators assigned to the shard with the invalid state transition happen to be assigned to corrupted block producers that are censoring them. To get around it we allow them to submit their reveals as a regular transaction on-chain and bypass the aggregation. The latter is only allowed for the proofs of invalid state transition, which are extremely rare, and thus should not result in spamming the blocks. The final issue that needs to be addressed is that the block producers can choose not to participate in messages aggregation or intentionally censor particular validators. We make it economically disadvantageous, by making the block producer reward proportional to the number of validators assigned to them. We also note that since the block producers between epochs largely intersect (since it’s always the top w participants with the highest stake), the validators can largely stick to working with the same block producers, and thus reduce the risk of getting assigned to a block producer that censored them in the past. 3.9 Snapshots Chain Since the blocks on the main chain are produced very frequently, downloading the full history might become expensive very quickly. Moreover, since every block contains a BLS signature of a large number of participants, just the aggregation of the public keys to check the signature might become prohibitively expensive as well. Finally, since in any foreseeable future Ethereum 1.0 will likely remain one of the most used blockchains, having a meaningful way to transfer assets from
Near to Ethereum is a requirement, and today verifying BLS signatures to ensure Near blocks validity on Ethereum’s side is not possible. Each block in the Nightshade main chain can optionally contain a Schnorr multisignature on the header of the last block that included such a Schnorr multisignature. We call such blocks snapshot blocks. The very first block of every epoch must be a snapshot block. While working on such a multisignature, the block producers must also accumulate the BLS signatures of the validators on the last snapshot block, and aggregate them the same way as described in section 3.8. Since the block producers set is constant throughout the epoch, validating only the first snapshot blocks in each epoch is sufficient assuming that at no point a large percentage of block producers and validators colluded and created a fork. The first block of the epoch must contain information sufficient to compute the block producers and validators for the epoch. We call the subchain of the main chain that only contains the snapshot blocks a snapshot chain. Creating a Schnorr multisignature is an interactive process, but since we only need to perform it infrequently, any, no matter how inefficient, process will suffice. The Schnorr multisignatures can be easily validated on Ethereum, thus providing crucial primitives for a secure way of performing cross-blockchain communication. To sync with the Near chain one only needs to download all the snapshot blocks and confirm that the Schnorr signatures are correct (optionally also verifying the individual BLS signatures of the validators), and then only syncing main chain blocks from the last snapshot block.
Nightshade
3.1 샤드 체인에서 샤드 청크로 샤드체인과 비콘체인을 이용한 샤딩 모델은 매우 강력하지만 특정 복잡성이 있습니다. 특히 포크 선택 규칙을 실행해야 합니다. 각 체인에서 별도로 샤드 체인과 비콘의 포크 선택 규칙 체인은 다르게 구축하고 별도로 테스트해야 합니다. Nightshade에서 우리는 시스템을 단일 blockchain로 모델링합니다. 블록은 논리적으로 모든 샤드에 대한 모든 트랜잭션을 포함하고 모든 샤드의 전체 상태. 그러나 물리적으로 참가자 중 누구도 다운로드하지 않습니다. 전체 상태 또는 전체 논리 블록. 대신, 네트워크의 각 참가자는 트랜잭션을 검증하는 샤드에 해당하는 상태를 유지하며, 블록의 모든 트랜잭션 목록은 물리적으로 분할됩니다. 청크, 샤드당 하나의 청크. 이상적인 조건에서 각 블록은 샤드당 정확히 하나의 청크를 포함합니다. 이는 샤드 체인이 있는 모델과 대략적으로 일치합니다. 샤드 체인은 비콘 체인과 동일한 속도로 블록을 생성합니다. 그러나, 네트워크 지연으로 인해 일부 청크가 누락될 수 있으므로 실제로는 각 블록이 샤드당 1개 또는 0개의 청크를 포함합니다. 방법에 대한 자세한 내용은 섹션 3.3을 참조하세요. 블록이 생산됩니다. 그림 16: 왼쪽에 샤드 체인이 있고 하나의 체인에 샤드 체인이 있는 모델 블록은 오른쪽의 덩어리로 분할됩니다.
3.2 합의 오늘날 blockchains의 합의에 대한 두 가지 지배적인 접근 방식은 가장 긴(또는 가장 무거운) 체인, 가장 많은 작업이나 스테이크가 있는 체인 이를 구축하는 데 사용된 것은 정식으로 간주되며 BFT, 각 블록에 대해 validator 세트는 BFT 합의에 도달합니다. 최근 제안된 프로토콜에서는 후자가 더 지배적인 접근 방식입니다. 즉각적인 최종성을 제공하는 반면 가장 긴 체인에서는 더 많은 블록이 필요하기 때문입니다. 최종성을 보장하기 위해 블록 위에 구축됩니다. 종종 의미 있는 일을 위해 보안상 충분한 수의 블록을 구축하는 데 걸리는 시간은 시간 순서. 각 블록에서 BFT 합의를 사용하면 다음과 같은 단점도 있습니다. 1. BFT 합의에는 상당한 양의 의사소통이 필요합니다. 동안 최근의 발전으로 선형적인 시간 내에 합의에 도달할 수 있게 되었습니다. 참가자 수(예: [4] 참조)에서는 여전히 블록당 오버헤드가 눈에 띕니다. 2. 모든 네트워크 참여자가 BFT에 참여하는 것은 불가능합니다. 블록당 합의에 도달하므로 일반적으로 무작위로 샘플링된 참가자 하위 집합만 합의에 도달합니다. 무작위로 추출된 세트는 원칙적으로 다음과 같습니다. 적응적으로 손상되고 이론적으로는 포크가 생성될 수 있습니다. 시스템 그러한 이벤트에 대비하려면 모델링이 필요하므로 여전히 BFT 합의 외에 포크 선택 규칙이 있거나 폐쇄되도록 설계되었습니다. 이런 경우에는 다운됩니다. 다음과 같은 일부 디자인을 언급할 가치가 있습니다. Algorand [5], 적응형 손상 가능성을 크게 줄입니다. 3. 가장 중요한 것은 다음과 같은 경우 시스템이 정지된다는 것입니다. 전체 참가자 중 3명 이상이 오프라인. 따라서 일시적인 네트워크 결함이나 네트워크 분할로 인해 시스템이 완전히 정지될 수 있습니다. 이상적으로 시스템은 계속해서 작동할 수 있어야 합니다. 참가자 중 최소 절반이 온라인 상태인 한(가장 무거운 체인 기반 프로토콜은 참가자의 절반 미만이 온라인 상태인 경우에도 계속 작동하지만 이 속성의 바람직성은 더 논쟁의 여지가 있습니다. 커뮤니티 내에서). 사용된 합의가 일종의 가장 무거운 하이브리드 모델 체인이지만 일부 블록은 BFT 최종성 가젯을 사용하여 주기적으로 마무리되며 두 모델의 장점을 모두 유지합니다. 이러한 BFT 최종 가젯은 Casper FFG [6]는 Ethereum 2.0 8, Casper CBC에서 사용됩니다(https://vitalik. 참조). ca/general/2018/12/05/cbc_casper.html) 및 GRANDPA(https:// Medium.com/polkadot-network/d08a24a021b5) Polkadot에서 사용됩니다. Nightshade는 가장 무거운 체인 합의를 사용합니다. 특히 블록일 때 생산자는 블록을 생성하고(섹션 3.3 참조) 다음에서 서명을 수집할 수 있습니다. 다른 블록 생산자와 이전 블록을 증명하는 validators. 섹션을 참조하세요 이렇게 많은 수의 서명이 어떻게 집계되는지 자세히 알아보려면 3.8을 참조하세요. 무게 8Casper에 대한 심층적인 개요는 Justin Drake와의 화이트보드 세션도 참조하세요. FFG 및 이것이 GHOST의 가장 무거운 체인 합의와 통합되는 방법은 다음과 같습니다: https://www. youtube.com/watch?v=S262StTwkmo블록의 서명은 다음과 같은 서명을 가진 모든 서명자의 누적 지분입니다. 블록에 포함됩니다. 체인의 무게는 블록 무게의 합입니다. 가장 무거운 체인 합의 위에 우리는 다음을 사용하는 최종 장치를 사용합니다. 블록을 마무리하기 위한 증명입니다. 시스템의 복잡성을 줄이기 위해, 우리는 포크 선택 규칙에 어떤 식으로든 영향을 주지 않는 최종 장치를 사용합니다. 대신 추가 슬래싱 조건만 도입합니다. 최종 가젯으로 마무리된 경우 매우 큰 비율이 아니면 포크는 불가능합니다. 전체 지분 중 삭감됩니다. Casper CBC는 그러한 최종 장치이며 우리는 현재 Casper CBC를 염두에 두고 모델을 만들고 있습니다. 우리는 또한 TxFlow라는 별도의 BFT 프로토콜을 개발하고 있습니다. 당시 이 문서를 작성하면 Casper 대신 TxFlow가 사용될지 확실하지 않습니다. CBC. 그러나 우리는 최종 가젯의 선택이 나머지 설계와 대체로 직교한다는 점에 주목합니다. 3.3 블록 생산 Nightshade에는 블록 생산자와 validator라는 두 가지 역할이 있습니다. 언제든지 시스템에 w개의 블록 생산자가 포함되어 있고, 우리 모델에서는 w = 100이며, wv validators, 우리 모델에서는 v = 100, wv = 10, 000입니다. 시스템은 지분 증명입니다. 이는 블록 생산자와 validator 모두 내부에 일정 수의 내부 정보가 있음을 의미합니다. 통화("tokens"라고 함)는 해당 통화를 훨씬 초과하는 기간 동안 잠겨 있습니다. 체인을 구축하고 검증하는 임무를 수행하는 데 소요되는 시간입니다. 모든 지분 증명 시스템과 마찬가지로, 모든 w 블록 생산자가 아니라 모든 wv validator은 시행할 수 없기 때문에 다른 엔터티입니다. 각각 그러나 w 블록 생산자와 wv validators는 별도의 스테이크. 시스템에는 n개의 샤드가 포함되어 있으며 모델에서는 n = 1000입니다. 에서 언급했듯이 섹션 3.1, Nightshade에는 샤드 체인이 없습니다. 대신 모든 블록 생산자와 validator가 단일 blockchain를 구축하고 있습니다. 메인 체인. 메인체인의 상태는 n개의 샤드로 분할되며, 각 블록은 producer 및 validator은 언제든지 로컬에 하위 집합만 다운로드했습니다. 샤드의 일부 하위 집합에 해당하는 상태이며, 처리 및 주의 해당 부분에 영향을 미치는 거래를 검증합니다. 블록 생산자가 되기 위해 네트워크 참가자는 일부 대규모 잠금을 설정합니다. tokens(스테이크)의 양. 네트워크의 유지 관리는 시대별로 이루어집니다. 여기서 에포크는 일 단위의 기간입니다. 참가자 특정 시대가 시작될 때 가장 큰 지분을 가진 블록은 다음과 같습니다. 그 시대의 생산자. 각 블록 생산자는 sw 샤드에 할당됩니다(예: sw = 40, 즉 샤드당 sww/n = 4명의 블록 생산자가 됩니다. 블록 생산자는 에포크 이전에 할당된 샤드의 상태를 다운로드합니다. 시작되고 에포크 전반에 걸쳐 해당 샤드에 영향을 미치는 트랜잭션을 수집합니다. 그리고 이를 국가에 적용합니다. 메인 체인의 각 블록 b와 모든 샤드 s에 대해 다음 중 하나가 있습니다. b 관련 부분을 생산할 책임이 있는 블록 생산자를 s에게 할당했습니다. 샤드에. 샤드 s와 관련된 b 부분을 청크라고 하며 다음을 포함합니다. b에 포함될 샤드에 대한 트랜잭션 목록과 머클결과 상태의 루트. b는 궁극적으로 매우 작은 헤더만 포함하게 됩니다. 청크, 즉 적용된 모든 트랜잭션의 머클 루트(섹션 참조) 정확한 세부 사항은 3.7.1 참조) 및 최종 상태의 머클 루트입니다. 문서의 나머지 부분에서 우리는 종종 블록 생산자를 언급합니다. 특정 샤드에 대해 특정 시간에 청크를 생성하는 역할을 담당합니다. 청크 프로듀서로서. 청크 생산자는 항상 블록 생산자 중 하나입니다. 블록 생산자와 청크 생산자는 각 블록을 다음과 같이 회전합니다. 정해진 일정으로. 블록 생산자는 주문을 받고 반복적으로 생산을 합니다. 그 순서대로 블록을 쌓으세요. 예: 블록 생산자가 100명이면 첫 번째 블록은 생산자는 블록 1, 101, 201 등을 생산할 책임이 있으며, 두 번째는 2, 102, 202 등 생산 담당). 청크 생산은 블록 생산과 달리 유지 관리가 필요하므로 상태를 유지하며, 각 샤드에 대해 sww/n 블록 생산자만이 상태를 유지합니다. 샤드별로 해당 sww/n 블록 생산자만 순환하여 생성합니다. 덩어리. 예: 위의 상수와 4명의 블록 생산자가 할당되어 있습니다. 각 샤드, 각 블록 생산자는 4개의 블록마다 한 번씩 청크를 생성합니다. 3.4 데이터 가용성 보장 데이터 가용성을 보장하기 위해 우리는 Polkadot과 유사한 접근 방식을 사용합니다. 섹션 2.5.3에 설명되어 있습니다. 블록 생산자가 청크를 생성하면 다음을 생성합니다. 최적의 (w, ⌊w/6 + 1⌋) 블록 코드를 사용하여 삭제 코딩된 버전 덩어리. 그런 다음 삭제 코딩된 청크의 한 조각을 보냅니다(우리는 이러한 조각을 호출합니다). 청크 부분 또는 부분)을 각 블록 생산자에게 전달합니다. 우리는 나뭇잎과 같은 모든 부분을 포함하는 머클 트리를 계산합니다. 각 청크의 헤더에는 해당 트리의 머클 루트가 포함됩니다. 부품은 onepart 메시지를 통해 validators로 전송됩니다. 그런 메시지 하나하나 청크 헤더, 부분의 서수 및 부분 내용을 포함합니다. 는 메시지에는 해당 블록을 생성한 블록 생산자의 서명도 포함되어 있습니다. 해당 부분이 헤더에 해당함을 증명하기 위한 청크와 머클 경로 그리고 적절한 블록 생산자에 의해 생산됩니다. 블록 생산자가 메인 체인 블록을 받으면 먼저 블록 생성 여부를 확인합니다. 블록에 포함된 각 청크에 대해 하나의 메시지를 가집니다. 그렇지 않으면 블록 누락된 onepart 메시지가 검색될 때까지 처리되지 않습니다. 모든 onepart 메시지가 수신되면 블록 생산자는 피어로부터 남은 부분을 가져와 그들이 보유하고 있는 청크를 재구성합니다. 상태. 블록 생산자는 메인 체인 블록을 처리하지 않습니다. 블록에 포함된 청크에는 해당 onepart 메시지가 없거나 상태를 유지하는 하나 이상의 샤드에 대해 사용할 수 없는 경우 전체 청크를 재구성합니다. 특정 청크를 사용하려면 블록의 ⌊w/6⌋+1이면 충분합니다. 생산자는 자신의 역할을 갖고 이를 제공합니다. 따라서, 그 수만큼은 악의적인 행위자는 블록이 절반 이상인 체인이 없는 ⌊w/3⌋을 초과하지 않습니다. 그것을 만드는 생산자는 사용할 수 없는 청크를 가질 수 있습니다.그림 17: 각 블록에는 샤드당 1개 또는 0개의 청크가 포함되어 있으며, 각 청크는 삭제 코딩되어 있습니다. 삭제 코딩된 청크의 각 부분은 지정된 위치로 전송됩니다. 특별한 onepart 메시지를 통한 블록 생산자 3.4.1 게으른 블록 생산자 다루기 블록 생산자가 한 부분 메시지가 누락된 블록을 가지고 있는 경우, 블록이 체인에 연결되면 계속 서명하기로 선택할 수 있습니다. 블록 생산자에 대한 보상을 극대화할 것입니다. 블록에 대한 위험이 없습니다 왜냐하면 블록 프로듀서가 블록 프로듀서를 갖고 있지 않았다는 것을 나중에 증명하는 것이 불가능하기 때문입니다. 한 부분 메시지. 이 문제를 해결하기 위해 청크를 생성할 때 각 청크 생산자를 만듭니다. 향후 인코딩된 청크의 각 부분에 대해 색상(빨간색 또는 파란색)을 선택하고 저장합니다. 인코딩되기 전 청크에 할당된 색상의 비트마스크입니다. 각 부분 메시지에는 부품에 할당된 색상이 포함되며, 색상은 다음과 같은 경우에 사용됩니다. 인코딩된 부분의 머클 루트를 계산합니다. 청크 생산자가 이탈하는 경우 머클 루트는 그렇지 않기 때문에 프로토콜에서 쉽게 증명할 수 있습니다. onepart 메시지에 해당하거나, onepart 메시지의 색상에 해당합니다. 머클 루트에 해당하는 것은 청크의 마스크와 일치하지 않습니다. 블록 생산자가 블록에 서명하면 모든 블록의 비트마스크가 포함됩니다. 블록에 포함된 청크에 대해 받은 빨간색 부분입니다. 게시 잘못된 비트마스크는 슬래시 가능한 동작입니다. 블록 생산자가 메시지를 받지 못한 경우 메시지를 한 부분으로만 읽어도 메시지의 색상을 알 수 없습니다. 따라서 맹목적으로 서명을 시도하면 베임을 당할 확률이 50%입니다. 블록. 3.5 상태 전이 신청 청크 생산자는 청크에 포함할 트랜잭션만 선택하지만 청크를 생성할 때 상태 전환을 적용하지 마십시오. 이에 따라,
청크 헤더에는 이전의 머켈화된 상태의 머클 루트가 포함되어 있습니다. 청크의 트랜잭션이 적용됩니다. 트랜잭션은 청크를 포함하는 전체 블록에만 적용됩니다. 처리됩니다. 참가자는 다음의 경우에만 블록을 처리합니다. 1. 이전 블록이 수신되어 처리되었습니다. 2. 각 청크에 대해 참가자는 자신이 가지고 있는 상태를 유지하지 않습니다. onepart 메시지를 보았습니다. 3. 각 청크에 대해 참가자는 상태를 유지합니다. 전체 덩어리. 블록이 처리되면 참가자가 사용하는 각 샤드에 대해 상태를 유지하고 트랜잭션을 적용하고 새로운 상태를 계산합니다. 거래가 적용된 후부터 생산 준비가 완료됩니다. 다음 블록의 청크(샤드에 할당된 경우) 새로운 머켈화된 상태의 머클 루트. 3.6 교차 샤드 거래 및 영수증 트랜잭션이 둘 이상의 샤드에 영향을 미쳐야 하는 경우 연속적으로 수행되어야 합니다. 각 샤드에서 개별적으로 실행됩니다. 전체 트랜잭션이 첫 번째 샤드로 전송됩니다. 영향을 받고 트랜잭션이 해당 샤드의 청크에 포함되면 청크가 블록에 포함된 후 적용되면 소위 영수증이 생성됩니다. 트랜잭션이 필요한 다음 샤드로 라우팅됩니다. 처형되다. 추가 단계가 필요한 경우 영수증 거래 실행 새로운 영수증 거래 등을 생성합니다. 3.6.1 영수증 거래 수명 영수증 거래는 해당 거래가 발생한 블록 바로 다음 블록에 적용하는 것이 바람직하다. 영수증 거래는 블록 생산자가 이전 블록을 수신하고 적용한 후에 생성됨 원래 샤드를 유지하고 샤드가 생성될 때까지 알려져야 합니다. 다음 블록의 청크는 대상의 블록 생산자가 생성합니다. 파편. 따라서 영수증은 소스 샤드에서 샤드에 전달되어야 합니다. 두 이벤트 사이의 짧은 시간 내에 대상 샤드를 생성합니다. A를 영수증 r을 생성하는 트랜잭션 t를 포함하는 마지막으로 생성된 블록이라고 가정합니다. B를 다음으로 생성된 블록(즉, A를 갖는 블록)이라고 가정합니다. 이전 블록)에 r을 포함하려고 합니다. t가 샤드 a와 r에 있도록 하세요. 샤드에서 b. 그림 18에도 표시된 영수증의 수명은 다음과 같습니다. 영수증을 생성하고 보관합니다. 샤드의 청크 생산자 CPA a는 블록 A를 수신하고, 트랜잭션 t를 적용하고 영수증 r을 생성합니다. CPA 그런 다음 생성된 모든 영수증을 색인이 생성된 내부 영구 저장소에 저장합니다. 소스 샤드 ID로영수증을 배포합니다. CPA가 청크를 생성할 준비가 되면 블록 B에 대한 샤드 a, 샤드 a에 대한 블록 A의 트랜잭션을 적용하여 생성된 모든 영수증을 가져와 shrad에 대한 청크에 포함했습니다. 블록 B의 a. 해당 청크가 생성되면 cpa는 삭제 코딩된 삭제 코드를 생성합니다. 버전 및 해당하는 모든 onepart 메시지. cpa는 어떤 블록 생산자가 샤드의 전체 상태를 유지하는지 알고 있습니다. 특정 블록 생산자의 경우 bp cpa에는 블록 A의 거래를 적용하여 발생한 영수증이 포함됩니다. bp가 대상으로 관심을 갖는 샤드 중 하나를 포함하는 샤드 a의 경우 블록 B의 샤드 A에 대한 청크를 배포할 때 onepart 메시지에서 (onepart 메시지에 포함된 영수증을 보여주는 그림 17 참조) 영수증을 받고 있습니다. 참가자(블록 생산자와 validator 모두)는 단일 메시지를 받을 때까지 블록을 처리하지 않는다는 점을 기억하십시오. 블록에 포함된 각 청크에 대해. 따라서 특정 참가자가 블록 B를 적용할 때쯤에는 블록 B에 해당하는 모든 단일 부분 메시지를 갖게 됩니다. B에 청크가 있으므로 샤드가 있는 모든 수신 영수증을 갖게 됩니다. 참가자는 목적지로 상태를 유지합니다. 신청할 때 특정 샤드에 대한 상태 전환, 참가자는 두 가지 영수증을 모두 적용합니다. 그들은 onepart 메시지의 샤드를 위해 수집한 것뿐만 아니라 모든 청크 자체에 포함된 트랜잭션입니다. 그림 18: 영수증 거래의 수명 3.6.2 너무 많은 영수증 처리 특정 샤드를 대상으로 하는 영수증의 수가 특정 블록이 너무 커서 처리할 수 없습니다. 예를 들어 그림 19를 살펴보겠습니다. 각 샤드의 각 거래는 샤드 1을 대상으로 하는 영수증을 생성합니다. 다음 블록까지 샤드 1이 처리해야 하는 영수증 수는 다음과 같습니다. 처리하는 동안 모든 샤드가 결합되어 처리하는 부하와 비슷합니다. 이전 블록.
그림 19: 모든 영수증이 동일한 샤드를 대상으로 하는 경우 샤드는 그것을 처리할 수 있는 능력 이를 해결하기 위해 우리는 QuarkChain 9에서 사용된 것과 유사한 기술을 사용합니다. 구체적으로, 각 샤드에 대해 마지막 블록 B와 해당 샤드 내의 마지막 샤드 영수증이 적용된 블록이 기록됩니다. 새로운 샤드가 생성되면 생성되면 B에 남아있는 샤드부터 순서대로 영수증이 적용되며, 그런 다음 새 청크가 가득 찰 때까지 B를 따르는 블록에서. 정상 이하 부하가 균형 잡힌 상황에서는 일반적으로 모든 영수증이 발생합니다. 적용됩니다(따라서 마지막 블록의 마지막 샤드가 기록됩니다). 각 청크), 하지만 로드가 균형을 이루지 못하는 경우, 그리고 특정 샤드는 불균형적으로 많은 영수증을 받습니다. 이 기술을 사용하면 샤드는 다음과 같은 일을 할 수 있습니다. 포함된 거래 수 제한을 준수하면서 처리됩니다. 이러한 불균형 부하가 오랫동안 지속되면 지연이 발생합니다. 영수증 생성 전까지 신청은 무한정 늘어날 수 있습니다. 하나 이 문제를 해결하는 방법은 다음을 대상으로 하는 영수증을 생성하는 모든 거래를 삭제하는 것입니다. 일부 상수(예: 1 에포크)를 초과하는 처리 지연이 있는 샤드. 그림 20을 살펴보세요. 블록 B에서는 샤드 4가 모든 영수증을 처리할 수 없습니다. 따라서 블록 A의 최대 샤드 3에서 발생한 영수증만 처리합니다. 그것을 기록합니다. 블록 C에는 블록 B의 샤드 5까지의 영수증이 포함됩니다. 그런 다음 블록 D에서 샤드가 따라잡아 나머지 영수증을 모두 처리합니다. 블록 B와 블록 C의 모든 영수증. 3.7 청크 검증 특정 샤드에 대해 생성된 청크(또는 샤드 체인이 있는 모델에서 특정 샤드 체인에 대해 생성된 샤드 블록)는 오직 9여기에서 QuarkChain의 화이트보드 에피소드를 확인하세요: https://www.youtube.com/watch? v=opEtG6NM4x4, 여기에서는 교차 샤드 트랜잭션에 대한 접근 방식이 논의됩니다. 것들그림 20: 지연된 영수증 처리 상태를 유지하는 참가자. 그들은 블록 생산자가 될 수 있습니다, validators, 또는 상태를 다운로드하고 샤드를 검증한 외부 증인일 수도 있습니다. 자산을 저장하는 곳입니다. 이 문서에서는 대부분의 참가자가 저장할 수 없다고 가정합니다. 샤드의 상당 부분에 대한 상태입니다. 언급할 가치는 있지만, 다음과 같은 가정으로 설계된 샤딩된 blockchain이 있습니다. 대부분의 참가자는 대부분의 상태를 저장하고 검증할 수 있는 능력을 가지고 있습니다. QuarkChain과 같은 샤드. 참가자 중 극히 일부만이 샤드를 검증할 수 있는 상태를 갖고 있기 때문에 청크를 갖고 있는 참가자만 적응적으로 손상시킬 수 있습니다. 상태를 확인하고 잘못된 상태 전환을 적용합니다. 몇 번씩 validator을 샘플링하는 다중 샤딩 설계가 제안되었습니다. 일, 그리고 하루 이내에 2/3 이상인 샤드 체인의 모든 블록 해당 샤드에 할당된 validator의 서명이 즉시 고려됩니다. 최종. 이러한 접근 방식을 사용하면 적응력이 뛰어난 공격자는 2n/3+1만 부패시키면 됩니다. 샤드 체인의 validator 중 잘못된 상태 전환을 적용합니다. 해내기 어려울 가능성이 높지만 대중에게 충분한 보안 수준은 아닙니다. blockchain. 섹션 2.3에서 설명한 것처럼 일반적인 접근 방식은 상태가 있는 모든 참가자에 대해 블록이 생성된 후 특정 시간을 허용하는 것입니다. 그 타당성에 도전하는 것은 블록 생산자, validator 또는 외부 관찰자입니다. 이러한 참가자를 어부(Fishermen)라고 합니다. 낚시꾼이 할 수 있는 일 유효하지 않은 블록에 대해 이의를 제기하려면 해당 블록을 사용할 수 있는지 확인해야 합니다. 그들. Nightshade의 데이터 가용성은 섹션 3.4에서 논의됩니다. Nightshade에서는 블록이 생성되면 해당 청크가 검증되지 않습니다. 실제 청크 생산자가 아닌 사람. 특히, 블록 프로듀서는 블록이 당연히 대부분의 샤드에 대한 상태를 갖고 있지 않다고 제안했습니다.청크의 유효성을 검사할 수 없습니다. 다음 블록이 생성되면 여러 블록 생산자와 validator의 증명(섹션 3.2 참조)이 포함됩니다. 하지만 대부분의 블록 생산자와 validator은 상태를 유지하지 않기 때문에 대부분의 샤드에서도 유효하지 않은 청크가 하나만 있는 블록은 증명의 절반 이상을 수집하고 계속해서 가장 무거운 상태를 유지하게 됩니다. 체인. 이 문제를 해결하기 위해 우리는 다음 상태를 유지하는 모든 참가자를 허용합니다. 생성된 유효하지 않은 청크에 대해 온체인으로 챌린지를 제출하는 샤드 파편. 3.7.1 상태 타당성 문제 참가자가 특정 청크가 유효하지 않음을 감지하면 해당 청크가 유효하지 않다는 증거를 제공해야 합니다. 대부분의 네트워크 참여자는 유효하지 않은 청크가 존재하는 샤드에 대한 상태를 유지하지 않기 때문에 생성되면 증거에는 블록이 다음과 같은지 확인하는 데 충분한 정보가 있어야 합니다. 상태가 없으면 유효하지 않습니다. 우리는 단일 트랜잭션이 처리하는 상태량(바이트)의 한계 Ls를 설정합니다. 누적적으로 읽거나 쓸 수 있습니다. Ls 이상에 영향을 미치는 모든 거래 상태는 유효하지 않은 것으로 간주됩니다. 섹션 3.5에서 청크가 특정 블록 B에는 적용할 트랜잭션만 포함되어 있지만 새로운 상태 루트. 블록 B의 청크에 포함된 상태 루트가 상태입니다. 그러한 트랜잭션을 적용하기 전에는 루트이지만 다음에서 트랜잭션을 적용한 후에는 블록 이전의 동일한 샤드의 마지막 청크 B. 악의적인 행위자 잘못된 상태 전환을 적용하려고 하면 잘못된 상태 루트가 포함됩니다. 적용 결과로 발생한 상태 루트에 해당하지 않는 블록 B에서 이전 청크의 트랜잭션. 청크 생산자가 청크에 포함하는 정보를 확장합니다. 모든 트랜잭션을 적용한 후 상태를 포함하는 대신 각 연속 트랜잭션 집합을 적용한 후 상태 루트를 포함합니다. 상태의 Ls 바이트를 집합적으로 읽고 씁니다. 이 정보를 통해 상태 전환이 잘못 적용되는 문제를 만드는 어부 첫 번째 유효하지 않은 상태 루트를 찾고 Ls 바이트만 포함하면 충분합니다. 마지막 상태 루트(이는 유효한) 및 머클 증명이 포함된 현재 상태 루트입니다. 그러면 어떤 참가자라도 세그먼트의 트랜잭션을 검증하고 청크가 다음과 같은지 확인할 수 있습니다. 유효하지 않습니다. 마찬가지로, 청크 생산자가 다음을 읽는 트랜잭션을 포함하려고 시도한 경우 Ls 바이트 이상의 상태를 작성합니다. 이 문제의 경우 다음을 포함하는 것으로 충분합니다. 머클 증명과 접촉하는 첫 번째 L 바이트는 다음과 같이 충분합니다. 트랜잭션을 적용하고 시도가 있는 순간이 있는지 확인합니다. Ls 바이트를 초과하는 콘텐츠를 읽거나 씁니다.
3.7.2 어부와 빠른 샤드 간 거래 섹션 2.3에서 설명한 것처럼 샤드 청크(또는 샤드)가 샤드 체인이 있는 모델의 블록)은 유효하지 않으며 문제가 발생할 수 있습니다. 기간 동안 이는 최종성에 부정적인 영향을 미쳐 샤드 간 통신에 부정적인 영향을 미칩니다. 에서 특히, 샤드 간 거래의 대상 샤드는 확실할 수 없습니다. 원래 샤드 청크 또는 블록은 챌린지 기간이 끝날 때까지 최종입니다. (그림 21 참조) 그림 21: 영수증을 적용하기 전에 챌린지 기간을 기다리는 중 교차 샤드 트랜잭션을 수행하는 방식으로 이를 해결하는 방법 Instantenious는 대상 샤드가 챌린지 기간을 기다리지 않는 것입니다. 소스 샤드 트랜잭션이 게시된 후 영수증 트랜잭션을 적용합니다. 즉시, 그러나 소스와 함께 대상 샤드를 롤백합니다. 나중에 원래 청크나 블록이 유효하지 않은 것으로 밝혀지면 샤딩합니다(그림 참조). 22). 이는 샤드가 사용되는 Nightshade 디자인에 매우 자연스럽게 적용됩니다. 체인은 독립적이지 않지만 대신 샤드 청크가 모두 게시됩니다. 동일한 메인 체인 블록에 함께 있습니다. 유효하지 않은 청크가 발견되면 해당 청크가 포함된 전체 블록은 유효하지 않은 것으로 간주되며, 그 위에 구축된 모든 블록은 그것의 꼭대기. 그림 23을 참조하십시오. 위의 두 접근 방식 모두 챌린지가 다음과 같다고 가정하여 원자성을 제공합니다. 기간은 충분히 길다. 정상적인 상황에서 빠른 크로스샤드 트랜잭션을 제공하는 것이 불편함을 능가하기 때문에 우리는 후자의 접근 방식을 사용합니다. 다음 중 하나의 잘못된 상태 전환으로 인해 대상 샤드 롤백 이는 극히 드문 이벤트입니다. 3.7.3 validator 숨기기 문제가 존재하면 이미 다음과 같은 가능성이 크게 감소합니다. 잘못된 상태 전환 포스트로 청크를 마무리하기 때문에 적응형 손상그림 22: 영수증 즉시 적용 및 대상 롤백 소스 체인에 유효하지 않은 블록이 있는 경우 체인 그림 23: Nightshade의 어부 도전 적응형 적이 모든 참가자를 부패시키는 데 필요한 도전 기간 모든 validator을 포함하여 샤드의 상태를 유지합니다. 그러한 사건의 가능성을 추정하는 것은 매우 복잡합니다. 샤딩된 blockchain은 그러한 공격이 시도될 만큼 오랫동안 활성화되었습니다. 우리는 확률이 극히 낮지만 여전히 충분하다고 주장합니다. 수백만 건의 트랜잭션을 실행할 것으로 예상되는 시스템에 비해 규모가 크고 세계적인 금융 운영을 운영합니다. 이러한 믿음에는 두 가지 주요 이유가 있습니다. 1. 대부분의 지분 증명 체인과 채굴자의 validator
작업 증명 체인은 주로 재정적 측면에서 인센티브를 받습니다. 만약에 적응형 적군은 예상 수익보다 더 많은 돈을 제공합니다. 정직하게 운영하면 많은 validator이 발생할 것으로 예상하는 것이 합리적입니다. 그 제안을 받아들일 것이다. 2. 많은 기업이 지분 증명 체인을 전문적으로 검증합니다. 어떤 체인에서든 지분의 상당 부분이 그러한 단체로부터. 그러한 개체의 수는 한 기업에 비해 충분히 적습니다. 적응력이 뛰어난 적은 그들 대부분을 개인적으로 알아가고 그들의 부패 성향을 잘 이해하고 있습니다. 우리는 어떤 validator이 어떤 샤드에 할당되어 있는지 숨김으로써 적응형 손상 가능성을 줄이는 데 한 단계 더 나아갔습니다. 아이디어는 Algorand [5]이 validator을 숨기는 방식과 원격으로 유사합니다. Algorand에서와 같이 validator이 숨겨져 있더라도 주의하는 것이 중요합니다. 또는 아래 설명된 것처럼 적응형 손상은 이론상으로는 여전히 가능합니다. 동안 적응형 적수는 생성하거나 검증할 참가자를 알지 못합니다. 블록이나 덩어리, 참가자 스스로는 자신이 수행할 것임을 알고 있습니다. 그러한 작업을 수행하고 이에 대한 암호화 증거를 가지고 있습니다. 따라서 상대방은 다음과 같이 할 수 있다. 부패하려는 의도를 알리고 이를 제공할 참가자에게 비용을 지불합니다. 그러한 암호화 증명. 그러나 우리는 적이 그렇지 않기 때문에 손상시키려는 샤드에 할당된 validator을 알고 있으면 특정 샤드를 손상시키려는 의도를 다른 사람에게 알리는 것 외에는 다른 선택이 없습니다. 전체 커뮤니티. 그 시점에서는 정직한 사람이라면 누구에게나 경제적으로 이익이 됩니다. 참가자는 샤드를 검증하는 전체 노드를 가동합니다. 해당 샤드에 유효하지 않은 블록이 나타날 가능성이 있습니다. 챌린지를 만들고 관련 보상을 받으세요. 특정 샤드에 할당된 validator을 공개하지 않기 위해 우리는 다음(그림 24 참조): VRF를 사용하여 과제를 얻습니다. 각 시대가 시작될 때마다 validator은 VRF를 사용하여 validator이 할당된 샤드의 비트마스크를 가져옵니다. 각 validator의 비트마스크에는 Sw 비트가 있습니다(정의는 섹션 3.3 참조). SW의). 그런 다음 validator는 해당 샤드의 상태를 가져오고 수신된 각 블록에 대해 해당 에포크 동안 해당 청크의 유효성을 검사합니다. validator이 할당된 샤드에. 청크 대신 블록에 서명하세요. 샤드 할당이 숨겨져 있으므로 validator은 청크에 서명할 수 없습니다. 대신 항상 전체에 서명합니다. 따라서 어떤 샤드가 검증되었는지 공개하지 않습니다. 특히 validator이 블록을 수신하고 모든 청크를 검증할 때 메시지를 생성하거나 이는 validator이 할당된 모든 샤드의 모든 청크가 유효함(해당 샤드가 무엇인지 어떤 방식으로든 표시하지 않음) 또는 다음과 같은 메시지 청크가 유효하지 않은 경우 유효하지 않은 상태 전환에 대한 증거가 포함됩니다. 참조 이러한 메시지가 어떻게 집계되는지에 대한 자세한 내용은 섹션 3.8을, 섹션 3.7.4를 참조하세요. validators가 메시지에 편승하는 것을 방지하는 방법에 대한 세부정보 보상 및 처벌 방법에 대한 자세한 내용은 기타 validator 및 섹션 3.7.5를 참조하세요. validators는 잘못된 상태 전환 문제가 실제로 발생해야 성공한다는 것입니다.그림 24: Nightshade에 validator을 숨기기 3.7.4 커밋-공개 validators의 일반적인 문제 중 하나는 validator이 상태 다운로드와 실제로 청크 및 블록 유효성 검사를 건너뛸 수 있다는 것입니다. 네트워크를 관찰하고 다른 validator이 제출한 내용을 확인하고 반복하세요. 메시지. 이러한 전략을 따르는 validator은 추가 기능을 제공하지 않습니다. 네트워크 보안을 강화하지만 보상을 수집합니다. 이 문제에 대한 일반적인 해결책은 각 validator이 증거를 제공하는 것입니다. 예를 들어 고유한 추적을 제공하여 실제로 블록의 유효성을 검사했습니다. 상태 전이를 적용하는 방법이 있지만 그러한 증명은 비용을 상당히 증가시킵니다. 검증의. 그림 25: 커밋-공개
대신 우리는 검증 결과에 대해 validators의 첫 번째 커밋을 만듭니다(둘 중 하나). 청크의 유효성을 증명하는 메시지 또는 유효하지 않은 청크의 증거 상태 전환), 일정 기간 동안 기다렸다가 그림 25와 같이 실제 검증 결과를 공개합니다. 커밋 기간은 상태 전환과 교차하지 않습니다. 공개 기간이므로 게으른 validator은 정직한 validator을 흉내낼 수 없습니다. 더욱이, 부정직한 validator이 다음을 증명하는 메시지를 약속한 경우 할당된 청크의 유효성을 확인하고 적어도 하나의 청크가 유효하지 않은 경우 청크가 유효하지 않은 것으로 나타났습니다. validator은 슬래싱을 피할 수 없습니다. 섹션 3.7.5에서 볼 수 있듯이 이러한 상황에서 슬래시를 당하지 않는 유일한 방법은 잘못된 상태 전환에 대한 증거가 포함된 메시지를 제시하는 것입니다. 커밋과 일치합니다. 3.7.5 문제 처리 위에서 설명한 대로 validator이 유효하지 않은 청크가 있는 블록을 수신하면, 먼저 유효하지 않은 상태 전환에 대한 증거를 준비한 다음(섹션 3.7.1 참조) 그러한 증명을 수행하고(3.7.4 참조) 일정 기간이 지나면 도전 과제를 공개합니다. 공개된 챌린지가 블록에 포함되면 다음과 같은 일이 발생합니다. 1. 해당 블록을 포함하는 블록에서 발생한 모든 상태 전환 공개된 챌린지가 포함된 블록까지 유효하지 않은 청크를 얻습니다. 무효화되었습니다. 공개된 챌린지를 포함하는 블록 이전의 상태 포함된 블록 이전의 상태와 동일한 것으로 간주됩니다. 유효하지 않은 청크. 2. 특정 기간 내에 각 validator은 자신의 비트마스크를 공개해야 합니다. 그들이 검증한 샤드 중. 비트마스크는 VRF를 통해 생성되므로, 상태 전환이 잘못된 샤드에 할당되었습니다. 공개를 피할 수 없습니다. 비트마스크를 공개하지 못하는 모든 validator 샤드에 할당된 것으로 가정됩니다. 3. 해당 기간이 지나면 샤드에 할당된 것으로 확인된 각 validator, 해당 블록에 대한 일부 검증 결과를 커밋했습니다. 유효하지 않은 청크이며 유효하지 않은 상태 전환의 증거를 공개하지 않았습니다. 커밋에 해당하는 내용은 슬래시됩니다. 4. 각 validator은 새로운 샤드 할당을 받고 새로운 시대가 예약됩니다. 모든 validator가 다운로드하기에 충분한 시간이 지난 후에 시작하려면 상태는 그림 26과 같습니다. validators가 할당된 샤드를 공개하는 순간부터 참고하세요. 새로운 시대가 시작될 때까지 시스템의 보안은 샤드 할당이 공개되었습니다. 네트워크 참여자는 이를 유지해야 합니다. 해당 기간 동안 네트워크를 사용할 때 주의하세요. 3.8 서명 집계 수백 개의 샤드가 있는 시스템이 안전하게 작동하려면 다음을 수행해야 합니다. 10,000개 이상의 validator 주문. 섹션 3.7에서 논의한 것처럼 우리는 각각을 원합니다.그림 26: 과제 처리 validator 평균적으로 특정 메시지와 서명에 대한 커밋을 게시합니다. 블록당 한 번. 커밋 메시지가 동일하더라도 BLS 서명과 이를 검증하는 것은 엄청나게 비용이 많이 들었습니다. 하지만 당연히 커밋 및 공개 메시지는 validator에서 동일하지 않습니다. 따라서 그러한 메시지와 서명을 통합할 수 있는 방법이 필요합니다. 나중에 빠르게 검증할 수 있는 방법입니다. 우리가 사용하는 구체적인 접근 방식은 다음과 같습니다. 블록 생산자에 합류하는 검증인. 블록 생산자는 알려져 있습니다. 에포크가 시작되기 얼마 전에 다운로드할 시간이 필요하기 때문입니다. 에포크가 시작되기 전의 상태이며, validator과 달리 블록 생산자는 숨겨져 있지 않습니다. 각 블록 생산자는 v validator 슬롯을 갖습니다. 검증인이 제출 블록 생산자에게 v 중 하나로 포함되도록 오프체인 제안 validators. 블록 생산자가 validator을 포함하려는 경우 validator의 초기 오프체인 요청을 포함하는 트랜잭션, 그리고 validator을 블록 생산자에 참여시키는 블록 생산자의 서명입니다. 블록 생산자에게 할당된 validator이 반드시 필요한 것은 아닙니다. 블록 생산자가 청크를 생성하는 것과 동일한 샤드를 검증합니다. 만약 validator은 여러 블록 생산자에 합류하기 위해 적용되었으며, 첫 번째 블록 생산자가 성공할 것입니다. 블록 생산자는 커밋을 수집합니다. 블록 생산자는 validator에서 지속적으로 커밋 및 공개 메시지를 수집합니다. 이러한 메시지가 일정 개수 누적되면 블록 생산자는 머클을 계산합니다. 이러한 메시지의 트리를 만들고 각 validator에 머클 루트와 그들의 메시지에 대한 머클 경로. validator는 경로의 유효성을 검사하고 로그인합니다. 머클 루트. 그런 다음 블록 생산자는 BLS 서명을 블록에 축적합니다. validators의 머클 루트이며 머클 루트와 누적된 서명. 블록 생산자는 또한 해당 블록의 유효성에 서명합니다. 저렴한 ECDSA 서명을 사용하는 다중 서명. 다중 서명이 되지 않는 경우 제출된 머클 루트 또는 참여하는 validator의 비트마스크와 일치하면 슬래시 가능한 동작입니다. 체인을 동기화할 때 참가자는 validators의 모든 BLS 서명을 검증하도록 선택할 수 있습니다(validators 공개 키 집계가 포함되므로 매우 비쌉니다).블록 생산자의 ECDMA 서명을 사용하고 다음 사실에 의존합니다. 블록 프로듀서는 도전을 받고 삭감되지 않았습니다. 온체인 트랜잭션과 머클 증명을 사용하여 문제를 해결합니다. 그것 validators의 메시지가 없으면 공개할 가치가 없다는 점을 알 수 있습니다. 잘못된 상태 전환이 감지되었습니다. 실제 내용이 포함된 메시지만 유효하지 않은 상태 전환에 대한 증거가 공개되어야 하며, 그러한 메시지에 대해서만 이전 커밋과 일치하는지 표시해야 합니다. 메시지는 다음과 같습니다. 두 가지 목적으로 공개됩니다. 1. 실제로 체인의 롤백을 시작하기 전 순간으로 잘못된 상태 전환(섹션 3.7.5 참조). 2. validator이(가) 유효성을 증명하려고 시도하지 않았음을 증명하기 위해 잘못된 청크. 두 경우 모두 다음 두 가지 문제를 해결해야 합니다. 1. 실제 커밋은 체인에 포함되지 않았고 머클 루트만 포함되었습니다. 다른 메시지와 함께 집계된 커밋입니다. validator에서는 다음을 사용해야 합니다. 블록 생산자가 제공한 머클 경로와 원래 커밋 그들이 도전에 전념했음을 증명하십시오. 2. 잘못된 샤드에 할당된 모든 validator이(가) 가능합니다. 상태 전환은 손상된 블록 생산자에게 할당됩니다. 그들을 검열하고 있습니다. 이 문제를 해결하기 위해 우리는 그들이 공개 내용을 제출하도록 허용합니다. 온체인에서 일반 트랜잭션으로 처리하고 집계를 우회합니다. 후자는 유효하지 않은 상태 전환 증명에만 허용됩니다. 극히 드물기 때문에 블록에 스팸을 보내서는 안 됩니다. 해결해야 할 마지막 문제는 블록 생산자가 다음을 수행할 수 있다는 것입니다. 메시지 집계에 참여하지 않거나 특정 validator을 의도적으로 검열하지 않도록 선택하세요. 블록을 만들어 경제적으로 불리하게 만듭니다. 생산자 보상은 할당된 validator 수에 비례합니다. 우리 또한 시대 사이의 블록 생산자는 대체로 교차하기 때문에(이후 항상 가장 높은 지분을 가진 참가자 중 최고입니다.) validators는 대부분 동일한 블록 생산자와 협력하여 위험을 줄입니다. 과거에 그들을 검열했던 블록 생산자에게 배정되는 것입니다. 3.9 스냅샷 체인 메인체인의 블록은 매우 빈번하게 생성되기 때문에 다운로드가 전체 기록은 매우 빠르게 비용이 높아질 수 있습니다. 게다가 매 순간부터 블록에는 다수의 참가자의 BLS 서명이 포함되어 있으므로 서명을 확인하기 위한 공개 키의 집합이 엄청나게 커질 수 있습니다. 비싸기도 하고. 마지막으로, 가까운 미래에는 Ethereum 1.0이 1로 남을 가능성이 높기 때문입니다. 가장 많이 사용되는 blockchain 중 자산을 전송하는 의미 있는 방법이 있습니다.
Ethereum에 가까운 것이 요구 사항이며 오늘 BLS 서명을 확인하여 Ethereum 측의 근거리 차단 유효성은 불가능합니다. Nightshade 메인 체인의 각 블록은 선택적으로 Schnorr를 포함할 수 있습니다. 그러한 Schnorr를 포함하는 마지막 블록의 헤더에 다중 서명 다중 서명. 우리는 이러한 블록을 스냅샷 블록이라고 부릅니다. 가장 첫 번째 블록은 모든 에포크는 스냅샷 블록이어야 합니다. 이런 다중서명 작업을 하면서, 블록 생산자는 validators의 BLS 서명도 축적해야 합니다. 마지막 스냅샷 블록에서 설명된 것과 동일한 방식으로 집계합니다. 섹션 3.8. 블록 생산자 세트는 시대 전반에 걸쳐 일정하므로 유효성을 검사합니다. 각 에포크의 첫 번째 스냅샷 블록만 있으면 충분합니다. 많은 비율의 블록 생산자와 validator이 공모하고 생성되었다는 점을 지적합니다. 포크. 에포크의 첫 번째 블록에는 다음을 계산하기에 충분한 정보가 포함되어야 합니다. 해당 시대의 블록 생산자와 validator. 스냅샷만 포함된 메인체인의 서브체인을 호출합니다. 스냅샷 체인을 차단합니다. Schnorr 다중 서명을 생성하는 것은 대화형 프로세스이지만, 아무리 비효율적이라도 프로세스를 가끔씩만 수행하면 됩니다. 성공할 것이다. Schnorr 다중 서명은 Ethereum에서 쉽게 검증할 수 있습니다. 따라서 blockchain 교차 수행의 안전한 방법을 위한 중요한 기본 요소를 제공합니다. 의사소통. Near 체인과 동기화하려면 모든 스냅샷만 다운로드하면 됩니다. 차단하고 Schnorr 서명이 올바른지 확인한 다음(선택적으로 validators의 개별 BLS 서명도 확인) 동기화만 수행합니다. 마지막 스냅샷 블록의 메인 체인 블록.
Conclusion
Conclusion
In this document we discussed approaches to building sharded blockchains and covered two major challenges with existing approaches, namely state validity and data availability. We then presented Nightshade, a sharding design that powers NEAR Protocol. The design is work in progress, if you have comments, questions or feedback on this document, please go to https://near.chat.
결론
이 문서에서 우리는 샤딩된 blockchain을 구축하는 방법과 기존 접근 방식의 두 가지 주요 문제, 즉 상태 타당성을 다루었습니다. 및 데이터 가용성. 그런 다음 샤딩 디자인인 Nightshade를 선보였습니다. NEAR 프로토콜에 힘을 실어줍니다. 디자인 작업이 진행 중입니다. 의견, 질문 또는 피드백이 있는 경우 이 문서에서 https://near.chat.로 이동하세요.