ورقة عمل NEAR

Nightshade: Near Protocol Sharding Design

Автор Alex Skidanov and Illia Polosukhin · 2019

Обычный режим near.org

Sharding Basics

Sharding Basics

Let’s start with the simplest approach to sharding. In this approach instead of running one blockchain, we will run multiple, and call each such blockchain a “shard”. Each shard will have its own set of validators. Here and below we use a generic term “validator” to refer to participants that verify transactions and produce blocks, either by mining, such as in Proof of Work, or via a voting-based 1This section was previously published at https://near.ai/shard1. If you read it before, skip to the next section.

mechanism. For now let’s assume that the shards never communicate with each other. This design, though simple, is sufficient to outline some initial major challenges in sharding. 1.1 Validator partitioning and Beacon chains Say that the system comprises 10 shards. The first challenge is that with each shard having its own validators, each shard is now 10 times less secure than the entire chain. So if a non-sharded chain with X validators decides to hard-fork into a sharded chain, and splits X validators across 10 shards, each shard now only has X/10 validators, and corrupting one shard only requires corrupting 5.1% (51% / 10) of the total number of validators (see figure 1), Figure 1: Splitting the validators across shards which brings us to the second point: who chooses validators for each shard? Controlling 5.1% of validators is only damaging if all those 5.1% of validators are in the same shard. If validators can’t choose which shard they get to validate in, a participant controlling 5.1% of the validators is highly unlikely to get all their validators in the same shard, heavily reducing their ability to compromise the system. Almost all sharding designs today rely on some source of randomness to assign validators to shards. Randomness on blockchain on itself is a very challenging topic and is out of scope for this document. For now let’s assume there’s some source of randomness we can use. We will cover validators assignment in more detail in section 2.1. Both randomness and validator assignment require computation that is not specific to any particular shard. For that computation, practically all existing designs have a separate blockchain that is tasked with performing operations necessary for the maintenance of the entire network. Besides generating random

numbers and assigning validators to the shards, these operations often also include receiving updates from shards and taking snapshots of them, processing stakes and slashing in Proof-of-Stake systems, and rebalancing shards when that feature is supported. Such chain is called a Beacon chain in Ethereum, a Relay chain in PolkaDot, and the Cosmos Hub in Cosmos. Throughout this document we will refer to such chain as a Beacon chain. The existence of the Beacon chain brings us to the next interesting topic, the quadratic sharding. 1.2 Quadratic sharding Sharding is often advertised as a solution that scales infinitely with the number of nodes participating in the network operation. While it is in theory possible to design such a sharding solution, any solution that has the concept of a Beacon chain doesn’t have infinite scalability. To understand why, note that the Beacon chain has to do some bookkeeping computation, such as assigning validators to shards, or snapshotting shard chain blocks, that is proportional to the number of shards in the system. Since the Beacon chain is itself a single blockchain, with computation bounded by the computational capabilities of nodes operating it, the number of shards is naturally limited. However, the structure of a sharded network does bestow a multiplicative effect on any improvements to its nodes. Consider the case in which an arbitrary improvement is made to the efficiency of nodes in the network which will allow them faster transaction processing times. If the nodes operating the network, including the nodes in the Beacon chain, become four times faster, then each shard will be able to process four times more transactions, and the Beacon chain will be able to maintain 4 times more shards. The throughput across the system will increase by the factor of 4 × 4 = 16 — thus the name quadratic sharding. It is hard to provide an accurate measurement for how many shards are viable today, but it is unlikely that in any foreseeable future the throughput needs of blockchain users will outgrow the limitations of quadratic sharding. The sheer number of nodes necessary to operate such a volume of shards securely is likely orders of magnitude higher than the number of nodes operating all the blockchains combined today. 1.3 State sharding Up until now we haven’t defined very well what exactly is and is not separated when a network is divided into shards. Specifically, nodes in the blockchain perform three important tasks: not only do they 1) process transactions, they also 2) relay validated transactions and completed blocks to other nodes and 3) store the state and the history of the entire network ledger. Each of these three tasks imposes a growing requirement on the nodes operating the network:

  1. The necessity to process transactions requires more compute power with the increased number of transactions being processed;
  2. The necessity to relay transactions and blocks requires more network bandwidth with the increased number of transactions being relayed;
  3. The necessity to store data requires more storage as the state grows. Importantly, unlike the processing power and network, the storage requirement grows even if the transaction rate (number of transactions processed per second) remains constant. From the above list it might appear that the storage requirement would be the most pressing, since it is the only one that is being increased over time even if the number of transactions per second doesn’t change, but in practice the most pressing requirement today is the compute power. The entire state of Ethereum as of this writing is 100GB, easily manageable by most of the nodes. But the number of transactions Ethereum can process is around 20, orders of magnitude less than what is needed for many practical use cases. Zilliqa is the most well-known project that shards processing but not storage. Sharding of processing is an easier problem because each node has the entire state, meaning that contracts can freely invoke other contracts and read any data from the blockchain. Some careful engineering is needed to make sure updates from multiple shards updating the same parts of the state do not conflict. In those regards Zilliqa is taking a relatively simplistic approach2. While sharding of storage without sharding of processing was proposed, it is extremely uncommon. Thus in practice sharding of storage, or State Sharding, almost always implies sharding of processing and sharding of network. Practically, under State Sharding the nodes in each shard are building their own blockchain that contains transactions that affect only the local part of the global state that is assigned to that shard. Therefore, the validators in the shard only need to store their local part of the global state and only execute, and as such only relay, transactions that affect their part of the state. This partition linearly reduces the requirement on all compute power, storage, and network bandwidth, but introduces new problems, such as data availability and cross-shard transactions, both of which we will cover below. 1.4 Cross-shard transactions The sharding model we described so far is not a very useful, because if individual shards cannot communicate with each other, they are no better than multiple independent blockchains. Even today, when sharding is not available, there’s a huge demand for interoperability between various blockchains. Let’s for now only consider simple payment transactions, where each participant has account on exactly one shard. If one wishes to transfer money from 2Our analysis of their approach can be found here: https://medium.com/nearprotocol/ 8f9efae0ce3b

one account to another within the same shard, the transaction can be processed entirely by the validators in that shard. If, however, Alice that resides on shard

1 wants to send money to Bob who resides on shard #2, neither validators

on shard #1(they won’t be able to credit Bob’s account) nor the validators on shard #2 (they won’t be able to debit Alice’s account) can process the entire transaction. There are two families of approaches to cross-shard transactions: • Synchronous: whenever a cross-shard transaction needs to be executed, the blocks in multiple shards that contain state transition related to the transaction get all produced at the same time, and the validators of multiple shards collaborate on executing such transactions.3 • Asynchronous: a cross-shard transaction that affects multiple shards is executed in those shards asynchronously, the “Credit” shard executing its half once it has sufficient evidence that the “Debit” shard has executed its portion. This approach tends to be more prevalent due to its simplicity and ease of coordination. This system is today proposed in Cosmos, Ethereum Serenity, Near, Kadena, and others. A problem with this approach lies in that if blocks are produced independently, there’s a nonzero chance that one of the multiple blocks will be orphaned, thus making the transaction only partially applied. Consider figure 2 that depicts two shards both of which encountered a fork, and a cross-shard transaction that was recorded in blocks A and X’ correspondingly. If the chains A-B and V’-X’-Y’-Z’ end up being canonical in the corresponding shards, the transaction is fully finalized. If A’-B’-C’-D’ and V-X become canonical, then the transaction is fully abandoned, which is acceptable. But if, for example, A-B and V-X become canonical, then one part of the transaction is finalized and one is abandoned, creating an atomicity failure. We will cover how this problem is addressed in proposed protocols in the second part, when covering changes to the fork-choice rules and consensus algorithms proposed for sharded protocols. Note that communication between chains is useful outside of sharded blockchains too. Interoperability between chains is a complex problem that many projects are trying to solve. In sharded blockchains the problem is somewhat easier since the block structure and consensus are the same across shards, and there’s a beacon chain that can be used for coordination. In a sharded blockchain, however, all the shard chains are the same, while in the global blockchains ecosystem there are lots of different blockchains, with different target use cases, decentralization and privacy guarantees. Building a system in which a set of chains have different properties but use sufficiently similar consensus and block structure and have a common beacon chain could enable an ecosystem of heterogeneous blockchains that have a 3The most detailed proposal known to the authors of this document is Merge Blocks, described here: https://ethresear.ch/t/ merge-blocks-and-synchronous-cross-shard-state-execution/1240

Figure 2: Asynchronous cross-shard transactions working interoperability subsystem. Such system is unlikely to feature validator rotation, so some extra measures need to be taken to ensure security. Both Cosmos and PolkaDot are effectively such systems4 1.5 Malicious behavior In this section we will review what adversarial behavior can malicious validators exercise if they manage to corrupt a shard. We will review classic approaches to avoiding corrupting shards in section 2.1. 1.5.1 Malicious forks A set of malicious validators might attempt to create a fork. Note that it doesn’t matter if the underlying consensus is BFT or not, corrupting sufficient number of validators will always make it possible to create a fork. It is significantly more likely for more that 50% of a single shard to be corrupted, than for more than 50% of the entire network to be corrupted (we will dive deeper into these probabilities in section 2.1). As discussed in section 1.4, cross-shard transactions involve certain state changes in multiple shards, and the corresponding blocks in such shards that apply such state changes must either be all finalized (i.e. appear in the selected chains on their corresponding shards), or all be orphaned (i.e. not appear in the selected chains on their corresponding shards). Since generally the probability of shards being corrupted 4Refer to this writeup by Zaki Manian from Cosmos: https://forum.cosmos.network/ t/polkadot-vs-cosmos/1397/2 and this tweet-storm by the first author of this document: https://twitter.com/AlexSkidanov/status/1129511266660126720 for a detailed comparison of the two

is not negligible, we can’t assume that the forks won’t happen even if a byzantine consensus was reached among the shard validators, or many blocks were produced on top of the block with the state change. This problem has multiple solutions, the most common one being occasional cross-linking of the latest shard chain block to the beacon chain. The fork choice rule in the shard chains is then changed to always prefer the chain that is cross-linked, and only apply shard-specific fork-choice rule for blocks that were published since the last cross-link. 1.5.2 Approving invalid blocks A set of validators might attempt to create a block that applies the state transition function incorrectly. For example, starting with a state in which Alice has 10 tokens and Bob has 0 tokens, the block might contain a transaction that sends 10 tokens from Alice to Bob, but ends up with a state in which Alice has 0 tokens and Bob has 1000 tokens, as shown on figure 3. Figure 3: An example of an invalid block In a classic non-sharded blockchain such an attack is not possible, since all the participant in the network validate all the blocks, and the block with such an invalid state transition will be rejected by both other block producers, and the participants of the network that do not create blocks. Even if the malicious validators continue creating blocks on top of such an invalid block faster than honest validators build the correct chain, thus having the chain with the invalid block being longer, it doesn’t matter, since every participant that is using the blockchain for any purpose validates all the blocks, and discards all the blocks built on top of the invalid block. On the figure 4 there are five validators, three of whom are malicious. They created an invalid block A’, and then continued building new blocks on top of it. Two honest validators discarded A’ as invalid and were building on top

Figure 4: Attempt to create an invalid block in a non-sharded blockchain of the last valid block known to them, creating a fork. Since there are fewer validators in the honest fork, their chain is shorter. However, in classic nonsharded blockchain every participant that uses blockchain for any purpose is responsible for validating all the blocks they receive and recomputing the state. Thus any person who has any interest in the blockchain would observe that A’ is invalid, and thus also immediately discard B’, C’ and D’, as such taking the chain A-B as the current longest valid chain. In a sharded blockchain, however, no participant can validate all the transactions on all the shards, so they need to have some way to confirm that at no point in history of any shard of the blockchain no invalid block was included. Note that unlike with forks, cross-linking to the Beacon chain is not a sufficient solution, since the Beacon chain doesn’t have the capacity to validate the blocks. It can only validate that a sufficient number of validators in that shard signed the block (and as such attested to its correctness). We will discuss solutions to this problem in section 2.2 below.

أساسيات المشاركة

لنبدأ بأبسط طريقة للمشاركة. في هذا النهج بدلا من بتشغيل blockchain واحد، سنقوم بتشغيل عدة، ونستدعي كل منها blockchain a "الشظية". سيكون لكل جزء مجموعته الخاصة من validators. هنا وأدناه نستخدم مصطلح عام "validator" للإشارة إلى المشاركين الذين يتحققون من المعاملات و إنتاج الكتل، إما عن طريق التعدين، كما هو الحال في إثبات العمل، أو عن طريق التصويت على أساس 1تم نشر هذا القسم مسبقًا في https://near.ai/shard1. إذا قرأته من قبل، انتقل إلى القسم التالي.

