Polkadot 백서

Polkadot

원문

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

uration status; this way a failed attempt to post a transaction to a stalled destination may be reported synchronously. (Though since no return path exists, if a secondary trans- action failed for that reason, it could not be reported back to the original caller and some other means of recovery would have to take place.) 5.5. Polkadot and Ethereum. Due to Ethereum’s Tur- ing completeness, we expect there is ample opportu- nity for Polkadot and Ethereum to be interoperable with each other, at least within some easily deducible secu- rity bounds. In short, we envision that transactions from Polkadot can be signed by validators and then fed into 5Such a task might be shared between validators or could become the designate task of a set of heavily bonded validators known as availability guarantors . POLKADOT: VISION FOR A HETEROGENEOUS MUL TI-CHAIN FRAMEWORK DRAFT 1 8 Ethereum where they can be interpreted and enacted by a transaction-forwarding contract. In the other direction, we foresee the usage of specially formatted logs (events) coming from a “break-out contract” to allow a swift veri- fication that a particular message should be forwarded. 5.5.1. Polkadot to Ethereum. Through the choice of a BFT consensus mechanism with validators formed from a set of stakeholders determined through an approval voting mechanism, we are able to get a secure consensus with an infrequently changing and modest number of validators. In a system with a total of 144 validators, a block time of 4 seconds and a 900-block finality (allowing for malicious behaviour such as double-votes to be reported, punished and repaired), the validity of a block can reasonably be considered proven through as little as 97 signatures (two- thirds of 144 plus one) and a following 60-minute verifica- tion period where no challenges are deposited. Ethereum is able to host a “break-in contract” which can maintain the 144 signatories and be controlled by them. Since elliptic curve digital signature (ECDSA) re- covery takes only 3,000 gas under the EVM, and since we would likely only want the validation to happen on a super-majority of validators (rather than full unanimity), the base cost of Ethereum confirming that an instruction was properly validated as coming from the Polkadot net- work would be no more than 300,000 gas—a mere 6% of the total block gas limit at 5.5M. Increasing the num- ber of validators (as would be necessary for dealing with dozens of chains) inevitably increases this cost, however it is broadly expected for Ethereum’s transaction band- width to grow over time as the technology matures and infrastructure improves. Together with the fact that not all validators need to be involved (e.g. only the highest staked validators may be called upon for such a task) the limits of this mechanism extend reasonably well. Assuming a daily rotation of such validators (which is fairly conservative—weekly or even monthly may be ac- ceptable), then the cost to the network of maintaining this Ethereum-forwarding bridge would be around 540,000 gas per day or, at present gas prices, $ 45 per year. A ba- sic transaction forwarded alone over the bridge would cost around $ 0.11; additional contract computation would cost more, of course. By buffering and bundling transactions together, the break-in authorisation costs can easily be shared, reducing the cost per transaction substantially; if 20 transactions were required before forwarding, then the cost for forwarding a basic transaction would fall to around $ 0.01. One interesting, and cheaper, alternative to this multi- signature contract model would be to use threshold sig- natures in order to achieve the multi-lateral ownership se- mantics. While threshold signature schemes for ECDSA are computationally expensive, those for other schemes such as Schnorr signatures are very reasonable. Ethereum plans to introduce primitives which would make such schemes cheap to use in the upcoming Metropolis hard- fork. If such a means were able to be utilised, the gas costs for forwarding a Polkadot transaction into the Ethereum network would be dramatically reduced to a near zero overhead over and above the basic costs for validating the signature and executing the underlying transaction. In this model, Polkadot’s validator nodes would have to do little other than sign messages. To get the trans- actions actually routed onto the Ethereum network, we assume either validators themselves would also reside on the Ethereum network or, more likely, that small bounties be offered to the first actor who forwards the message on to the network (the bounty could trivially be paid to the transaction originator). 5.5.2. Ethereum to Polkadot. Getting transactions to be forwarded from Ethereum to Polkadot uses the simple no- tion of logs. When an Ethereum contract wishes to dis- patch a transaction to a particular parachain of Polkadot, it need simply call into a special “break-out contract”. The break-out contract would take any payment that may be required and issue a logging instruction so that its ex- istence may be proven through a Merkle proof and an as- sertion that the corresponding block’s header is valid and canonical. Of the latter two conditions, validity is perhaps the most straightforward to prove. In principle, the only re- quirement is for each Polkadot node needing the proof (i.e. appointed validator nodes) to be running a fully syn- chronised instance of a standard Ethereum node. Unfor- tunately, this is itself a rather heavy dependency. A more lightweight method would be to use a simple proof that the header was evaluated correctly through supplying only the part of Ethereum’s state trie needed to properly execute the transactions in the block and check that the logs (con- tained in the block receipt) are valid. Such “SPV-like” 6 proofs may yet require a substantial amount of informa- tion; conveniently, they would typically not be needed at all: a bond system inside Polkadot would allow bonded third-parties to submit headers at the risk of losing their bond should some other third-party (such as a “fisher- man”, see 6.2.3) provide a proof that the header is invalid (specifically that the state root or receipt roots were im- postors). On a non-finalising PoW network like Ethereum, the canonicality is impossible to proof conclusively. To ad- dress this, applications that attempt to rely on any kind of chain-dependent cause-effect wait for a number of “con- firmations”, or until the dependent transaction is at some particular depth within the chain. On Ethereum, this depth varies from 1 block for the least valuable transac- tions with no known network issues to 1200 blocks as was the case during the initial Frontier release for exchanges. On the stable “Homestead” network, this figure sits at 120 blocks for most exchanges, and we would likely take a similar parameter. So we can imagine our Polkadot-side Ethereum- interface to have some simple functions: to be able to accept a new header from the Ethereum network and val- idate the PoW, to be able to accept some proof that a particular log was emitted by the Ethereum-side break- out contract for a header of sufficient depth (and forward the corresponding message within Polkadot) and finally to be able to accept proofs that a previously accepted but not-yet-enacted header contains an invalid receipt root. To actually get the Ethereum header data itself (and any SPV proofs or validity/canonicality refutations) into the Polkadot network, an incentivisation for forwarding 6SPV refers to Simplified Payment Verification in Bitcoin and describes a method for clients to verify transactions while keeping only a copy of all blocks headers of the longest PoW chain. POLKADOT: VISION FOR A HETEROGENEOUS MUL TI-CHAIN FRAMEWORK DRAFT 1 9 data is needed. This could be as simple as a payment (funded from fees collected on the Ethereum side) paid to anyone able to forward a useful block whose header is valid. Validators would be called upon to retain informa- tion relating to the last few thousand blocks in order to be able to manage forks, either through some protocol- intrinsic means or through a contract maintained on the relay chain. 5.6. Polkadot and Bitcoin. Bitcoin interoperation presents an interesting challenge for Polkadot: a so-called “two-way peg” would be a useful piece of infrastructure to have on the side of both networks. However, due to the limitations of Bitcoin, providing such a peg securely is a non-trivial undertaking. Delivering a transaction from Bitcoin to Polkadot can in principle be done with a pro- cess similar to that for Ethereum; a “break-out address” controlled in some way by the Polkadot validators could receive transferred tokens (and data sent alongside them). SPV proofs could be provided by incentivised oracles and, together with a confirmation period, a bounty given for identifying non-canonical blocks implying the transaction has been “double-spent”. Any tokens then owned in the “break-out address” would then, in principle, be con- trolled by those same validators for later dispersal. The problem however is how the deposits can be se- curely controlled from a rotating validator set. Unlike Ethereum which is able to make arbitrary decisions based upon combinations of signatures, Bitcoin is substantially more limited, with most clients accepting only multi- signature transactions with a maximum of 3 parties. Ex- tending this to 36, or indeed thousands as might ulti- mately be desired, is impossible under the current proto- col. One option is to alter the Bitcoin protocol to enable such functionality, however so-called “hard forks” in the Bitcoin world are difficult to arrange judging by recent at- tempts. One possibility is the use of threshold signatures, cryptographic schemes to allow a singly identifiable public key to be effectively controlled by multiple secret “parts”, some or all of which must be utilised to create a valid sig- nature. Unfortunately, threshold signatures compatible with Bitcoin’s ECDSA are computationally expensive to create and of polynomial complexity. Other schemes such a Schnorr signatures provide far lower costs, however the timeline on which they may be introduced into the Bitcoin protocol is uncertain. Since the ultimate security of the deposits rests with a number of bonded validators, one other option is to reduce the multi-signature key-holders to only a heavily bonded subset of the total validators such that threshold signatures become feasible (or, at worst, Bitcoin’s native multi-signature is possible). This of course reduces the total amount of bonds that could be deducted in repara- tions should the validators behave illegally, however this is a graceful degradation, simply setting an upper limit of the amount of funds that can securely run between the two networks (or indeed, on the % losses should an attack from the validators succeed). As such we believe it not unrealistic to place a reason- ably secure Bitcoin interoperability “virtual parachain” between the two networks, though nonetheless a substan- tial effort with an uncertain timeline and quite possibly requiring the cooperation of the stakeholders within that network. 6. Protocol in Depth The protocol can be roughly broken down into three parts: the consensus mechanism, the parachain interface and interchain transaction routing. 6.1. Relay-chain Operation. The relay-chain will likely be a chain broadly similar to Ethereum in that it is state-based with the state mapping address to account information, mainly balances and (to prevent replays) a transaction counter. Placing accounts here fulfils one pur- pose: to provide accounting for which identity possesses what amount of stake in the system. 7 There will be no- table differences, though: • Contracts cannot be deployed through transac- tions; following from the desire to avoid applica- tion functionality on the relay-chain, it will not support public deployment of contracts. • Compute resource usage (“gas”) is not accounted; since the only functions available for public usage will be fixed, the rationale behind gas accounting no longer holds. As such, a flat fee will apply in all cases, allowing for more performance from any dynamic code execution that may need to be done and a simpler transaction format. • Special functionality is supported for listed con- tracts that allows for auto-execution and network- message outputs. In the event that the relay-chain has a VM and it be based around the EVM, it would have a number of mod- ifications to ensure maximal simplicity. It would likely have a number of built-in contracts (similar to those at addresses 1-4 in Ethereum) to allow for platform-specific duties to be managed including a consensus contract, a validator contract and a parachain contract. If not the EVM, then a WebAssembly [2] (wasm) back- end is the most likely alternative; in this case the overall structure would be similar, but there would be no need for the built-in contracts with Wasm being a viable target for general purpose languages rather than the immature and limited languages for the EVM. Other likely deviations from the present Ethereum pro- tocol are quite possible, for example a simplification of the transaction-receipt format allowing for the parallel execu- tion of non-conflicting transactions within the same block, as proposed for the Serenity series of changes. It is possible, though unlikely, that a Serenity-like “pure” chain be deployed as the relay-chain, allowing for a particular contract to manage things like the staking token balances rather than making that a fundamental part of the chain’s protocol. At present, we feel it is unlikely this will offer a sufficiently great protocol simplification to be worth the additional complexity and uncertainty involved in developing it. 7As a means of representing the amount a given holder is responsible for the overall security of the system, these stake accounts will inevitably encode some economic value. However, it should be understood that since there is no intention that such values be used in any way for the purpose of exchanging for real-world goods and services, it should be accordingly noted that the tokens not be likened to currency and as such the relay-chain retain its nihilistic philosophy regarding applications. POLKADOT: VISION FOR A HETEROGENEOUS MUL TI-CHAIN FRAMEWORK DRAFT 1 10 There are a number of small pieces of functionality re- quired for administrating the consensus mechanism, val- idator set, validation mechanism and parachains. These could be implemented together under a monolithic proto- col. However, for reasons of auguring modularity, we de- scribe these as “contracts” of the relay-chain. This should be taken to mean that they are objects (in the sense of object-orientated programming) managed by the relay- chain’s consensus mechanism, but not necessarily that they are defined as programs in EVM-like opcodes, nor even that they be individually addressable through the account-system. 6.2. Staking Contract. This contract maintains the val- idator set. It manages: • which accounts are currently validators; • which are available to become validators at short notice; • which accounts have placed stake nominating to a validator; • properties of each including staking volume, ac- ceptable payout-rates and addresses and short- term (session) identities. It allows an account to register a desire to become a bonded validator (along with its requirements), to nom- inate to some identity, and for preexisting bonded val- idators to register their desire to exit this status. It also includes the machinery itself for the validation and canon- icalisation mechanism. 6.2.1. Stake-token Liquidity. It is generally desirable to have as much of the total staking tokens as possible to be staked within the network maintenance operations since this directly ties the network security to the overall “mar- ket capitalisation” of the staking token. This can easily be incentivised through inflating the currency and hand- ing out the proceeds to those who participate as valida- tors. However, to do so presents a problem: if the token is locked in the Staking Contract under punishment of re- duction, how can a substantial portion remain sufficiently liquid in order to allow price discovery? One answer to this is allowing a straight-forward de- rivative contract, securing fungible tokens on an underly- ing staked token. This is difficult to arrange in a trust- free manner. Furthermore, these derivative tokens can- not be treated equally for the same reason that differ- ent Eurozone government’s bonds are not fungible: there is a chance of the underlying asset failing and becoming worthless. With Eurozone governments, there could be a default. With validator-staked tokens, the validator may act maliciously and be punished. Keeping with our tenets, we elect for the simplest so- lution: not all tokens be staked. This would mean that some proportion (perhaps 20%) of tokens will forcibly re- main liquid. Though this is imperfect from a security per- spective, it is unlikely to make a fundamental difference in the security of the network; 80% of the reparations possi- ble from bond-confiscations would still be able to be made compared to the “perfect case” of 100% staking. The ratio between staked and liquid tokens can be tar- geted fairly simply through a reverse auction mechanism. Essentially, token holders interested in being a validator would each post an offer to the staking contract stating the minimum payout-rate that they would require to take part. At the beginning of each session (sessions would happen regularly, perhaps as often as once per hour) the validator slots would be filled according to each would-be validator’s stake and payout rate. One possible algorithm for this would be to take those with the lowest offers who represent a stake no higher than the total stake targeted divided by the number of slots and no lower than a lower- bound of half that amount. If the slots cannot be filled, the lower bound could be repeatedly reduced by some fac- tor in order to satisfy. 6.2.2. Nominating. It is possible to trustlessly nominate ones staking tokens to an active validator, giving them the responsibility of validators duties. Nominating works through an approval-voting system. Each would-be nomi- nator is able to post an instruction to the staking contract expressing one or more validator identities under whose responsibility they are prepared to entrust their bond. Each session, nominators’ bonds are dispersed to be represented by one or more validators. The dispersal al- gorithm optimises for a set of validators of equivalent total bonds. Nominators’ bonds become under the effective re- sponsibility of the validator and gain interest or suffer a punishment-reduction accordingly. 6.2.3. Bond Confiscation/Burning. Certain validator be- haviour results in a punitive reduction of their bond. If the bond is reduced below the allowable minimum, the session is prematurely ended and another started. A non- exhaustive list of punishable validator misbehaviour in- cludes: • Being part of a parachain group unable to provide consensus over the validity of a parachain block; • actively signing for the validity of an invalid parachain block; • inability to supply egress payloads previously voted as available; • inactivity during the consensus process; • validating relay-chain blocks on competing forks. Some cases of misbehaviour threaten the network’s in- tegrity (such as signing invalid parachain blocks and val- idating multiple sides of a fork) and as such result in ef- fective exile through the total reduction of the bond. In other, less serious cases (e.g. inactivity in the consensus process) or cases where blame cannot be precisely allot- ted (being part of an ineffective group), a small portion of the bond may instead be fined. In the latter case, this works well with sub-group churn to ensur
프로젝트로 돌아가기