Flare 백서

Flare

원문

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

h independently assemble the transaction instructionT T EE, a packet containing all the information nec- essary for the TEE(s) to sign the transaction fromW C. The contents of this package depend on the rules of the source chainC. The data providers then sign the packet, with theith data provider producing a signature Sign i(TT EE), and send the signed in- struction to the appropriate TEE(s). In cases of multiple TEEs, these instructions are issued independently by the data providers to each TEE. 3. Once a TEE has received signatures from a set of providersJwhose combined weight in the current epoch exceeds the signing threshold, Pj∈J Wj >0.5, the TEE signs the transactionT C using the key corresponding toW C and makes the transaction available. Again, in cases of multiple TEEs each completes this step independently e.g. waits until it has received enough data provider signatures and then submits its signature forT C. 4. The transaction is retrieved from the TEE and relayed toC. Assuming all steps of the protocol were completed correctly, transactionTwill be executed on blockchainCin accordance with the rules on that chain. Executing a T ransaction.In the third point of the above flow, the TEEs are responsible for signing the transaction once appropriately instructed by the data providers. However, in the fourth phase, these signatures and the transaction still need to be published onC. This is done permissionlessly: TEE proxies host APIs which can be queried to collect the signatures and transaction, so that any entity can collect and publish them onC. Since the process is permissionless and cannot be falsified, it is abstracted in this paper: once the TEEs sign the transaction, it is assumed that the transaction and signatures are published onC. Cosigning.In the same manner as discussed in Section 3.2 for general instructions, security conscious users may combine the requirement for data provider signatures on PMW trans- actions with an additional (n, k) threshold signature scheme fornnominated cosigners, who 13 are chosen by the user. In this case, two phases of the protocol are changed. In phase two of the transaction, the cosigners each assemble the transaction instructionT T EEand submit a signed copy of the instruction to the appropriate TEEs. Then, in phase three, the TEEs will not sign the transaction until they receive both a sufficient weight of data provider sig- natures and at leastkcosigner signatures. Essentially, the cosigners function as a parallel set of signers alongside the data providers. Otherwise, the protocol remains unchanged. If a user wishes to enable cosigners, this option is enabled on a per-key basis. That is, when a key is generated the owner may specify cosigning information. If so, then the TEE stores as metadata for that key the addresses and signing thresholds for its cosigning. Then, any transaction using the key must have been signed by at leastkof the cosigners, rather than this option being enabled on a per-instruction basis. Users selecting this option should thus take care to choose cosigners carefully, as they are required for liveness of all submitted transactions. Assembling a T ransaction.Hidden in the second point of the transaction flow is a major duty of the data providers: correctly assembling a transaction. The TEE wallet infrastructure on Flare responds to transaction instructions by users, simple calls requesting a transaction from a TEE PMW on an external chain that specify a receiving address and an amount. The data providers are then responsible for correctly assembling this information into a transaction which can be handed over to the TEE to be signed, the complexity of which depends on the requirements of the underlying chain. Regardless, the required call to the TEE contract on Flare is kept simple for the user, with the work handled off-chain by Flare’s data providers. Multi-Sig Chains.The TEE PMW is capable of supporting multi-sig addresses onC. In this case, independent TEEs will hold keys corresponding to the multi-sig, and when a transaction is submitted on Flare the data providers can read this list from the wallet’s configuration. The data providers then send signed transaction instructions to each TEE separately. Each of these TEEs independently sign the transaction once they have received a sufficient weight of signatures from Flare’s data providers. Otherwise, the transaction flow listed above remains unchanged. Batching.The TEE PMWs can support batching of transactions (sending multiple pay- ments in a single transaction) as long as the underlying chain supports it. Users wishing to send a batch of transactions can enable a setting on their wallet specifying a batch size, the maximum number of transactions in a batch, and a batch duration, indicating the maximum amount of time transactions will be batched for. Transactions ordered from a wallet with this setting enabled will be batched together: each time a transaction is sent, if there is no open batch, a new batch is started. Otherwise, it is put into the current batch. A batch accepts new transactions until either the batch size or batch duration is reached, at which point no more transactions can be placed in the batch and the data providers begin to assemble and relay the completed batched transaction to the TEEs for signing. F ailed T ransactions.From time to time transactions made from a TEE PMW may fail. For example, the offered fees may have been too low to be picked up on the source chain, or the user may have requested an impossible transaction. In this case, the TEE infrastructure on Flare hosts two mitigations. Firstly, users can instruct the reissuance of transactions using a specific reissue command, including identifying information for the transaction to be reissued and a new fee, typically larger than the old fee. This is particularly pertinent in cases where a transaction on a specific nonce (sequence number) has gotten stuck, and thus must be reissued 14 or nullified to push forward existing transactions on subsequent nonces that must be executed in sequence. Secondly, users can request that an FDC attestation request is made proving that a transaction was nullified or reverted, thus consuming the relevant nonce. In this case, the protocol determines whether or not a new payment instruction needs to be issued. Latency .Unlike Flare’s enshrined protocols, which proceed in a sequence of staggered rounds, instructions issued to the TEE PMWs do not have a fixed latency. Instead, Flare’s data providers are incentivized to sign and relay transaction instructions to the TEE as quickly as possible. The TEE will then sign the transaction and make it available as soon as it has received the signatures of a weighted majority of data providers. Thus, the exact latency will vary with the response time of Flare’s data providers, but transactions should be thought of as being issued in a matter of seconds. Signing Threshold.In the third phase of the transaction flow, the TEEs submit signatures for a transaction upon receiving a sufficient weight of signatures from data providers. In this case, sufficient means 50% weight according to the signing policy of the current reward epoch on Flare, corresponding to an honest weighted majority of data providers. The 50% threshold was chosen for system extension applications (PMWs and the FDC2) to align the security of the protocols with that of the signing policy, and thus the network itself. In later designs this 50% threshold may be changed, or indeed made flexible at the discretion of the wallet owner. Increasing this threshold improves security, as more malicious data providers are needed to force through a false transaction, but damages availability, since a higher number of signatures is necessary to execute an honest transaction. However, without corresponding changes to Flare’s signing policy the wallet protocol’s security would deviate from that of the overall network’s. 4.3 Key Management and Backup TEEs registered to PMWs will need to handle the corresponding cryptographic keys. If a TEE machine is powered down, either accidentally or maliciously, all the contents of its memory are lost. In this case, this would include the keys for any wallet addresses (or other applications) that are stored in the TEE. Thus, precautions are required to manage the back up and restoration of keys owned by registered TEEs. Keys are backed up by a two stage mechanism. First, the key owning TEE generates 2 sharesS provider, Sadmin for an additive Secret Sharing scheme, so thatS provider +S admin =S modN, whereSis the secret being shared.. These shares are then further split using two more secret sharing schemes, the shares of which are distributed to be stored by two sets of entities: one share is split among the data providers, and the other among a collection of specified key admins for the PMW. Thus, recovering the original key consists of two stages: first, the data providers and key admins provide shares necessary to recover the two parts of the initial secret sharing, then these shares are recombined to recover the original key. Since the weight and identity of Flare’s data providers evolves over time according to the signing policy, each key back up is rerolled on the introduction of a new policy. These processes are explained in more detail below, and summarized in Figure 4. T riggering a Backup.Each key is backed up in two circumstances: on initial generation, a backup of the key is generated and distributed among data providers on the current signing policy and the key admins. Following this, each time the signing policy is updated at a TEE machine (which occurs roughly every 3.5 days) a fresh backup is generated for each key stored 15 Figure 4: Backing Up a Key in Two Stages by the TEE that is used in a PMW. The new backup is generated in accordance with the new signing policy, with data providers on that policy receiving the relevant amount of shares, so that backups evolve with the set of data providers. Key Admins.The key backup information is distributed between two types of entities: Flare’s data providers and (optionally) a set of key admins specified by the wallet owner. On initializing a key, the wallet owner specifies an arbitrary amountn admin of key admins, each identified by a public identity corresponding to a public keyP K1, . . . , P Knadmin. Additionally, the user specifies a threshold valuek admin of admins required to recover the key admin share of a key backup for the key. These two parameters define a Shamir Secret sharing scheme that will be applied toS admin. Each key admin receives a single share of theS admin, and thus has an equal share of the responsibility during the backup process. The identity and nature of the key admins is at the discretion of the user: thus, it is crucial that the user specifies key admins that it trusts, both to maintain liveness of the backup and to prevent the key admin share of the secret from leaking. Distributing the Data Provider Share.The data provider shareS provider is split and distributed between the data providers in accordance with their weight, so that two thirds of the signing weight of data providers are required to recover the share. That is, a large integern is chosen, andS provider is split using an (nprovider,⌈ 23 ·n provider⌉) Shamir Secret Sharing scheme, with each provider receiving a number of shares proportional to their signing weight 1. Thus, thejth provider with normalized signing weightW j receivesn j :=⌊W j ·n provider⌋shares s1j , . . . , snjj ofS provider, such that any combination of⌈ 23 ·n provider⌉sharess ij distributed across any number of providers can be used to recoverS provider. 1The initial value forn provider will be around 1000, but may be increased depending on the performance of the system. 16 Key Share Metadata.All key shares, both for data providers and key admins, are dis- tributed with associated metadata, confirming the correctness and provenance of the share. This data is signed by the key holding TEE and allows for key shares to be uniquely identified and associated with the correct holder, key, and backup ID. The purpose of this metadata is twofold: during generation, it allows data providers and key admins to be sure that they have received valid key shares generated by the underlying TEE machine. During recovery, it ensures that data providers and key admins have provided the correct share and thus can not undermine the reconstruction process without detection, for example by intentionally presenting an invalid key share. Specification.More formally, the key backup mechanism for a secret keyskproceeds as follows: 1. The key owning TEE with identity TEE id triggers back up procedure of a key with identity Keyid, either as part of the generation of that key or on update of the signing policy. 2. The TEE begins the backup process for the secret partskof Key id. First,skis split uniformly at random into two sharesS provider, Sadmin satisfyingS provider +S admin =sk modN. 2 3. Next, the TEE splits the data provider shareS provider inton provider shares using an (nprovider,⌈ 23 ·n provider⌉) Shamir Secret Sharing scheme. Then, it consults the relevant signing policy, either the current one or new one, and assigns these shares to the data providers so that thejth provider with signing weightW j is allocatedn j :=⌊W j · nprovider⌋sharess 1j , . . . , snjj . 4. Following this, the TEE splits the key admin shareS admin into sharess 1, . . . , snadmin using an (n admin, kadmin) Shamir Secret Sharing scheme, assigning theith share to the ith listed key admin. 5. Finally, all assigned shares are encrypted under the public key of the entity that they are assigned to and assembled into a single backup package, posted to a backup URL. Shares in this package are indexed by the public key of the owner, so that providers can find their shares. Each data provider can decrypt its sharess 1j , . . . , snjj ofS provider from the package as they are encrypted under the public key corresponding to its address. Similarly, each key admin can recover its shares i ofS admin encrypted under its public key. 6. Each time the signing policy is updated, the TEE repeats this process for Key id from Step 2, generating a fresh set of shares for each secret sharing scheme. This ensures that the set of data providers on the current signing policy can be used to restore the key, and that data providers on an old signing policy can not do so without colluding with the key admins. Analogously, the recovery process works as follows: 1. The owner of the application using Key id issues an instruction to recover the key on an associated TEE with identity TEE id′. 2HereNis defined by the type of key thatskis e.g. an ECDSA key is an integer modulo some integerN that depends on the modulus of the signature scheme. 17 2. Each data provider encrypts a package containing its sharess 1j , . . . , snjj ofS provider under the public identity key associated with TEE id′ and sends this package as an instruction for the TEE. 3. Similarly, each key admin encrypts a package containing its shares i ofS admin under the public key associated with TEE id′ and sends this instruction. 4. Once at least⌈ 23 ·n provider⌉encrypted data provider shares andk admin encrypted key admin shares are available, the TEE decrypts the packages, recovering the individual provided data provider and key admin shares. It then recombines the data provider shares to recoverS provider and the key admin shares to recoverS admin. 5. Once TEE id′ has recovered the data provider and key admin shares, it combines the 2 shares modNto recoversk. Proof of the successful recovery is made available by the TEE, so that data providers can confirm that the key has been successfully restored. In summary, the functions required for the key backup scheme are: •Key Backup: For a TEE id holding a keysk, given a list of key admin addresses P K1, . . . , P Knadmin, a signing policyP, and a parameterk admin, shares of the secret key skare generated, encrypted, and batched into a backup package for the data providers and the key admins in accordance with the described process. •Key Restore: On input a TEE id′ permitted to restore a secret keyskcorresponding to a key identified by Keyid and the signing policy on which the backup was generated, the data providers and key admins begin the recovery process, passing on the appropriate decrypted shares of the key to TEE id′. From these shares,skis regenerated on TEE id′. Security .Security of the backup process relies on the underlying secret sharing schemes: to compromise a backed up key, an attacker would require collusion between at least two thirds of the data providers andk admin of the key admins. In particular, the user should only have selected trusted admins, and the data provider threshold is higher than the generic signing threshold on Flare. A second more subtle requirement is that the same key can be backed up multiple times without compromising security. Fortunately, both components of the secret sharing mech- anism have this property: the initial split is uniformly random, and Shamir Secret Sharing has the required dynamic property, where the same key can be shared multiple times without issue. 5 Flare Data Connector v2 As part of the system extension within FCC, a TEE based version of the FDC, known as the Flare Data Connector v2 (FDC2), is deployed. The FDC is Flare’s enshrined protocol for providing attestations of external events in response to user requests, so that the truth of these events, validated by the data providers, can be used on Flare. The design of the FDC confirms requests periodically, collecting batches of requests every 90 seconds and confirming valid requests shortly afterwards. The FDC2 improves on the latency of the FDC by lever- aging the TEE infrastructure to provide remote attestations in response to specific requests. This circumvents the 90 second collect phase that is required in the FDC to package many attestation proofs into a single Merkle root. As an additional benefit over the FDC, fees can be charged at a flat rate, rather than varying to incentivize inclusion in a given round. The FDC2 running on the system extension operates using TEE instructions, specifically as follows: 18 1. A contract on Flare receives FDC2 attestation requests from Flare’s users. A collection of TEEs, identified by their public identities TEE id, will be registered on FCC’s system extension to execute the confirmation of attestation requests sent to this contract. 2. A user submits an attestation requestA(x) to the FDC2 contract asking for an attes- tation of datax. 3. The Attestation requestA(x) submitted to the FDC2 contract is picked up by Flare’s data providers, who confirm the validity of the attestation request and the truth of the informationx. 4. Assuming that the request is correct and accurate, the data providers each perform and sign the attestation, resulting in a confirmed attestationA j(x) of informationxby providerj. They then relay the signature, confirmation data, and request to the TEEs participating in the FDC2. 5. Once a TEE has received signed attestations from a set of providersJsatisfyingP j∈J Wj >0.5 of the weight of data providers according to the current signing policy, they sign an attestation responseA id(x) forA(x). The attestation responseA id(x) in- cludes the requestA(x), confirmation data, and a package containing the signature of each data provider. The signature is performed using the private key corresponding to TEEid. 6. Flare’s data providers retrieve the signed attestation response from the TEE proxy and publish it on Flare. The attestationA(x) is now confirmed on the network, and the truth of dataxcan be used. This design exhibits and leverages the flexible nature of the FCE infrastructure. On an abstract level, all that is required to implemen
프로젝트로 돌아가기