آلية. لنفترض الآن أن القطع لا تتواصل مع بعضها أبدًا أخرى. هذا التصميم، على الرغم من بساطته، يكفي لتوضيح بعض التحديات الرئيسية الأولية في التقسيم. 1.1 تقسيم المدقق وسلاسل المنارة لنفترض أن النظام يتكون من 10 أجزاء. التحدي الأول هو أنه مع كل منهما الجزء الذي يحتوي على validators خاص به، أصبح كل جزء الآن أقل أمانًا بعشر مرات من الجزء السلسلة بأكملها. لذا، إذا قررت سلسلة غير مجزأة تحتوي على X validators إجراء عملية الانقسام الكلي إلى سلسلة مجزأة، وتقسم X validators عبر 10 أجزاء، كل جزء الآن يحتوي فقط على X/10 validators، وإفساد جزء واحد يتطلب إفسادًا فقط 5.1% (51% / 10) من إجمالي عدد validators (انظر الشكل 1)، الشكل 1: تقسيم validators عبر الأجزاء وهو ما يقودنا إلى النقطة الثانية: من يختار validators لكل جزء؟ إن التحكم في 5.1% من validators يكون ضارًا فقط إذا كانت كل تلك الـ 5.1% من validators هم في نفس القشرة. إذا لم يتمكن validators من اختيار الجزء الذي يمكنهم التحقق من صحته في، من غير المرجح أن يحصل المشارك الذي يتحكم في 5.1% من validators على كل شيء validators في نفس القطعة، مما يقلل بشكل كبير من قدرتهم على التسوية النظام. تعتمد جميع تصميمات التجزئة تقريبًا اليوم على بعض مصادر العشوائية قم بتعيين validators إلى الأجزاء. تعتبر العشوائية في blockchain في حد ذاتها موضوعًا صعبًا للغاية وهي خارج نطاق هذه الوثيقة. الآن دعونا نفترض أن هناك بعض مصادر العشوائية التي يمكننا استخدامها. سوف نقوم بتغطية مهمة validators في مزيد من التفاصيل في القسم 2.1. تتطلب كل من العشوائية والتخصيص validator حسابًا ليس كذلك خاص بأي شريحة معينة. لهذا الحساب، عمليا كل الموجود تحتوي التصميمات على blockchain منفصل مكلف بتنفيذ العمليات اللازمة لصيانة الشبكة بأكملها. إلى جانب توليد عشوائيالأرقام وتعيين validators للأجزاء، غالبًا ما تكون هذه العمليات أيضًا تتضمن تلقي التحديثات من الأجزاء والتقاط لقطات منها ومعالجتها الرهانات والتخفيض في أنظمة إثبات الحصة، وإعادة موازنة القطع عند ذلك الميزة مدعومة. تسمى هذه السلسلة بسلسلة المنارة في Ethereum، وهي مرحل السلسلة في PolkaDot، والمركز Cosmos في Cosmos. في جميع أنحاء هذه الوثيقة سوف نشير إلى هذه السلسلة باسم سلسلة المنارة. يقودنا وجود سلسلة Beacon إلى الموضوع التالي المثير للاهتمام، وهو تقسيم تربيعي. 1.2 التقسيم التربيعي غالبًا ما يتم الإعلان عن المشاركة كحل يتسع بشكل لا نهائي مع العدد من العقد المشاركة في تشغيل الشبكة. في حين أنه من الناحية النظرية ممكن تصميم مثل هذا الحل للمشاركة، أي حل يحتوي على مفهوم المنارة السلسلة ليس لديها قابلية التوسع اللانهائية. لفهم السبب، لاحظ أن المنارة يتعين على السلسلة إجراء بعض العمليات الحسابية المحاسبية، مثل تعيين validators إلى القطع، أو قطع سلسلة القطع، التي تتناسب مع العدد من الشظايا في النظام. نظرًا لأن سلسلة Beacon هي نفسها blockchain واحدة، مع الحساب يحده القدرات الحسابية للعقد التي تعمل عليه، عدد القطع محدود بشكل طبيعي. ومع ذلك، فإن بنية الشبكة المجزأة تمنح عملية مضاعفة التأثير على أي تحسينات على العقد الخاصة به. النظر في الحالة التي يكون فيها التعسفي يتم إجراء تحسين على كفاءة العقد في الشبكة مما سيسمح بذلك لهم أوقات معالجة المعاملات أسرع. إذا كانت العقد التي تقوم بتشغيل الشبكة، بما في ذلك العقد الموجودة في سلسلة المنارة، تصبح أسرع بأربع مرات، فستكون كل قطعة قادرة على المعالجة أربع مرات أكثر المعاملات، وستكون سلسلة المنارة قادرة على الحفاظ على شظايا أكثر بأربعة أضعاف. ستزداد الإنتاجية عبر النظام بعامل 4 × 4 = 16 - ومن هنا جاء اسم التقسيم التربيعي. من الصعب توفير قياس دقيق لعدد الشظايا قابلة للحياة اليوم، ولكن من غير المرجح أن في أي المستقبل المنظور الإنتاجية سوف تتجاوز احتياجات مستخدمي blockchain قيود التقسيم التربيعي. العدد الهائل من العقد اللازمة لتشغيل مثل هذا الحجم من القطع بشكل آمن من المحتمل أن يكون حجمها أعلى من عدد العقد التي تعمل جميعها blockchains مجتمعة اليوم. 1.3 تقسيم الدولة حتى الآن لم نحدد بشكل جيد ما هو منفصل وما هو غير منفصل عندما يتم تقسيم الشبكة إلى أجزاء. على وجه التحديد، العقد الموجودة في blockchain أداء ثلاث مهام مهمة: لا يقومون فقط بـ 1) معالجة المعاملات، بل يقومون أيضًا أيضًا 2) ترحيل المعاملات التي تم التحقق منها والكتل المكتملة إلى العقد الأخرى و3) تخزين حالة وتاريخ دفتر أستاذ الشبكة بالكامل. كل واحد من هؤلاء الثلاثة تفرض المهام متطلبات متزايدة على العقد التي تقوم بتشغيل الشبكة:1. تتطلب ضرورة معالجة المعاملات المزيد من القوة الحاسوبية زيادة عدد المعاملات التي تتم معالجتها؛ 2. تتطلب ضرورة ترحيل المعاملات والكتل مزيدًا من النطاق الترددي للشبكة مع زيادة عدد المعاملات التي يتم ترحيلها؛ 3. ضرورة تخزين البيانات تتطلب المزيد من التخزين مع نمو الدولة. الأهم من ذلك، على عكس قوة المعالجة والشبكة، فإن متطلبات التخزين تنمو حتى لو كان معدل المعاملة (عدد المعاملات التي تمت معالجتها). في الثانية) يظل ثابتًا. من القائمة أعلاه قد يبدو أن متطلبات التخزين ستكون كذلك والأكثر إلحاحا، لأنه الوحيد الذي يتزايد مع مرور الوقت حتى لو لم يتغير عدد المعاملات في الثانية، ولكن في الممارسة العملية الشرط الأكثر إلحاحا اليوم هو قوة الحوسبة. الدولة بأكملها Ethereum حتى كتابة هذه السطور تبلغ 100 جيجابايت، ويمكن التحكم فيها بسهولة بواسطة معظم العقد. لكن عدد المعاملات التي يمكن لـ Ethereum معالجتها يبلغ حوالي 20 ألف طلب حجمها أقل مما هو مطلوب في العديد من حالات الاستخدام العملي. Zilliqa هو المشروع الأكثر شهرة الذي يقوم بمعالجة القطع وليس التخزين. تعد عملية تقاسم المعالجة مشكلة أسهل لأن كل عقدة تحتوي على كامل المعالجة State، مما يعني أنه يمكن للعقود استدعاء العقود الأخرى بحرية وقراءة أي بيانات من blockchain. هناك حاجة إلى بعض الهندسة الدقيقة للتأكد من التحديثات من شظايا متعددة تحديث نفس الأجزاء من الدولة لا تتعارض. في فيما يتعلق بهذه الأمور، تتخذ Zilliqa نهجًا مبسطًا نسبيًا. في حين تم اقتراح تقسيم التخزين دون تقسيم المعالجة، فهو كذلك غير شائع للغاية. وبالتالي، في الممارسة العملية، تقاسم التخزين، أو تقاسم الدولة، يعني دائمًا تقريبًا تقسيم المعالجة وتقسيم الشبكة. من الناحية العملية، في ظل تقسيم الحالة، تقوم العقد الموجودة في كل جزء ببناء عقدها الخاصة الخاص blockchain الذي يحتوي على المعاملات التي تؤثر فقط على الجزء المحلي من الحالة العالمية المخصصة لتلك القطعة. ولذلك، فإن validators في تحتاج Shard فقط إلى تخزين الجزء المحلي الخاص بها من الحالة العالمية وتنفيذها فقط، وعلى هذا النحو فقط يقومون بترحيل المعاملات التي تؤثر على الجزء الخاص بهم من الدولة. هذا يعمل التقسيم خطيًا على تقليل المتطلبات على جميع طاقة الحوسبة والتخزين و عرض النطاق الترددي للشبكة، ولكنه يقدم مشاكل جديدة، مثل توفر البيانات و المعاملات المتقاطعة، والتي سنغطيها أدناه. 1.4 المعاملات المتقاطعة نموذج التجزئة الذي وصفناه حتى الآن ليس مفيدًا جدًا، لأنه إذا كان فرديًا لا تستطيع الشظايا التواصل مع بعضها البعض، فهي ليست أفضل من المتعددة مستقل blockchains. حتى اليوم، عندما لا تكون المشاركة متاحة، هناك الطلب الكبير على قابلية التشغيل البيني بين مختلف blockchains. دعونا الآن نفكر فقط في معاملات الدفع البسيطة، حيث يكون لكل مشارك حساب في جزء واحد بالضبط. إذا كان أحد يرغب في تحويل الأموال من 2يمكن العثور على تحليلنا لنهجهم هنا: https://medium.com/nearprotocol/ 8f9efae0ce3bمن حساب إلى آخر ضمن نفس الجزء، يمكن معالجة المعاملة بالكامل بواسطة validators في تلك القطعة. ومع ذلك، إذا كانت أليس تسكن على القشرة يريد رقم 1 إرسال أموال إلى بوب الذي يقيم في الجزء رقم 2، وليس validators في الجزء رقم 1 (لن يتمكنوا من إضافة حساب بوب) ولا validators على يمكن للجزء رقم 2 (لن يتمكنوا من الخصم من حساب أليس) معالجة العملية بالكامل معاملة. هناك مجموعتان من أساليب التعامل مع المعاملات المتقاطعة: • متزامن: عندما يلزم تنفيذ معاملة متقاطعة، الكتل الموجودة في أجزاء متعددة تحتوي على انتقال الحالة المتعلق بـ يتم إنتاج جميع المعاملات في نفس الوقت، وتتعاون validators من الأجزاء المتعددة في تنفيذ مثل هذه المعاملات.3 • غير متزامن: معاملة متقاطعة تؤثر على أجزاء متعددة يتم تنفيذه في تلك الأجزاء بشكل غير متزامن، ويتم تنفيذ جزء "الائتمان". نصفها بمجرد أن يكون لديها أدلة كافية على أن الجزء "المدين" قد نفذ نصيبه. يميل هذا النهج إلى أن يكون أكثر انتشارًا نظرًا لخصائصه البساطة وسهولة التنسيق. يُقترح هذا النظام اليوم في Cosmos، Ethereum Serenity، Near، Kadena، وغيرها. مشكلة في هذا يكمن النهج في أنه إذا تم إنتاج الكتل بشكل مستقل، فهناك فرصة غير صفرية لأن تصبح إحدى الكتل المتعددة معزولة، مما يجعل تم تطبيق المعاملة جزئيًا فقط. خذ بعين الاعتبار الشكل 2 الذي يصور اثنين واجه كلاهما شوكة ومعاملة متقاطعة التي تم تسجيلها في الكتلتين A وX على التوالي. إذا كانت السلاسل A-B وV'-X'-Y'-Z' ينتهي بهما الأمر إلى أن يكونا أساسيين في الأجزاء المقابلة، the تم الانتهاء من الصفقة بالكامل. إذا أصبح A'-B'-C'-D' وV-X أساسيين، ومن ثم يتم التخلي عن المعاملة بالكامل، وهو أمر مقبول. ولكن إذا، ل على سبيل المثال، تصبح A-B وV-X أساسية، ثم يتم الانتهاء من جزء واحد من المعاملة ويتم التخلي عن جزء آخر، مما يؤدي إلى فشل ذري. نحن سوف يغطي كيفية معالجة هذه المشكلة في البروتوكولات المقترحة في الجزء الثاني، عند تغطية التغييرات في قواعد اختيار الشوكة والإجماع الخوارزميات المقترحة للبروتوكولات المجزأة. لاحظ أن الاتصال بين السلاسل مفيد خارج blockchains المقسمة أيضا. تعد إمكانية التشغيل البيني بين السلاسل مشكلة معقدة تواجهها العديد من المشاريع يحاولون حل. في blockchains المشكلة أسهل إلى حد ما منذ ذلك الحين هيكل الكتلة والإجماع متماثلان عبر الأجزاء، وهناك سلسلة إشارات يمكن استخدامها للتنسيق. ومع ذلك، في blockchain مجزأة، جميع سلاسل الأجزاء هي نفسها، بينما في النظام البيئي العالمي blockchains هناك هناك الكثير من blockchains، مع حالات استخدام مستهدفة مختلفة، واللامركزية وضمانات الخصوصية. بناء نظام تكون فيه مجموعة من السلاسل لها خصائص مختلفة ولكن استخدام إجماع وبنية كتلة متماثلين بدرجة كافية والحصول على سلسلة إشارات مشتركة يمكن أن تمكن نظامًا بيئيًا من blockchains غير المتجانسة التي لها 3ال معظم مفصلة اقتراح معروف ل ال المؤلفين من هذا وثيقة هو دمج كتل، الموصوفة هنا: https://ethresear.ch/t/ دمج الكتل والتزامن عبر تنفيذ الحالة / 1240الشكل 2: المعاملات المتقاطعة غير المتزامنة العمل على النظام الفرعي للتشغيل البيني. من غير المحتمل أن يتميز مثل هذا النظام بالتناوب validator، لذا يلزم اتخاذ بعض الإجراءات الإضافية لضمان الأمان. كلاهما Cosmos وPolkaDot هما من هذه الأنظمة بشكل فعال4 1.5 السلوك الضار سنراجع في هذا القسم السلوك العدائي الذي يمكن أن يكون ضارًا لـ validators ممارسة إذا تمكنوا من إفساد شظية. سنراجع الأساليب الكلاسيكية لتجنب إتلاف القطع في القسم 2.1. 1.5.1 شوكات ضارة قد تحاول مجموعة من validators الضارة إنشاء تفرع. لاحظ أنه لا لا يهم إذا كان الإجماع الأساسي هو BFT أم لا، مما يؤدي إلى إفساد العدد الكافي من validators سيجعل من الممكن دائمًا إنشاء شوكة. من المرجح بشكل كبير أن يفسد أكثر من 50% من جزء واحد، أكثر من أن يفسد أكثر من 50% من الشبكة بأكملها (سنقوم بذلك) تعمق أكثر في هذه الاحتمالات في القسم 2.1). كما تمت مناقشته في القسم 1.4، تتضمن المعاملات المتقاطعة تغييرات معينة في الحالة في أجزاء متعددة، و يجب أن تكون الكتل المقابلة في هذه القطع التي تطبق مثل هذه التغييرات في الحالة إما أن يتم الانتهاء منها جميعًا (أي تظهر في السلاسل المحددة في السلاسل المقابلة لها القطع)، أو تكون جميعها يتيمة (أي لا تظهر في السلاسل المحددة على القطع المقابلة لها). منذ عموما احتمال تلف القطع 4 ارجع إلى هذه الكتابة التي كتبها زكي مانيان من Cosmos: https://forum.cosmos.network/ t/polkadot-vs-cosmos/1397/2 وهذه العاصفة من التغريدات التي كتبها المؤلف الأول لهذه الوثيقة: https://twitter.com/AlexSkidanov/status/1129511266660126720 للحصول على مقارنة تفصيلية من الاثنين

لا يمكن إهمالها، فلا يمكننا أن نفترض أن التشعبات لن تحدث حتى لو تم التوصل إلى إجماع بيزنطي بين الكسور validators، أو تم إنشاء العديد من الكتل أنتجت على رأس الكتلة مع تغيير الحالة. لهذه المشكلة حلول متعددة، وأكثرها شيوعًا هو الحلول العرضية الربط المتبادل لأحدث كتلة سلسلة شظية بسلسلة المنارة. الشوكة يتم بعد ذلك تغيير قاعدة الاختيار في سلاسل القطع لتفضل دائمًا السلسلة الموجودة مرتبطة بشكل متقاطع، ولا تطبق إلا قاعدة اختيار الشوكة الخاصة بالكتل التي كانت تم نشره منذ آخر رابط متقاطع. 1.5.2 الموافقة على الكتل غير الصالحة قد تحاول مجموعة من validators إنشاء كتلة تطبق وظيفة انتقال الحالة بشكل غير صحيح. على سبيل المثال، البدء بالحالة التي تكون فيها أليس لديه 10 tokens وBob لديه 0 tokens، قد تحتوي الكتلة على معاملة يرسل 10 tokens من أليس إلى بوب، لكنه ينتهي بحالة تكون فيها أليس 0 tokens وبوب لديه 1000 tokens، كما هو موضح في الشكل 3. الشكل 3: مثال على كتلة غير صالحة في blockchain الكلاسيكية غير المجزأة، مثل هذا الهجوم غير ممكن، لأن كل شيء يقوم المشارك في الشبكة بالتحقق من صحة جميع الكتل، والكتلة بها سيتم رفض انتقال الحالة غير الصالح من قبل منتجي الكتل الآخرين و المشاركون في الشبكة الذين لا يقومون بإنشاء كتل. حتى لو كانت خبيثة يستمر validators في إنشاء الكتل فوق هذه الكتلة غير الصالحة بشكل أسرع من يقوم validators الصادقون ببناء السلسلة الصحيحة، وبالتالي الحصول على السلسلة مع غير الصالح كون الكتلة أطول، لا يهم، لأن كل مشارك يستخدم blockchain لأي غرض من الأغراض يتحقق من صحة كافة الكتل، ويتجاهل كافة الكتل بنيت على رأس كتلة غير صالحة. في الشكل 4 يوجد خمسة validator، ثلاثة منها خبيثة. هم أنشأنا كتلة غير صالحة "أ"، ثم واصلنا بناء كتل جديدة في الأعلى منه. تم تجاهل اثنين من validators الصادقين A' باعتباره غير صالح وكانا يبنيان في الأعلىالشكل 4: محاولة إنشاء كتلة غير صالحة في blockchain غير مقسمة من آخر كتلة صالحة معروفة لهم، مما أدى إلى إنشاء شوكة. نظرًا لوجود عدد أقل validators في الشوكة الصادقة سلسلتهم أقصر. ومع ذلك، في blockchain الكلاسيكي غير المقسم، كل مشارك يستخدم blockchain لأي غرض هو مسؤول عن التحقق من صحة جميع الكتل التي يتلقونها وإعادة حساب الحالة. وبالتالي فإن أي شخص لديه أي مصلحة في blockchain سوف يلاحظ أن "أ" غير صالح، وبالتالي أيضًا تجاهل B' وC' وD' على الفور، على هذا النحو مع أخذ السلسلة A-B هي أطول سلسلة صالحة حاليًا. ومع ذلك، في blockchain المجزأة، لا يستطيع أي مشارك التحقق من صحة جميع المعاملات على جميع الأجزاء، لذلك يحتاجون إلى طريقة ما لتأكيد ذلك نقطة في تاريخ أي جزء من blockchain لم يتم تضمين كتلة غير صالحة. لاحظ أنه على عكس الشوكات، فإن الارتباط المتبادل بسلسلة Beacon ليس حلاً كافيًا، نظرًا لأن سلسلة Beacon لا تتمتع بالقدرة على التحقق من صحة كتل. يمكنها فقط التحقق من وجود عدد كافٍ من validators في تلك القطعة وقع على الكتلة (وبالتالي يشهد على صحتها). سنناقش حلول هذه المشكلة في القسم 2.2 أدناه.

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. إذا قرأته من قبل، فانتقل إلى القسم التالي.

تفاعلهم هو نتيجة لبعض التسلسل الصحيح للكتل وهذا التسلسل من الكتل هي في الواقع السلسلة الأساسية في القشرة. مشكلة لا موجودة في blockchain غير مجزأة. سنقدم أولاً حلاً بسيطًا لهذه المشكلة التي تم اقتراحها بواسطة العديد من البروتوكولات ثم قم بتحليل كيف يمكن أن ينكسر هذا الحل وماذا وقد بذلت محاولات لمعالجتها. 2.1 تناوب المدققين يظهر الحل الساذج لصلاحية الحالة في الشكل 5: لنفترض أننا نفترض أن النظام بأكمله يحتوي على آلاف validators، منها ما لا يزيد عن 20% منها تكون ضارة أو ستفشل (مثل الفشل في أن تكون عبر الإنترنت لإنتاج كتلة). ثم إذا أخذنا عينة من 200 validators، فإن الاحتمال من أكثر من 1 3 يمكن افتراض أن الفشل للأغراض العملية هو صفر. الشكل 5: أخذ العينات validators 1 3 عتبة مهمة. هناك عائلة من بروتوكولات الإجماع تسمى BFT بروتوكولات الإجماع، التي تضمن ذلك لمدة تقل عن 1 3 من يفشل المشاركون، إما عن طريق الانهيار أو عن طريق التصرف بطريقة تنتهك قواعد اللعبة البروتوكول، سيتم التوصل إلى توافق في الآراء. مع هذا الافتراض بنسبة validator الصادقة، إذا كانت المجموعة الحالية من validators في الجزء يزودنا ببعض الكتل، كما يفترض الحل الساذج أن الكتلة صالحة وأنها مبنية على ما يعتقده validators السلسلة الأساسية لتلك القطعة عندما بدأوا في التحقق من صحتها. validators تعلمت السلسلة الأساسية من المجموعة السابقة من validators، والتي بنفس الطريقة تم بناء الافتراض فوق الكتلة التي كانت رأس السلسلة القانونية قبل ذلك. عن طريق الاستقراء تكون السلسلة بأكملها صالحة، وبما أنه لا توجد مجموعة من validators في أي لحظة أنتجت الشوك، والحل الساذج هو أيضا على يقين من أن التيار السلسلة هي السلسلة الوحيدة في القشرة. انظر الشكل 6 للتصور.

الشكل 6: blockchain مع الانتهاء من كل كتلة من خلال إجماع BFT هذا الحل البسيط لا يعمل إذا افترضنا أن validators يمكن أن يكون كذلك تالف بشكل تكيفي، وهو ليس افتراضًا غير معقول. بشكل تكيفي إن إفساد جزء واحد في نظام يحتوي على 1000 جزء يعد أرخص بكثير بدلاً من إفساد النظام بأكمله. ولذلك، فإن أمان البروتوكول يتناقص خطيًا مع عدد الأجزاء. أن يكون على يقين من صحة كتلة، يجب أن نعرف أنه في أي وقت من التاريخ لم يحدث أي شظية في النظام أغلبية validators تتواطأ؛ مع الخصوم التكيفيين، لم يعد لدينا مثل هذا اليقين. كما ناقشنا في القسم 1.5، يمكن أن يكون التواطؤ validator أمرًا فعالاً هناك سلوكان خبيثان أساسيان: إنشاء تشعبات وإنتاج كتل غير صالحة. يمكن معالجة التشعبات الضارة من خلال ربط الكتل بسلسلة Beacon المصممة بشكل عام لتكون ذات مستوى أمان أعلى بكثير من تلك الموجودة في سلسلة Beacon. سلاسل القشرة. ومع ذلك، فإن إنتاج كتل غير صالحة يعد أمرًا أكثر أهمية مشكلة صعبة لمعالجة. 2.2 صلاحية الدولة خذ بعين الاعتبار الشكل 7 الذي تظهر فيه القطعة رقم 1 تالفة وينتجها ممثل خبيث الكتلة غير الصالحة B. لنفترض في هذه الكتلة B أنه تم سك 1000 tokens من الرقاقة الهواء على حساب أليس. يقوم الممثل الخبيث بعد ذلك بإنتاج كتلة C صالحة (في ملف بمعنى أن المعاملات في C يتم تطبيقها بشكل صحيح) أعلى B، مما يؤدي إلى التشويش الكتلة B غير الصالحة، وتبدأ معاملة مشتركة للجزء رقم 2 ينقل تلك الـ 1000 tokens إلى حساب بوب. من هذه اللحظة بشكل غير صحيح تم إنشاء tokens على blockchain صالح تمامًا بخلاف ذلك في الجزء رقم 2. بعض الطرق البسيطة لمعالجة هذه المشكلة هي: 6اقرأ هذا مقالة ل التفاصيل على كيف التكيف الفساد يمكن يكون نفذت خارج: https://medium.com/nearprotocol/d859adb464c8. ل المزيد التفاصيل على التكيف الفساد, قراءة https://github.com/ethereum/wiki/wiki/Sharding-FAQ# ما هي نماذج الأمان التي نعمل بموجبها؟الشكل 7: معاملة مشتركة من سلسلة تحتوي على كتلة غير صالحة 1. بالنسبة إلى validators من الجزء رقم 2 للتحقق من صحة الكتلة التي يتم منها المعاملة بدأ. لن ينجح هذا حتى في المثال أعلاه، نظرًا لأن الكتلة C يبدو أنه صالح تماما. 2. بالنسبة لـ validators في الجزء رقم 2 للتحقق من صحة عدد كبير من الكتل التي تسبق الكتلة التي تبدأ منها المعاملة. بطبيعة الحال، ل أي عدد من الكتل N التي تم التحقق من صحتها بواسطة الجزء المتلقي الخبيث يمكن لـ validators إنشاء كتل صالحة N+1 أعلى الكتلة غير الصالحة أنتجت. قد تكون الفكرة الواعدة لحل هذه المشكلة هي ترتيب القطع في ملف رسم بياني غير موجه حيث ترتبط كل قطعة بعدة أجزاء أخرى، و السماح فقط بالمعاملات المتقاطعة بين الأجزاء المجاورة (على سبيل المثال، هذه هي الطريقة إن عملية التقسيم التي اقترحها فلاد زامفير تعمل بشكل أساسي7، كما تم استخدام فكرة مماثلة في فكرة كادينا تشينويب [1]). إذا كانت هناك حاجة إلى معاملة متقاطعة بين الأجزاء الموجودة وليس الجيران، يتم توجيه هذه المعاملة من خلال أجزاء متعددة. في هذا التصميم من المتوقع أن يقوم validator في كل جزء بالتحقق من صحة كل الكتل الموجودة في الجزء الخاص بهم وكذلك جميع الكتل في جميع القطع المجاورة. النظر في الشكل أدناه مع 10 شظايا، لكل منها أربعة جيران، ولا تتطلب شظيتين أكثر أكثر من قفزتين للاتصال المتقاطع الموضح في الشكل 8. لا تقوم القطعة رقم 2 بالتحقق من صحة blockchain الخاصة بها فحسب، بل أيضًا blockchains الخاصة بها جميع الجيران، بما في ذلك الشارد رقم 1. فإذا كان فاعل خبيث على الكسرة رقم 1 يحاول إنشاء كتلة B غير صالحة، ثم بناء الكتلة C فوقها وبدء معاملة القطع المتقاطعة، لن تتم مثل هذه المعاملة المتقاطعة من خلال الجزء رقم 2 سيكون قد تم التحقق من صحة تاريخ الجزء رقم 1 بأكمله والذي سيؤدي ذلك إلى تحديد الكتلة غير الصالحة B. 7 اقرأ المزيد عن التصميم هنا: https://medium.com/nearprotocol/37e538177ed9

الشكل 8: معاملة متقاطعة غير صالحة في نظام يشبه شبكة الويب من شأنه أن الحصول على الكشف عنها على الرغم من أن إتلاف جزء واحد لم يعد هجومًا قابلاً للتطبيق، إلا أن إتلاف ملف تبقى شظايا قليلة مشكلة. في الشكل 9، هناك خصم يفسد كلاً من الشارد نجح #1 وShard #2 في تنفيذ معاملة مشتركة إلى Shard #3 بأموال من الكتلة B غير الصالحة: الشكل 9: معاملة متقاطعة غير صالحة في نظام يشبه شبكة الويب من شأنه أن لا يتم الكشف عنها الجزء رقم 3 يتحقق من صحة جميع الكتل في الجزء رقم 2، ولكن ليس في الجزء رقم 1، و ليس لديه طريقة للكشف عن الكتلة الضارة. هناك اتجاهان رئيسيان لحل مشكلة صلاحية الدولة بشكل صحيح: الصيادون

والبراهين التشفيرية للحساب. 2.3 صياد الفكرة وراء النهج الأول هي ما يلي: كلما كان رأس الكتلة يتم توصيله بين السلاسل لأي غرض (مثل الارتباط المتبادل بـ سلسلة منارات، أو معاملة متقاطعة)، هناك فترة زمنية خلالها والتي يمكن لأي validator صادق أن يقدم دليلاً على أن الكتلة غير صالحة. هناك هي إنشاءات مختلفة توفر أدلة موجزة للغاية على وجود الكتل غير صالح، وبالتالي فإن حمل الاتصالات للعقد المستقبلة يكون أصغر بكثير من الحصول على كتلة كاملة. مع هذا النهج طالما أن هناك على الأقل validator صادقًا واحدًا في شارد، النظام آمن. الشكل 10: صياد وهذا هو النهج السائد (إلى جانب التظاهر بعدم وجود المشكلة) بين البروتوكولات المقترحة اليوم. ومع ذلك، فإن هذا النهج له طريقتان العيوب الرئيسية: 1. يجب أن تكون فترة التحدي طويلة بما فيه الكفاية للصادق validator للتعرف على الكتلة التي تم إنتاجها، قم بتنزيلها والتحقق منها بالكامل والاستعداد التحدي إذا كانت الكتلة غير صالحة. إدخال مثل هذه الفترة سيكون إبطاء المعاملات المتقاطعة بشكل كبير. 2. إن وجود بروتوكول التحدي يخلق ناقلًا جديدًا للهجمات عندما ترسل العقد الضارة رسائل غير مرغوب فيها باختبارات غير صالحة. حل واضح لحل هذه المشكلة هو جعل المنافسين يودعون مبلغًا قدره tokens يتم إرجاعها إذا كان التحدي صالحًا. وهذا ليس سوى حل جزئي، كما هو الحال قد يكون من المفيد للخصم أن يرسل بريدًا عشوائيًا إلى النظام (ويحرق ملفات الودائع) مع الطعون الباطلة، على سبيل المثال لمنع صالحةتحدي من validator صادق من المرور. هذه الهجمات تسمى هجمات الحزن. انظر القسم 3.7.2 لمعرفة طريقة للالتفاف على النقطة الأخيرة. 2.4 حجج المعرفة غير التفاعلية المختصرة الحل الثاني لفساد الأجزاء المتعددة هو استخدام نوع ما من بنيات التشفير التي تسمح للشخص بإثبات أن عملية حسابية معينة (مثل (مثل حساب كتلة من مجموعة من المعاملات) تم تنفيذها بشكل صحيح. مثل هذه الإنشاءات موجودة بالفعل، على سبيل المثال. zk-SNARKs، zk-STARKs وعدد قليل من الآخرين، ويتم استخدام بعضها بشكل نشط في بروتوكولات blockchain اليوم للمدفوعات الخاصة، وأبرزها ZCash. المشكلة الأساسية مع هؤلاء البدائيين هي أنهم من المعروف أنها بطيئة في الحساب. على سبيل المثال. بروتوكول Coda، الذي يستخدم zk-SNARKs على وجه التحديد لإثبات أن جميع الكتل الموجودة في blockchain صالحة، قيل في أحد من المقابلات أن الأمر قد يستغرق 30 ثانية لكل معاملة لإنشاء دليل (ربما يكون هذا الرقم أصغر الآن). ومن المثير للاهتمام أن الدليل لا يحتاج إلى حساب من قبل طرف موثوق به، منذ ذلك الحين لا يشهد الدليل على صحة الحساب الذي بني من أجله فحسب، بل يشهد أيضًا على صحة الدليل نفسه. وبالتالي، يمكن تقسيم حساب هذه البراهين بين مجموعة من المشاركين الذين لديهم تكرار أقل بكثير مما سيكون عليه الحال اللازمة لإجراء بعض الحسابات غير الموثوق بها. كما يسمح للمشاركين الذين يحسبون zk-SNARKs للتشغيل على أجهزة خاصة دون تقليل اللامركزية في النظام. تحديات zk-SNARKs، إلى جانب الأداء، هي: 1. الاعتماد على أساسيات التشفير الأقل بحثًا واختبارها على مر الزمن؛ 2. "النفايات السامة" - تعتمد zk-SNARKs على إعداد موثوق فيه مجموعة من الأشخاص يقومون ببعض العمليات الحسابية ثم يتجاهلون الوسيط قيم هذا الحساب. إذا تواطأ جميع المشاركين في الإجراء والحفاظ على القيم المتوسطة، يمكن إنشاء أدلة وهمية؛ 3. تعقيد إضافي تم إدخاله في تصميم النظام؛ 4. تعمل zk-SNARKs فقط مع مجموعة فرعية من الحسابات المحتملة، وبالتالي البروتوكول مع لغة Turing-Complete smart contract لن يكون من الممكن استخدامها SNARKs لإثبات صحة السلسلة. 2.5 توفر البيانات المشكلة الثانية التي سنتطرق إليها هي توفر البيانات. العقد عموما يتم فصل تشغيل blockchain معين إلى مجموعتين: العقد الكاملة، تلك التي تقوم بتنزيل كل كتلة كاملة والتحقق من صحة كل معاملة، وLight العقد، تلك التي تقوم فقط بتنزيل رؤوس الكتل، وتستخدم إثباتات Merkle للأجزاء للدولة والمعاملات التي يهتمون بها، كما هو مبين في الشكل 11.

الشكل 11: شجرة ميركل الآن، إذا تواطأت غالبية العقد الكاملة، فيمكنها إنتاج كتلة صالحة أو غير صالح، وأرسل hash إلى العقد الخفيفة، ولكن لا تكشف مطلقًا عن المحتوى الكامل من الكتلة. هناك طرق مختلفة يمكنهم الاستفادة منها. على سبيل المثال، النظر في الشكل 12: الشكل 12: مشكلة توفر البيانات هناك ثلاث كتل: السابقة، A، تم إنتاجها بواسطة validators الصادق؛ التيار، B، لديه validators متواطئ؛ وسيتم أيضًا إنتاج المنتج التالي، C بواسطة validators الصادق (تم توضيح blockchain في الزاوية اليمنى السفلية). أنت تاجر. تم استلام الكتلة validators للكتلة الحالية (B). A من validators السابقة، قامت بحساب الكتلة التي تتلقى فيها الأموال،وأرسلت لك رأسًا لتلك الكتلة مع إثبات Merkle للحالة التي فيها لديك أموال (أو إثبات Merkle لمعاملة صالحة ترسل الأموال لك). بعد التأكد من إتمام المعاملة، يمكنك تقديم الخدمة. ومع ذلك، لا يقوم validators أبدًا بتوزيع المحتوى الكامل للكتلة B عليه أي شخص. على هذا النحو، لا يمكن لـ validators الصادقة من الكتلة C استرداد الكتلة، و إما أن تضطر إلى تعطيل النظام أو البناء على الجزء A، مما يحرمك من دورك تاجر المال. عندما نطبق نفس السيناريو على المشاركة، فإن تعريفات كامل و يتم تطبيق العقدة الخفيفة بشكل عام لكل جزء: validators في كل تنزيل جزء كل قم بحظر تلك القطعة والتحقق من صحة كل معاملة في تلك القطعة، ولكن غيرها العقد في النظام، بما في ذلك تلك التي تلتقط سلاسل الأجزاء في سلسلة منارة، فقط تحميل الرؤوس. وبالتالي فإن validators الموجودة في الجزء هي العقد الكاملة لتلك القطعة بشكل فعال، بينما يقوم المشاركون الآخرون في النظام، بما في ذلك سلسلة المنارة، تعمل كعقد ضوئية. لكي ينجح نهج الصياد الذي ناقشناه أعلاه، يجب أن يكون صادقًا validators يجب أن تكون قادرًا على تنزيل الكتل المرتبطة بسلسلة المنارات. إذا قامت validators الضارة بربط رأس كتلة غير صالحة (أو استخدمتها لـ بدء معاملة متقاطعة)، ولكن لم يتم توزيع الكتلة أبدًا، الصادق validators ليس لديهم طريقة لصياغة التحدي. سنغطي ثلاثة طرق لمعالجة هذه المشكلة المكملة بعضها البعض. 2.5.1 إثباتات الحضانة المشكلة الأكثر إلحاحًا التي يجب حلها هي ما إذا كانت الكتلة متاحة مرة واحدة أم لا تم نشره. إحدى الأفكار المقترحة هي أن يكون هناك ما يسمى بكتاب العدل الذين يتناوبون بين الأجزاء في كثير من الأحيان أكثر من validators التي تتمثل مهمتها الوحيدة في تنزيل ملف حظر ويشهد على حقيقة أنهم تمكنوا من تنزيله. يمكن أن يكونوا كذلك يتم تدويرها بشكل متكرر لأنهم لا يحتاجون إلى تنزيل الحالة بأكملها من القطعة، على عكس validators الذين لا يمكن تدويرهم بشكل متكرر منذ ذلك الحين يجب تنزيل حالة الجزء في كل مرة يتم تدويرها، كما هو موضح في الشكل 13. المشكلة في هذا النهج الساذج هو أنه من المستحيل إثباته لاحقًا ما إذا كان كاتب العدل قادرًا على تنزيل الكتلة أم لا، لذلك كاتب العدل يمكنهم اختيار التأكيد دائمًا على أنهم تمكنوا من تنزيل الكتلة بدونها وحتى محاولة استعادته. أحد الحلول لذلك هو أن يقدمه كتاب العدل بعض الأدلة أو حصة مبلغ من tokens يشهد على أن الكتلة كانت تم تنزيله. تتم مناقشة أحد هذه الحلول هنا: https://ethresear.ch/t/ 1-بت-التجميع-ودية-سندات الحضانة/2236. 2.5.2 رموز المحو عندما تتلقى عقدة ضوئية معينة hash من الكتلة، لزيادة عدد العقد الثقة بأن الكتلة متاحة يمكنها محاولة تنزيل عدد قليل عشوائيًا قطع الكتلة. وهذا ليس حلا كاملا، لأنه ما لم تكن العقد الخفيفة قم بتنزيل الكتلة بأكملها بشكل جماعي والتي يمكن لمنتجي الكتل الضارة اختيارها

الشكل 13: تحتاج أدوات التحقق إلى تنزيل الحالة وبالتالي لا يمكن تدويرها في كثير من الأحيان لحجب أجزاء الكتلة التي لم يتم تنزيلها بواسطة أي عقدة خفيفة، وبالتالي لا يزال يجعل الكتلة غير متاحة. أحد الحلول هو استخدام بنية تسمى Erasure Codes لجعل ذلك ممكنًا لاستعادة الكتلة الكاملة حتى في حالة توفر جزء فقط من الكتلة، كما هو موضح في الشكل 14 الشكل 14: Merkle tree مبني على بيانات مشفرة مشفرة لدى كل من Polkadot وEthereum Serenity تصميمات تدور حول هذه الفكرة توفير طريقة للعقد الخفيفة لتكون واثقة بشكل معقول من توفر الكتل. يتضمن أسلوب الصفاء Ethereum وصفًا تفصيليًا في [2].2.5.3 نهج Polkadot فيما يتعلق بتوفر البيانات في Polkadot، كما هو الحال في معظم الحلول المجزأة، تقوم كل جزء (تسمى سلسلة Parachain) بتصوير كتلها إلى سلسلة المنارة (تسمى سلسلة التتابع). لنفترض أن هناك 2f + 1 validators على سلسلة التتابع. يُطلق على منتجي الكتل من كتل المظلات اسم المقارنات، بمجرد إنتاج كتلة المظلة، قم بحساب نسخة مشفرة للمسح من الكتلة التي تتكون من أجزاء 2f +1 بحيث تكون أي أجزاء f كافية لإعادة بناء الكتلة. ثم يقومون بتوزيع جزء واحد على كل validator على سلسلة التتابع. سلسلة ترحيل معينة validator ستوقع فقط على سلسلة ترحيل block إذا كان لديهم الجزء الخاص بهم لكل كتلة من الكتل المظلية التي تم التقاطها إليها مثل كتلة سلسلة التتابع. وبالتالي، إذا كانت كتلة سلسلة التتابع تحتوي على توقيعات من 2f + 1 validators، وطالما لم ينتهك البروتوكول أكثر من f منهم، كل منهم يمكن إعادة بناء كتلة المظلة عن طريق جلب الأجزاء من validators التي تتبع البروتوكول. انظر الشكل 15. الشكل 15: توفر بيانات Polkadot 2.5.4 توافر البيانات على المدى الطويل لاحظ أن جميع الأساليب التي تمت مناقشتها أعلاه تشهد فقط على حقيقة أن الكتلة تم نشره على الإطلاق، وهو متاح الآن. يمكن أن تصبح الكتل غير متاحة لاحقًا لعدة أسباب: العقد غير متصلة بالإنترنت، والعقد تمحو التاريخ عمدًا البيانات، وغيرها. من الجدير بالذكر أن المستند التقني الذي يعالج هذه المشكلة هو Polyshard [3]، والذي يستخدم رموز المسح لإتاحة الكتل عبر الأجزاء حتى لو كانت متعددة تفقد القطع بياناتها تمامًا. لسوء الحظ يتطلب نهجهم المحدد جميع الأجزاء لتنزيل الكتل من جميع الأجزاء الأخرى، وهو أمر محظور باهظة الثمن. إن التوفر على المدى الطويل ليس مشكلة ملحة: حيث لا يوجد مشارك في النظام من المتوقع أن يكون قادرًا على التحقق من صحة جميع السلاسل في جميع

shards، يجب تصميم أمان بروتوكول sharded على هذا النحو الطريقة التي يكون بها النظام آمنًا حتى لو أصبحت بعض الكتل القديمة في بعض القطع غير متوفر تماما.

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 واحد، حيث يحتوي كل منهما على blockchain تحتوي الكتلة بشكل منطقي على جميع المعاملات لجميع الأجزاء، وتغير الحالة الكاملة لجميع الشظايا. ومع ذلك، فعليًا، لا يقوم أي مشارك بتنزيل الملف الحالة الكاملة أو الكتلة المنطقية الكاملة. وبدلا من ذلك، كل مشارك في الشبكة فقط يحافظ على الحالة التي تتوافق مع الأجزاء التي يتحقق من صحة المعاملات الخاصة بها، ويتم تقسيم قائمة جميع المعاملات في الكتلة إلى معاملات فعلية قطع، قطعة واحدة لكل قطعة. في ظل الظروف المثالية، تحتوي كل كتلة على قطعة واحدة بالضبط لكل قطعة كتلة، والتي تتوافق تقريبًا مع النموذج الذي يحتوي على سلاسل شظية تنتج سلاسل القطع كتلًا بنفس سرعة سلسلة المنارة. ومع ذلك، بسبب تأخيرات الشبكة، قد تكون بعض القطع مفقودة، لذلك عمليًا كل كتلة يحتوي على قطعة واحدة أو صفر قطعة لكل قطعة. انظر القسم 3.3 للحصول على تفاصيل حول كيفية القيام بذلك يتم إنتاج الكتل. الشكل 16: نموذج به سلاسل شظية على اليسار وبه سلسلة واحدة كتل مقسمة إلى قطع على اليمين

3.2 الإجماع النهجان المهيمنان على الإجماع في blockchains اليوم هما أطول (أو أثقل) سلسلة، وهي السلسلة التي لديها أكبر قدر من العمل أو الحصة المستخدمة في بنائه تعتبر قانونية، و BFT، فيها لكل كتلة بعض مجموعة من validators تصل إلى إجماع BFT. وفي البروتوكولات المقترحة مؤخرا، يعتبر النهج الأخير هو النهج الأكثر هيمنة، لأنها توفر نهائية فورية، بينما في السلسلة الأطول تحتاج إلى المزيد من الكتل ليتم بناؤها على رأس الكتلة لضمان النهاية. في كثير من الأحيان لمعنى الأمن هو الوقت الذي يستغرقه بناء عدد كافٍ من الكتل ترتيب الساعات. استخدام BFT الإجماع على كل كتلة له أيضًا عيوب، مثل: 1. BFT يتضمن الإجماع قدرًا كبيرًا من التواصل. بينما تسمح التطورات الحديثة بالتوصل إلى الإجماع في الوقت الخطي من حيث العدد من المشاركين (راجع على سبيل المثال [4])، لا يزال هناك حمل ملحوظ لكل كتلة؛ 2. من غير الممكن لجميع المشاركين في الشبكة المشاركة في BFT الإجماع لكل كتلة، وبالتالي عادةً ما يصل فقط مجموعة فرعية من المشاركين تم أخذ عينات منها بشكل عشوائي إلى الإجماع. يمكن لمجموعة العينات العشوائية، من حيث المبدأ، أن تكون: تالف بشكل تكيفي، ويمكن إنشاء شوكة من الناحية النظرية. النظام إما أن تكون على غرار ليكون جاهزا لمثل هذا الحدث، وبالتالي لا يزال لديك قاعدة اختيار شوكة إلى جانب إجماع BFT، أو مصممة لإغلاق أسفل في مثل هذا الحدث. ومن الجدير بالذكر أن بعض التصاميم مثل Algorand [5]، يقلل بشكل كبير من احتمالية الفساد التكيفي. 3. والأهم من ذلك، أن النظام يتوقف إذا 1 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 للحصول على تفاصيل حول كيفية تجميع هذا العدد الكبير من التوقيعات. الوزن 8 راجع أيضًا جلسة السبورة البيضاء مع جاستن دريك للحصول على نظرة عامة متعمقة عن Casper FFG، وكيف يتم دمجه مع إجماع سلسلة GHOST الأثقل هنا: https://www. youtube.com/watch?v=S262StTwkmoمن الكتلة هي الحصة التراكمية لجميع الموقعين الذين لديهم توقيعات المدرجة في الكتلة. وزن السلسلة هو مجموع أوزان الكتلة. علاوة على إجماع السلسلة الأثقل، نستخدم أداة نهائية تستخدم الشهادات لإنهاء الكتل. لتقليل تعقيد النظام، نحن نستخدم أداة نهائية لا تؤثر على قاعدة اختيار الشوكة بأي شكل من الأشكال، وبدلاً من ذلك يقدم فقط شروط القطع الإضافية، مثل تلك التي يتم قطعها مرة واحدة في الكتلة تم الانتهاء من الشوكة بواسطة الأداة النهائية، ومن المستحيل الحصول على شوكة ما لم تكن هناك نسبة كبيرة جدًا من إجمالي الحصة تم تخفيضها. إن Casper CBC عبارة عن أداة نهائية، ونحن كذلك النموذج حاليًا مع وضع Casper CBC في الاعتبار. نحن نعمل أيضًا على بروتوكول BFT منفصل يسمى TxFlow. في وقت عند كتابة هذه الوثيقة، من غير الواضح ما إذا كان سيتم استخدام TxFlow بدلاً من Casper سي بي سي. ومع ذلك، نلاحظ أن اختيار الأداة النهائية متعامد إلى حد كبير مع بقية التصميم. 3.3 إنتاج الكتلة يوجد في Nightshade دوران: منتجو الكتل وvalidators. في أي نقطة النظام يحتوي على منتجي الكتلة w، w = 100 في نماذجنا، وwv validators، في نموذجنا v = 100، wv = 10,000. النظام هو إثبات الحصة، مما يعني أن كلا من منتجي الكتل وvalidator لديهم عدد من العناصر الداخلية العملة (المشار إليها باسم "tokens") مقفلة لمدة زمنية تتجاوز بكثير الوقت الذي يقضونه في أداء واجباتهم في بناء السلسلة والتحقق من صحتها. كما هو الحال مع جميع أنظمة إثبات الحصة، ليس كل منتجي الكتلة وليس كذلك جميع wv validators هي كيانات مختلفة، حيث لا يمكن فرض ذلك. كل ومع ذلك، فإن منتجي الكتل w وwv validators لديهم قسم منفصل حصة. يحتوي النظام على n شظايا، n = 1000 في نموذجنا. كما ذكر في القسم 3.1، في Nightshade لا توجد سلاسل شظية، وبدلاً من ذلك يقوم جميع منتجي الكتل وvalidator ببناء blockchain واحد، والذي نشير إليه باسم السلسلة الرئيسية. يتم تقسيم حالة السلسلة الرئيسية إلى أجزاء n وكل كتلة المنتج وvalidator في أي لحظة قاموا فقط بتنزيل مجموعة فرعية من الحالة التي تتوافق مع بعض المجموعات الفرعية من القطع، والمعالجة فقط التحقق من صحة المعاملات التي تؤثر على تلك الأجزاء من الدولة. لكي تصبح منتجًا للكتل، يجب على أحد المشاركين في الشبكة أن يقوم بتأمين بعض الكتل الكبيرة مبلغ tokens (حصة). تتم صيانة الشبكة على فترات، حيث العصر هو فترة من الزمن بترتيب الأيام. المشاركون مع أكبر الرهانات في بداية حقبة معينة هي الكتلة المنتجين لتلك الحقبة. يتم تعيين كل منتج كتلة إلى قطع sw، (على سبيل المثال sw = 40، مما يجعل sww/n = 4 منتجي كتلة لكل قطعة). الكتلة يقوم المنتج بتنزيل حالة الجزء الذي تم تعيينه له قبل العصر يبدأ، وعلى مدار العصر يجمع المعاملات التي تؤثر على تلك القطعة، ويطبقها على الدولة. لكل كتلة b في السلسلة الرئيسية، ولكل قطعة s، هناك واحدة من تم تعيين منتجي الكتل إلى المسؤول عن إنتاج الجزء المتعلق ب إلى القشرة. الجزء من b المرتبط بالشظية يسمى قطعة، ويحتوي على قائمة المعاملات الخاصة بالجزء المراد تضمينه في b، بالإضافة إلى Merkleجذر الحالة الناتجة. b سيحتوي في النهاية على رأس صغير جدًا فقط القطعة، وهي جذر Merkle لجميع المعاملات المطبقة (انظر القسم 3.7.1 للحصول على تفاصيل دقيقة)، وجذر ميركل للحالة النهائية. غالبًا ما نشير في بقية الوثيقة إلى منتج الكتل المسؤولة عن إنتاج قطعة في وقت معين لقطعة معينة كمنتج قطعة. يعد منتج Chunk دائمًا أحد منتجي الكتل. يقوم منتجو الكتل ومنتجو القطع بتدوير كل كتلة وفقًا لذلك لجدول زمني محدد. منتجو الكتل لديهم طلب وينتجون بشكل متكرر كتل في هذا الترتيب. على سبيل المثال. إذا كان هناك 100 منتج كتلة، الكتلة الأولى المنتجون مسؤولون عن إنتاج الكتل 1، 101، 201 إلخ، والثاني هو المسؤول عن إنتاج 2، 102، 202 الخ). نظرًا لأن إنتاج القطع، على عكس إنتاج الكتل، يتطلب الصيانة الدولة، ولكل جزء فقط منتجو كتلة sww/n يحافظون على الدولة لكل قطعة، في المقابل، يتم تدوير منتجي كتل sww/n فقط لإنشاءها قطع. على سبيل المثال. مع الثوابت المذكورة أعلاه مع أربعة منتجين للكتل تم تعيينهم كل قطعة، سيقوم كل منتج كتلة بإنشاء قطع مرة واحدة كل أربع كتل. 3.4 ضمان توافر البيانات لضمان توفر البيانات، نستخدم أسلوبًا مشابهًا لأسلوب Polkadot الموصوفة في القسم 2.5.3. بمجرد أن ينتج منتج الكتلة قطعة، فإنه يقوم بإنشائها نسخة مشفرة للمحو باستخدام رمز الكتلة الأمثل (w, ⌊w/6 + 1⌋) قطعة. ثم يرسلون بعد ذلك قطعة واحدة من قطعة المحو المشفرة (نسميها هذه القطع أجزاء قطعة، أو أجزاء فقط) لكل منتج كتلة. نقوم بحساب شجرة ميركل التي تحتوي على جميع الأجزاء مثل الأوراق، و يحتوي رأس كل قطعة على جذر ميركل لهذه الشجرة. يتم إرسال الأجزاء إلى validators عبر رسائل onepart. كل رسالة من هذا القبيل يحتوي على رأس القطعة والترتيبي للجزء ومحتويات الجزء. ال تحتوي الرسالة أيضًا على توقيع منتج الكتلة الذي أنتج الملف قطعة ومسار ميركل لإثبات أن الجزء يتوافق مع الرأس ويتم إنتاجه بواسطة منتج الكتلة المناسب. بمجرد أن يتلقى منتج الكتلة كتلة السلسلة الرئيسية، فإنه يتحقق أولاً مما إذا كان ذلك صحيحًا أم لا تحتوي على رسائل مكونة من جزء واحد لكل قطعة مضمنة في الكتلة. إذا لم يكن كذلك، الكتلة لا تتم معالجة حتى يتم استرداد الرسائل المفقودة. بمجرد استلام كافة الرسائل المكونة من جزء واحد، يقوم منتج الكتلة بإحضار الملف الأجزاء المتبقية من أقرانه ويعيد بناء القطع التي يحتفظون بها الدولة. لا يقوم منتج الكتلة بمعالجة كتلة السلسلة الرئيسية إذا كانت لواحدة على الأقل القطعة المضمنة في الكتلة لا تحتوي على الرسالة المقابلة من جزء واحد، أو إذا كانت القطعة واحدة على الأقل تحافظ على الحالة التي لا يمكنها ذلك إعادة بناء القطعة بأكملها. لكي تكون قطعة معينة متاحة، يكفي أن يكون ⌊w/6⌋+1 من الكتلة المنتجون لديهم أجزائهم ويخدمونها. وهكذا، طالما أن عدد لا تتجاوز الجهات الفاعلة الضارة ⌊w/3⌋لا توجد سلسلة تحتوي على أكثر من نصف الكتلة يمكن أن يحتوي المنتجون الذين يقومون ببنائه على قطع غير متوفرة.الشكل 17: تحتوي كل كتلة على قطعة واحدة أو صفر قطعة لكل قطعة، وكل قطعة هو محو مشفرة. يتم إرسال كل جزء من قطعة المحو المشفرة إلى جهة معينة منتج الكتلة عبر رسالة خاصة من جزء واحد 3.4.1 التعامل مع منتجي الكتل الكسالى إذا كان لدى منتج الكتلة كتلة تفتقد رسالة مكونة من جزء واحد، فسيقومون بذلك قد يختار الاستمرار في التوقيع عليها، لأنه إذا انتهى الأمر بربط الكتلة بالسلسلة سيزيد من مكافأة منتج الكتلة. لا يوجد خطر على الكتلة المنتج لأنه من المستحيل إثبات لاحقًا أن منتج الكتلة لم يكن لديه الرسالة ذات الجزء الواحد. لمعالجة هذه المشكلة، نجعل كل قطعة منتجة عند إنشاء القطعة اختر لونًا (أحمر أو أزرق) لكل جزء من القطعة المشفرة المستقبلية، وقم بتخزينها القناع البتي للون المخصص في القطعة قبل تشفيرها. كل جزء تحتوي الرسالة بعد ذلك على اللون المخصص للجزء، ويتم استخدام اللون متى حساب جذر ميركل للأجزاء المشفرة. إذا انحرف منتج القطعة من البروتوكول، يمكن إثبات ذلك بسهولة، حيث لن يتم إثبات جذر Merkle تتوافق مع الرسائل ذات الجزء الواحد، أو الألوان الموجودة في الرسائل ذات الجزء الواحد تتوافق مع جذر Merkle ولن تتطابق مع القناع الموجود في القطعة. عندما يقوم منتج الكتلة بالتوقيع على الكتلة، فإنه يتضمن قناعًا نقطيًا لجميع العناصر الأجزاء الحمراء التي تلقوها مقابل القطع الموجودة في الكتلة. نشر ان قناع البت غير الصحيح هو سلوك قابل للقطع. إذا لم يتلق منتج الكتلة أ رسالة مكونة من جزء واحد، ليس لديهم طريقة لمعرفة لون الرسالة، و وبالتالي لديهم فرصة بنسبة 50٪ للتعرض للقطع إذا حاولوا التوقيع بشكل أعمى على كتلة. 3.5 تطبيق انتقال الدولة يختار منتجو القطعة فقط المعاملات التي سيتم تضمينها في القطعة ولكن لا تطبق انتقال الحالة عندما تنتج قطعة. في المقابل،

يحتوي رأس القطعة على جذر Merkle لحالة Merkelized كما كان من قبل يتم تطبيق المعاملات في القطعة. يتم تطبيق المعاملات فقط عندما تكون الكتلة كاملة تتضمن القطعة تتم معالجتها. يقوم المشارك بمعالجة الكتلة فقط إذا 1. تم استلام الكتلة السابقة ومعالجتها؛ 2. بالنسبة لكل قطعة، لا يحتفظ المشارك بالحالة التي يمتلكها رأيت الرسالة المكونة من جزء واحد؛ 3. بالنسبة لكل قطعة، يحافظ المشارك على الحالة لأنه يمتلك قطعة كاملة. بمجرد معالجة الكتلة، لكل قطعة يشارك فيها المشارك يحافظ على الحالة، ويقوم بتطبيق المعاملات وحساب الحالة الجديدة اعتبارًا من بعد تطبيق المعاملات، وبعد ذلك تصبح جاهزة للإنتاج قطع الكتلة التالية، إذا تم تخصيصها لأي قطعة، نظرًا لوجودها جذر ميركل للدولة المركلية الجديدة. 3.6 المعاملات والإيصالات عبر القطع إذا كانت المعاملة تحتاج إلى أن تؤثر على أكثر من جزء واحد، فيجب أن تكون متتالية يتم تنفيذها في كل قطعة على حدة. يتم إرسال المعاملة الكاملة إلى الجزء الأول متأثرة، وبمجرد تضمين المعاملة في قطعة هذه القطعة، و يتم تطبيقه بعد تضمين القطعة في كتلة، فإنه يولد ما يسمى بالإيصال المعاملة، التي يتم توجيهها إلى الجزء التالي الذي تحتاج المعاملة إليه يتم إعدامه. إذا كانت هناك حاجة لمزيد من الخطوات، تنفيذ معاملة الاستلام ينشئ معاملة استلام جديدة وما إلى ذلك. 3.6.1 استلام المعاملة مدى الحياة من المستحسن أن يتم تطبيق معاملة الاستلام في الكتلة التي تتبع الكتلة التي تم إنشاؤها فيها مباشرة. معاملة الاستلام فقط تم إنشاؤها بعد استلام الكتلة السابقة وتطبيقها من قبل منتجي الكتلة التي تحافظ على القطعة الأصلية، ويجب أن تكون معروفة بحلول الوقت الذي يتم إنتاج قطعة الكتلة التالية بواسطة منتجي الكتلة للوجهة شظية. وبالتالي، يجب إرسال الإيصال من الجزء المصدر إلى جزء الوجهة في الإطار الزمني القصير بين هذين الحدثين. دع A يكون آخر كتلة تم إنتاجها والتي تحتوي على معاملة t التي تولد إيصالًا r. دع B يكون الكتلة المنتجة التالية (أي الكتلة التي تحتوي على A كـ كتلته السابقة) التي نريد أن تحتوي على r. دع t يكون في الكسرة a و r يكون في القشرة ب. عمر الإيصال، الموضح أيضًا في الشكل 18، هو كما يلي: إنتاج وتخزين الإيصالات. منتج القطعة CPA للقطعة يتلقى a الكتلة A، ويطبق المعاملة t وينشئ الإيصال r. اتفاق السلام الشامل ثم يقوم بتخزين جميع هذه الإيصالات المنتجة في وحدة التخزين الداخلية الدائمة المفهرسة بواسطة معرف القطعة المصدر.توزيع الإيصالات. بمجرد أن يصبح CPA جاهزًا لإنتاج القطعة الجزء "أ" للكتلة "ب"، يقومون بإحضار جميع الإيصالات التي تم إنشاؤها عن طريق تطبيق المعاملات من الكتلة "أ" للجزء "أ"، وإدراجها في القطعة للجزء "شراد" a في الكتلة B. بمجرد إنشاء هذه القطعة، ينتج cpa تشفيرًا للمسح الخاص بها الإصدار وجميع رسائل onepart المقابلة. يعرف CPA منتجي الكتل الذين يحتفظون بالحالة الكاملة لأي شظايا. لمنتج كتلة معينة تتضمن bp cpa الإيصالات الناتجة عن تطبيق المعاملات في الكتلة A بالنسبة للقطعة a التي تحتوي على أي من القطع التي تهتم بها شركة bp كوجهة لها في الرسالة المكونة من جزء واحد عندما قاموا بتوزيع القطعة الخاصة بالجزء "أ" في الكتلة "ب". (انظر الشكل 17، الذي يوضح الإيصالات المضمنة في الرسالة المكونة من جزء واحد). استلام الإيصالات. تذكر أن المشاركين (منتجي الكتل وvalidators) لا يقومون بمعالجة الكتل حتى يكون لديهم رسائل مكونة من جزء واحد لكل قطعة مدرجة في الكتلة. وبالتالي، بحلول الوقت الذي يقوم فيه أي مشارك معين بتطبيق المجموعة B، يكون لديه جميع الرسائل ذات الجزء الواحد التي تتوافق معها قطع في B، وبالتالي لديهم جميع الإيصالات الواردة التي تحتوي على القطع يحتفظ المشارك بالحالة كوجهة له. عند تطبيق انتقال الحالة لجزء معين، يقوم المشارك بتطبيق كلا الإيصالات التي جمعوها للكسرة في الرسائل الواحدة، فضلا عن الجميع المعاملات المدرجة في القطعة نفسها. الشكل 18: عمر معاملة الاستلام 3.6.2 التعامل مع عدد كبير جدًا من الإيصالات من الممكن أن يكون عدد الإيصالات التي تستهدف جزءًا معينًا في ملف كتلة معينة كبيرة جدًا بحيث لا يمكن معالجتها. على سبيل المثال، تأمل الشكل 19، في حيث تقوم كل معاملة في كل جزء بإنشاء إيصال يستهدف الجزء 1. بحلول الكتلة التالية، يكون عدد الإيصالات التي تحتاج القطعة 1 إلى معالجتها هو يمكن مقارنته بالحمل الذي تمت معالجته لجميع القطع مجتمعة أثناء التعامل معها الكتلة السابقة.

الشكل 19: إذا كانت كافة الإيصالات تستهدف نفس الجزء، فقد لا يكون لدى الجزء نفس الشيء القدرة على معالجتها ولمعالجتها نستخدم تقنية مشابهة لتلك المستخدمة في QuarkChain 9. على وجه التحديد، بالنسبة لكل جزء، توجد الكتلة الأخيرة B وآخر جزء داخل ذلك يتم تسجيل الكتلة التي تم تطبيق الإيصالات منها. عندما تكون القشرة الجديدة تم إنشاؤه، ويتم تطبيق الإيصال بالترتيب أولاً من الأجزاء المتبقية في B، ثم في الكتل التي تتبع B، حتى تمتلئ القطعة الجديدة. تحت العادي الظروف مع حمولة متوازنة ستؤدي بشكل عام إلى جميع الإيصالات يتم تطبيقها (وبالتالي سيتم تسجيل الجزء الأخير من الكتلة الأخيرة كل قطعة)، ولكن في الأوقات التي يكون فيها الحمل غير متوازن، وخاصة تتلقى Shard العديد من الإيصالات بشكل غير متناسب، وهذا الأسلوب يسمح لهم بذلك تتم معالجتها مع احترام الحدود المفروضة على عدد المعاملات المدرجة. لاحظ أنه إذا ظل هذا الحمل غير المتوازن لفترة طويلة، فإن التأخير من إنشاء الإيصال حتى يتمكن التطبيق من الاستمرار في النمو إلى أجل غير مسمى. واحد طريقة معالجتها هي إسقاط أي معاملة تؤدي إلى إنشاء إيصال يستهدف أ جزء يحتوي على تأخير معالجة يتجاوز بعض الثوابت (على سبيل المثال، عصر واحد). خذ بعين الاعتبار الشكل 20. حسب الكتلة B، لا يمكن للجزء 4 معالجة جميع الإيصالات، لذلك فهو يعالج فقط إنشاء الإيصالات من الجزء 3 حتى الجزء A، و يسجل ذلك. في الكتلة C، يتم تضمين الإيصالات حتى الجزء 5 في الكتلة B، و ثم عن طريق الكتلة D، يتم اللحاق بالجزء، ومعالجة جميع الإيصالات المتبقية الكتلة B وجميع الإيصالات من الكتلة C. 3.7 التحقق من صحة القطع لا يمكن التحقق من صحة القطعة التي تم إنتاجها لجزء معين (أو كتلة جزء تم إنتاجها لسلسلة جزء معينة في النموذج الذي يحتوي على سلاسل جزء) فقط من خلال 9شاهد حلقة السبورة البيضاء مع QuarkChain هنا: https://www.youtube.com/watch? v=opEtG6NM4x4، حيث تتم مناقشة أسلوب المعاملات المتقاطعة، من بين أمور أخرى الأشياءالشكل 20: تأخر معالجة الإيصالات المشاركين الذين يحافظون على الدولة. يمكن أن يكونوا منتجي كتل، validators، أو مجرد شهود خارجيين قاموا بتنزيل الحالة والتحقق من صحة الجزء فيها التي يقومون بتخزين الأصول. في هذه الوثيقة نفترض أن غالبية المشاركين لا يستطيعون التخزين الدولة لجزء كبير من القطع. ومن الجدير بالذكر، مع ذلك، أن هناك blockchains مقسمة تم تصميمها مع افتراض ذلك يتمتع معظم المشاركين بالقدرة على تخزين الحالة والتحقق من صحتها الشظايا، مثل QuarkChain. نظرًا لأن جزءًا صغيرًا فقط من المشاركين لديهم الحالة اللازمة للتحقق من صحة القطعة قطع، فمن الممكن أن التكيف الفاسدة فقط المشاركين الذين لديهم الحالة، وتطبيق انتقال حالة غير صالح. تم اقتراح تصميمات تقسيم متعددة لأخذ عينات من validators كل بضعة أيام أيام، وخلال يوم أي كتلة في سلسلة الكسرة تحتوي على أكثر من 2/3 يتم النظر على الفور في توقيعات validators المخصصة لهذه القطعة نهائي. مع مثل هذا النهج، يحتاج الخصم المتكيف فقط إلى إفساد 2n/3+1 من validators في سلسلة الجزء لتطبيق انتقال حالة غير صالح، والذي، ورغم أنه من الصعب تحقيق ذلك على الأرجح، إلا أنه ليس مستوى من الأمان كافيًا للجمهور blockchain. كما تمت مناقشته في القسم 2.3، فإن النهج الشائع هو السماح بفترة زمنية معينة بعد إنشاء الكتلة لأي مشارك لديه حالة (سواء كانت إنه منتج كتلة، validator، أو مراقب خارجي) للطعن في صحته. ويطلق على هؤلاء المشاركين اسم الصيادين. لكي يتمكن الصياد من ذلك تحدي كتلة غير صالحة، يجب التأكد من أن هذه الكتلة متاحة ل لهم. تمت مناقشة توفر البيانات في Nightshade في القسم 3.4. في Nightshade، بمجرد إنتاج كتلة، لا يتم التحقق من صحة القطع من قبل أي شخص باستثناء منتج القطعة الفعلي. على وجه الخصوص، منتج الكتلة ذلك اقترح أن الكتلة بطبيعة الحال لا تحتوي على الحالة لمعظم القطع، ولم يكن قادرا على التحقق من صحة القطع. عندما يتم إنتاج الكتلة التالية، فإنها تحتوي على شهادات (انظر القسم 3.2) من منتجي الكتل المتعددين وvalidators، ولكن بما أن غالبية منتجي الكتل وvalidators لا يحافظون على الحالة بالنسبة لمعظم القطع أيضًا، فإن الكتلة التي تحتوي على قطعة واحدة غير صالحة ستجمع أكثر من نصف الشهادات بشكل ملحوظ وستظل على الأثقل سلسلة. لمعالجة هذه المشكلة، نسمح لأي مشارك يحافظ على حالة قطعة لإرسال تحدي على السلسلة لأي قطعة غير صالحة تم إنتاجها في ذلك شظية. 3.7.1 تحدي صلاحية الدولة بمجرد اكتشاف أحد المشاركين أن مجموعة معينة غير صالحة، فإنه يحتاج إلى تقديم دليل على أن المجموعة غير صالحة. نظرًا لأن غالبية المشاركين في الشبكة لا يحافظون على حالة القطعة التي توجد بها القطعة غير الصالحة يجب أن يحتوي الدليل على معلومات كافية لتأكيد الكتلة باطل دون وجود الدولة. قمنا بتعيين حد Ls لمقدار الحالة (بالبايت) لمعاملة واحدة يمكن القراءة أو الكتابة بشكل تراكمي. أي معاملة تمس أكثر من Ls تعتبر الدولة غير صالحة. تذكر من القسم 3.5 أن القطعة في كتلة معينة B تحتوي فقط على المعاملات التي سيتم تطبيقها، ولكن لا جذر الدولة الجديدة. جذر الحالة المتضمن في القطعة في الكتلة B هو الحالة root قبل تطبيق مثل هذه المعاملات، ولكن بعد تطبيق المعاملات من القطعة الأخيرة في نفس الكسرة قبل الكتلة B. ممثل خبيث قد تتضمن الرغبة في تطبيق انتقال حالة غير صالح جذر حالة غير صحيح في الكتلة B التي لا تتوافق مع جذر الحالة الناتج عن التقديم المعاملات في القطعة السابقة. نقوم بتوسيع المعلومات التي يتضمنها منتج القطعة في القطعة. بدلاً من مجرد تضمين الحالة بعد تطبيق كافة المعاملات، يتم بدلاً من ذلك يتضمن جذر الحالة بعد تطبيق كل مجموعة متجاورة من المعاملات قراءة وكتابة بايتات Ls من الحالة بشكل جماعي. بهذه المعلومات ل صياد لخلق التحدي المتمثل في تطبيق انتقال الدولة بشكل غير صحيح عليه يكفي العثور على أول جذر حالة غير صالح، ويتضمن فقط Ls بايت من الحالة التي تتأثر بالمعاملات بين جذر الحالة الأخير (والذي كان صالح) وجذر الحالة الحالية مع أدلة ميركل. ثم أي مشارك يمكن التحقق من صحة المعاملات في المقطع والتأكد من أن القطعة موجودة غير صالح. وبالمثل، إذا حاول منتج القطعة تضمين المعاملات التي تقرأ واكتب أكثر من Ls بايت من الحالة، فالتحدي يكفي أن تشمله البايتات الأولى التي يلامسها باستخدام أدلة ميركل، والتي ستكون كافية للقيام بذلك قم بتطبيق المعاملات والتأكد من أن هناك لحظة يتم فيها المحاولة قراءة أو كتابة محتوى يتجاوز بايت Ls.

3.7.2 الصيادون والمعاملات السريعة المتقاطعة كما تمت مناقشته في القسم 2.3، بمجرد أن نفترض أن قطع الكسر (أو الكسر يمكن أن تكون الكتل الموجودة في النموذج ذات سلاسل الأجزاء) غير صالحة وتشكل تحديًا خلال هذه الفترة، فإنه يؤثر سلبًا على النهاية، وبالتالي على التواصل عبر الأجزاء. في على وجه الخصوص، لا يمكن التأكد من جزء الوجهة لأي عملية نقل متقاطعة تعتبر قطعة أو كتلة القطعة الأصلية نهائية حتى تنتهي فترة التحدي (انظر الشكل 21). الشكل 21: انتظار فترة التحدي قبل تقديم الإيصال وطريقة معالجتها بطريقة تجعل المعاملات متقاطعة اللحظية هي أن لا تنتظر قطعة الوجهة فترة التحدي بعد نشر معاملة الجزء المصدر، وتطبيق معاملة الاستلام على الفور، ولكن بعد ذلك قم باستعادة جزء الوجهة مع المصدر shard إذا تبين لاحقًا أن القطعة أو الكتلة الأصلية غير صالحة (انظر الشكل 1). 22). وهذا ينطبق بشكل طبيعي جدًا على تصميم Nightshade الذي توجد فيه القشرة السلاسل ليست مستقلة، ولكن بدلًا من ذلك يتم نشر جميع أجزاء الكسر معًا في نفس كتلة السلسلة الرئيسية. إذا تم العثور على أي قطعة غير صالحة، تعتبر الكتلة بأكملها التي تحتوي على تلك القطعة غير صالحة، وجميع الكتل المبنية عليها أعلى منه. انظر الشكل 23. يوفر كلا النهجين المذكورين أعلاه الذرية على افتراض أن التحدي الفترة طويلة بما فيه الكفاية. نحن نستخدم النهج الأخير نظرًا لأن توفير معاملات متقاطعة سريعة في ظل الظروف العادية يفوق الإزعاج تم التراجع عن جزء الوجهة بسبب انتقال حالة غير صالح في أحد شظايا المصدر، وهو حدث نادر للغاية. 3.7.3 إخفاء validators إن وجود التحديات يقلل بالفعل بشكل كبير من احتمالية حدوث ذلك الفساد التكيفي، منذ الانتهاء من قطعة مع منشور انتقال حالة غير صالحالشكل 22: تطبيق الإيصالات على الفور وإرجاع الوجهة chain إذا كانت السلسلة المصدر تحتوي على كتلة غير صالحة الشكل 23: تحدي الصياد في الباذنجان فترة التحدي التي يحتاجها الخصم المتكيف لإفساد جميع المشاركين التي تحافظ على حالة الجزء، بما في ذلك كافة validators. إن تقدير احتمالية حدوث مثل هذا الحدث أمر معقد للغاية، حيث لا تم نشر blockchain لفترة كافية لمحاولة أي هجوم من هذا القبيل. ونحن نرى أن الاحتمال، على الرغم من كونه منخفضا للغاية، لا يزال كافيا كبير بالنسبة لنظام من المتوقع أن ينفذ عدة ملايين من المعاملات و إدارة العمليات المالية في جميع أنحاء العالم. هناك سببان رئيسيان لهذا الاعتقاد: 1. معظم validators من سلاسل إثبات الملكية والقائمين بالتعدين في

يتم تحفيز سلاسل إثبات العمل في المقام الأول من خلال الاتجاه الصعودي المالي. إذا فالخصم المتكيف يقدم لهم أموالاً أكثر من العائد المتوقع من العمل بأمانة، فمن المعقول أن نتوقع أن العديد من validators سوف يقبل العرض. 2. تقوم العديد من الكيانات بالتحقق من صحة سلاسل إثبات الملكية بشكل احترافي ومن المتوقع أن تكون هناك نسبة كبيرة من الحصة في أي سلسلة من مثل هذه الجهات. عدد هذه الكيانات صغير بما يكفي ل الخصم المتكيف للتعرف على معظمهم شخصيًا والحصول على وحسن فهم ميلهم إلى الفساد. نحن نخطو خطوة أخرى نحو تقليل احتمالية الفساد التكيفي عن طريق إخفاء validators المخصصة لأي جزء. الفكرة هي تشبه عن بعد طريقة Algorand [5] لإخفاء validators. من المهم ملاحظة أنه حتى لو تم إخفاء validator، كما في Algorand أو كما هو موضح أدناه، لا يزال الفساد التكيفي ممكنًا من الناحية النظرية. بينما الخصم المتكيف لا يعرف المشاركين الذين سيقومون بالإنشاء أو التحقق من صحتهم كتلة أو قطعة، يعرف المشاركون أنفسهم أنهم سيؤدونها مثل هذه المهمة ويكون لديك دليل التشفير على ذلك. وهكذا يستطيع العدو يبثون نيتهم في الفساد، ويدفعون لأي مشارك سيقدم ذلك مثل هذا الدليل التشفير. ومع ذلك، نلاحظ أنه بما أن الخصم لا يفعل ذلك تعرف على validators المخصصة للجزء الذي يريدون إفساده، فهم ليس لديهم خيار آخر سوى الإعلان عن نيتهم في إفساد جزء معين المجتمع بأكمله. عند هذه النقطة يكون الأمر مفيدًا اقتصاديًا لأي شخص صادق يقوم المشارك بتدوير عقدة كاملة تتحقق من صحة تلك القطعة، نظرًا لوجود ارتفاع فرصة ظهور كتلة غير صالحة في تلك القطعة، وهي فرصة لذلك قم بإنشاء تحدي وجمع المكافأة المرتبطة به. لكي لا نكشف عن validators المخصصة لجزء معين، فإننا نفعل ذلك ما يلي (انظر الشكل 24): استخدام VRF للحصول على المهمة. في بداية كل عصر لكل منهما يستخدم validator VRF للحصول على قناع نقطي للأجزاء التي تم تعيين validator لها. سيحتوي قناع البت لكل validator على بتات Sw (راجع القسم 3.3 للتعرف على من سو). يقوم validator بعد ذلك بجلب حالة الأجزاء المقابلة، و خلال فترة كل كتلة مستلمة، يتم التحقق من صحة القطع المقابلة إلى الأجزاء التي تم تعيين validator لها. قم بالتسجيل على الكتل بدلاً من القطع. نظرًا لأن تعيين الأجزاء مخفي، لا يمكن لـ validator تسجيل الدخول على القطع. بدلا من ذلك فإنه يوقع دائما على كامل block، وبالتالي لا يكشف عن الأجزاء التي يتحقق من صحتها. على وجه التحديد، عندما يتلقى validator كتلة ويتحقق من صحة جميع المقاطع، فإنه إما يقوم بإنشاء رسالة يشهد أن جميع القطع الموجودة في جميع الأجزاء التي تم تعيين validator لها هي صالحة (دون الإشارة بأي شكل من الأشكال إلى ماهية تلك الأجزاء)، أو رسالة مفادها يحتوي على دليل على انتقال حالة غير صالح إذا كان أي جزء غير صالح. انظر القسم 3.8 للحصول على تفاصيل حول كيفية تجميع هذه الرسائل، القسم 3.7.4 لـ التفاصيل حول كيفية منع validators من النسخ الاحتياطي على الرسائل الواردة من validators الأخرى، والقسم 3.7.5 للحصول على تفاصيل حول كيفية المكافأة والمعاقبة validators في حالة حدوث اختبار ناجح لنقل الحالة غير الصالحة بالفعل.الشكل 24: إخفاء validators في الباذنجان 3.7.4 الالتزام وكشف إحدى المشكلات الشائعة في validators هي أن validator يمكنه تخطي تنزيل الحالة والتحقق فعليًا من صحة المقاطع والكتل، وبدلاً من ذلك راقب الشبكة، وشاهد ما يرسله validators الآخرون ويكررونه الرسائل. validator الذي يتبع مثل هذه الإستراتيجية لا يوفر أي شيء إضافي الأمن للشبكة، ولكن يجمع المكافآت. الحل الشائع لهذه المشكلة هو أن يقدم كل validator دليلاً أنهم قاموا بالفعل بالتحقق من صحة الكتلة، على سبيل المثال من خلال توفير تتبع فريد من تطبيق انتقال الدولة، ولكن مثل هذه البراهين تزيد التكلفة بشكل كبير من التحقق من الصحة. الشكل 25: كشف الالتزام

وبدلاً من ذلك، نجعل validators يلتزم أولاً بنتيجة التحقق (إما الرسالة التي تشهد بصحة القطع، أو إثبات بطلانها انتقال الحالة)، انتظر فترة معينة، وعندها فقط تكشف عن نتيجة التحقق الفعلية، كما هو موضح في الشكل 25. لا تتقاطع فترة الالتزام مع فترة الكشف، وبالتالي لا يستطيع validator الكسول تقليد validators الصادق. علاوة على ذلك، إذا كان validator غير أمين ملتزمًا برسالة تشهد على ذلك صلاحية القطع المخصصة، وكانت قطعة واحدة على الأقل غير صالحة، بمجرد أن تكون كذلك تبين أن القطعة غير صالحة ولا يمكن لـ validator تجنب التقطيع، نظرًا لأن، كما نبين في القسم 3.7.5، الطريقة الوحيدة لعدم التعرض للخسارة في مثل هذه الحالة هو تقديم رسالة تحتوي على دليل على أن الحالة الانتقالية غير صالحة يطابق الالتزام. 3.7.5 التعامل مع التحديات كما تمت مناقشته أعلاه، بمجرد أن يتلقى validator كتلة تحتوي على مقطع غير صالح، يقومون أولاً بإعداد دليل على انتقال الحالة غير الصالح (انظر القسم 3.7.1)، ثم التزم بمثل هذا الدليل (انظر 3.7.4)، وبعد فترة اكشف عن التحدي. بمجرد تضمين التحدي الذي تم الكشف عنه في الكتلة، يحدث ما يلي: 1. جميع انتقالات الحالة التي حدثت من الكتلة التي تحتوي على قطعة غير صالحة حتى يتم الحصول على الكتلة التي تم تضمين التحدي المكشوف فيها باطل. الحالة قبل الكتلة التي تتضمن التحدي المكشوف تعتبر نفس الحالة قبل الكتلة التي تحتوي عليها القطعة غير الصالحة 2. خلال فترة زمنية معينة، يجب على كل validator أن يكشف عن قناعه النقطي من القطع التي التحقق من صحتها. نظرًا لأنه يتم إنشاء قناع البت عبر VRF، إذا تم تعيينهم إلى الجزء الذي كان به انتقال حالة غير صالح، هم لا يمكن تجنب الكشف عنها. أي validator يفشل في الكشف عن قناع البت من المفترض أن يتم تعيينها للقطعة. 3. كل validator يتم العثور عليه بعد هذه الفترة مخصصًا للكسر، التي التزمت ببعض نتائج التحقق من الصحة للكتلة التي تحتوي على ملف قطعة غير صالحة والتي لم تكشف عن دليل على انتقال الحالة غير الصالحة الذي يتوافق مع التزامهم مقطوع. 4. يحصل كل validator على مهمة أجزاء جديدة، ويتم جدولة حقبة جديدة للبدء بعد مرور بعض الوقت الكافي لجميع validators لتنزيل الملف الحالة، كما هو موضح في الشكل 26. لاحظ أنه منذ اللحظة التي تكشف فيها validators عن الأجزاء المخصصة لها حتى يبدأ العصر الجديد، يتم تقليل أمان النظام منذ ذلك الحين تم الكشف عن مهمة القطع. يحتاج المشاركون في الشبكة إلى الاحتفاظ بها في الاعتبار أثناء استخدام الشبكة خلال هذه الفترة. 3.8 تجميع التوقيع لكي يعمل نظام يحتوي على مئات القطع بشكل آمن، نريد أن يكون لدينا طلب 10000 أو أكثر validators. كما تمت مناقشته في القسم 3.7، نريد كلًا منهماالشكل 26: التعامل مع التحدي validator لنشر التزام برسالة معينة وتوقيع في المتوسط مرة واحدة لكل كتلة. حتى لو كانت رسائل الالتزام هي نفسها، فإن تجميع مثل هذا كان من الممكن أن يكون توقيع BLS والتحقق من صحته مكلفًا للغاية. لكن من الطبيعي أن رسائل الالتزام والكشف ليست هي نفسها عبر validators، وبالتالي نحتاج إلى طريقة ما لتجميع هذه الرسائل والتوقيعات في ملف واحد الطريقة التي تسمح للتحقق السريع في وقت لاحق. النهج المحدد الذي نستخدمه هو ما يلي: ينضم المدققون إلى منتجي الكتل. منتجو الكتلة معروفون بعض الوقت قبل بدء العصر، حيث أنهم يحتاجون إلى بعض الوقت لتنزيل الملف الحالة قبل بدء العصر، وعلى عكس validators فإن منتجي الكتل هم غير مخفي. كل منتج كتلة لديه فتحات v validator. يقدم المصادقون يتم إدراج المقترحات خارج السلسلة لمنتجي الكتل كواحدة من مشاريعهم v validators. إذا رغب منتج الكتلة في تضمين validator، فعليه إرسال أ المعاملة التي تحتوي على الطلب الأولي خارج السلسلة من validator، و توقيع منتج الكتلة الذي يجعل validator ينضم إلى منتج الكتلة. لاحظ أن validators المخصصة لمنتجي الكتل ليس بالضرورة التحقق من صحة نفس القطع التي ينتجها منتج الكتلة. إذا أ تم تقديم validator للانضمام إلى العديد من منتجي الكتل، فقط المعاملة من سوف ينجح منتج الكتلة الأول. يقوم منتجو الكتل بجمع الالتزامات. يقوم منتج الكتلة باستمرار بجمع رسائل الالتزام والكشف من validators. بمجرد تجميع عدد معين من هذه الرسائل، يقوم منتج الكتلة بحساب Merkle شجرة هذه الرسائل، ويرسل إلى كل validator جذر Merkle و مسار ميركل إلى رسالتهم. يقوم validator بالتحقق من صحة المسار وتسجيل الدخول جذر ميركل. يقوم منتج الكتلة بعد ذلك بتجميع توقيع BLS على ملف جذر Merkle من validators، وينشر فقط جذر Merkle و التوقيع المتراكم يوقع منتج الكتلة أيضًا على صلاحية التوقيع المتعدد باستخدام توقيع ECDSA الرخيص. إذا لم يكن التوقيع المتعدد كذلك مطابقة جذر Merkle الذي تم إرساله أو قناع البت الخاص بـ validators المشاركة، فهو سلوك قابل للتقطيع. عند مزامنة السلسلة، أحد المشاركين يمكن اختيار التحقق من صحة جميع توقيعات BLS من validators (وهو أمر مكلف للغاية لأنه يتضمن تجميع مفاتيح validators العامة)، أو فقطتوقيعات ECDMA من منتجي الكتل وتعتمد على حقيقة أن لم يتم تحدي منتج الكتلة أو قطعه. استخدام المعاملات عبر السلسلة وإثباتات ميركل للتحديات. ذلك يمكن ملاحظة أنه لا قيمة لكشف الرسائل من validators إذا كان الجواب لا تم اكتشاف انتقال حالة غير صالح. فقط الرسائل التي تحتوي على الفعلي يجب الكشف عن إثباتات انتقال الحالة غير الصالحة، وذلك بالنسبة لمثل هذه الرسائل فقط يجب أن يُظهر أنها تتطابق مع الالتزام السابق. الرسالة تحتاج إلى يتم الكشف عنها لغرضين: 1. للبدء فعليًا في التراجع عن السلسلة إلى اللحظة التي سبقت انتقال الحالة غير صالح (انظر القسم 3.7.5). 2. لإثبات أن validator لم يحاول إثبات صحة قطعة غير صالحة وفي كلتا الحالتين لا بد من معالجة مسألتين: 1. لم يتم تضمين الالتزام الفعلي في السلسلة، بل تم تضمين جذر Merkle فقط الالتزام مجمعة مع رسائل أخرى. يحتاج validator إلى استخدام مسار Merkle المقدم من منتج الكتلة والتزامه الأصلي به إثبات أنهم ملتزمون بالتحدي. 2. من الممكن أن تكون جميع validators المخصصة للجزء غير صالحة يحدث أن يتم تعيين انتقال الحالة إلى منتجي الكتل الفاسدين يقومون بمراقبةهم. للتغلب على ذلك، نسمح لهم بتقديم كشفهم كمعاملة منتظمة على السلسلة وتجاوز التجميع. هذا الأخير مسموح به فقط لإثباتات انتقال الحالة غير الصالحة، وهي نادر للغاية، وبالتالي لا ينبغي أن يؤدي إلى إرسال بريد عشوائي إلى الكتل. والمسألة الأخيرة التي تحتاج إلى معالجة هي أن منتجي الكتل قادرون على ذلك اختر عدم المشاركة في تجميع الرسائل أو فرض رقابة متعمدة على validators. نحن نجعلها غير مواتية اقتصاديًا، من خلال صنع الكتلة مكافأة المنتج تتناسب مع عدد validators المخصص لهم. نحن لاحظ أيضًا أنه نظرًا لأن منتجي الكتل بين العصور يتقاطعون إلى حد كبير (منذ ذلك الحين إنه دائمًا أعلى المشاركين ذوي أعلى حصة)، يمكن لـ validators التمسك إلى حد كبير بالعمل مع نفس منتجي الكتل، وبالتالي تقليل المخاطر من التعيين إلى منتج الكتل الذي فرض رقابة عليهم في الماضي. 3.9 سلسلة اللقطات نظرًا لأنه يتم إنتاج الكتل الموجودة على السلسلة الرئيسية بشكل متكرر جدًا، فقد تم تنزيلها قد يصبح التاريخ الكامل باهظ الثمن بسرعة كبيرة. علاوة على ذلك، منذ كل تحتوي الكتلة على توقيع BLS لعدد كبير من المشاركين، وقد يصبح مجرد تجميع المفاتيح العامة للتحقق من التوقيع أمرًا محظورًا مكلفة كذلك. أخيرًا، نظرًا لأنه في المستقبل المنظور، من المحتمل أن يظل Ethereum 1.0 واحدًا من أكثر blockchains استخدامًا، والتي تتمتع بطريقة مفيدة لنقل الأصول منها

يعد القرب من Ethereum أحد المتطلبات، واليوم يتم التحقق من توقيعات BLS لضمان ذلك صلاحية الكتل القريبة من جانب Ethereum غير ممكنة. يمكن أن تحتوي كل كتلة في سلسلة Nightshade الرئيسية بشكل اختياري على Schnorr التوقيع المتعدد على رأس الكتلة الأخيرة التي تضمنت مثل شنور التوقيع المتعدد. نحن نسمي هذه الكتل كتل لقطة. الكتلة الأولى من يجب أن يكون كل عصر عبارة عن كتلة لقطة. أثناء العمل على مثل هذا التوقيع المتعدد، يجب على منتجي الكتل أيضًا تجميع توقيعات BLS الخاصة بـ validators في كتلة اللقطة الأخيرة، وقم بتجميعها بنفس الطريقة الموضحة في القسم 3.8. نظرًا لأن مجموعة منتجي الكتل ثابتة طوال العصر، يتم التحقق من صحتها تكفي فقط مجموعات اللقطات الأولى في كل عصر على افتراض عدم وجود ذلك تشير نسبة كبيرة من منتجي الكتل وvalidator إلى تواطؤهم وإنشاءهم شوكة. يجب أن تحتوي الكتلة الأولى من العصر على معلومات كافية للحساب منتجو الكتل و validators لهذا العصر. نطلق على السلسلة الفرعية للسلسلة الرئيسية التي تحتوي على اللقطة فقط كتل سلسلة لقطة. يعد إنشاء توقيع متعدد لشنور عملية تفاعلية، ولكن بما أننا تحتاج فقط إلى تنفيذها بشكل غير متكرر، بغض النظر عن مدى عدم فعاليتها سوف يكفي. يمكن التحقق من صحة التوقيعات المتعددة لشنور بسهولة على Ethereum، وبالتالي توفير الأساسيات الحاسمة لطريقة آمنة لأداء cross-blockchain الاتصالات. للمزامنة مع السلسلة القريبة، يحتاج المرء فقط إلى تنزيل جميع اللقطات الكتل والتأكد من صحة توقيعات شنور (اختياريًا أيضًا التحقق من توقيعات BLS الفردية الخاصة بـ validators)، ثم المزامنة فقط كتل السلسلة الرئيسية من كتلة اللقطة الأخيرة.

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.

خاتمة

ناقشنا في هذه الوثيقة أساليب بناء blockchains و غطت تحديين رئيسيين مع النهج الحالي، وهما صلاحية الدولة وتوافر البيانات. ثم قدمنا ​​Nightshade، وهو تصميم مقسم صلاحيات NEAR البروتوكول. التصميم قيد التنفيذ، إذا كان لديك تعليقات أو أسئلة أو ملاحظات في هذا المستند، يرجى الانتقال إلى https://near.chat.