Flare 백서

Flare

원문

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

he system extension hosts two applications: the Protocol Managed Wallet infrastructure described in Section 4 and the FDC2 infrastructure described in Section 5. Initializing an Extension.To set up a new FCE, a Flare user sends a register command to a specific TEE Extension Registry smart contract. This instruction defines the Flare address of the extension owner, also referred to as the governance address, from which the 6 extension can be managed. This address need not match the address of the user initializing the extension. In order to prevent a single user from controlling the extension, the governance account can support certain rules for its use; for example, it may be a multi-sig account. Extension Management.Each extension registered to FCC is managed and owned by a governance address registered to that specific extension. This account is responsible for management duties for the extension, such as adding, updating, or deprecating supported code to be run by the registered TEEs. Each of these actions requires a signed instruction from the governance account to be implemented by the TEE. Additional common management instructions include adding or removing TEE machines from the extension and changing the ownership of the extension. More complicated instructions may be extension specific: extensions are able to support specialized TEE instructions that can only be issued from the management account, rather than requiring data provider signatures. 3.1 Registering TEEs to Extensions In order to participate in a FCE, a participating TEE must first be registered on Flare. Reg- istration is performed on a per-extension basis, with TEE instances signing up to participate in specific extensions rather than across FCC as a whole. A list of active TEE machines and their relevant extensions is stored on the TEE Registration smart contract on the Flare blockchain, with TEEs identified by: •TEE id, a unique identifier for the TEE. This is generated on boot, matching the address of a public/private key pair generated by the TEE during initialization. •TEE U RL, the URL at which the TEE (proxy) can be found. •The ExtensionID of the extension to which the TEE is registered. The process for registering a TEE in reward epochtutilizes the FDC2, and proceeds as follows: 1. The TEE is initialized alongside a TEE proxy, which provides the TEE with the signing policy for reward epocht. 2. The TEE generates a public/private key pair and corresponding public address TEE id and generates a request to register to the extension identified by ExtensionID. 3. An FDC2 request (with specialized attestation type) is made, asking data providers to confirm the TEE’s ID and proxy address, that it is equipped with the correct signing policy, that is is running appropriate code for the extension, and that it provided a valid attestation of this information. 4. Assuming the attestation was accurate, the request is confirmed by the FDC2 and the TEE is registered. A registered TEE can be unregistered by the machine owner at any time. At a later time it can also be re-registered, assuming that it is still running the same instance, for which it must produce a valid attestation with the correct time stamp. 7 Signing Policies.It is crucial that the TEE machine is initialized with the correct signing policy for reward epochtwhen registering: at the end of each reward epoch, the TEE’s copy of the signing policy is be updated to that of reward epocht+ 1 in accordance with the FSP, with the new signing policy relayed to the TEE machine by its proxy. However, as the new signing policy is signed by Flare’s data providers in accordance with the old policy, the TEE needs the policy of epochtto update securely. If the signing policy given to a TEE is incorrect, the TEE will not be able to determine whether or not instructions have been confirmed sufficiently by Flare’s providers or correctly update to a new signing policy. To ensure TEEs are equipped with the correct signing policy, their initial attestation sub- mitted on registration includes the current signing policy, which is checked by data providers. Additionally, they are periodically required to attest to their current view of the signing policy to ensure that they are up to date. Signing and Identity .Most instructions, including outputs from the PMW and FDC2 protocols, will result in the TEE publishing a signed response to their proxy server as part of their task. This could be direct, in the sense that the purpose of the task is to produce the signed response, or indirect, in the sense that the signature is the method by which a TEE confirms that it has taken some action such as generating a new key. In either case, the registration of the TEE under a public identity TEE id is crucial: users are able to verify the signature against the corresponding public key, and able to trust that the results were generated correctly due to the fact that registered TEEs provide an attestation of their deployed code. Stateful F unctions.Although each TEE registered to a given extension will deploy the same code, this does not ensure that they will exhibit identical behavior. Certain functions required of the TEEs may be stateful, such as performing an operation with cryptographic keys stored in the TEE. For many applications this is not a problem as long as each participating TEE is correctly identified by its identity TEE id. On the other hand, some applications may relay the same command to multiple TEEs and perform an aggregation over their outputs to ensure suitable redundancy. 3.2 TEE Instruction Work Flow Once an extension is initialized, instructions can be defined on the extension. An instruction is a command issued on Flare to be completed by the TEEs. The implementation flow of an instruction proceeds as follows: 1. One or more TEEs registered to the extension identified by ExtensionID on FCC run code able to execute a certain instruction, or family of instructions,I(·) where the ar- gument denotes a parameterization for the instruction. Each TEE registered to the extension is identified by its unique public identity TEE id, for which it owns the corre- sponding private key. 2. A permissioned userUissues an instance of the instruction{I(p), T}, for input param- eterspandTthe list of TEEs to complete the instruction, to the TEE smart contract on Flare. 3. Flare’s data providers pick up the user instruction{I(p), T}on the contract, confirm that the instruction is a valid instruction on ExtensionID and that the userUhas permission to issue it, and begin the process of relaying it to each TEE withT EE id ∈T. First, 8 Figure 2: Issuing a Generalised Instruction from Flare they assemble the details required by the TEEs necessary to completeI(p), then they sign this package and relay it to the TEEs. 4. For each TEE id ∈T, once that TEE has received the instructionI(p) and a combined weight Pj∈J Wj > WI(p) of the data provider signatures, they execute the given task. Here, whereW I(p) is the signing threshold for instructionI(p) andJthe set of data providers whose signatures the TEE has received. 5. Once the instruction has been executed, the results can be fetched from the TEE ma- chines on an external API hosted by their proxy. Any entity with access to the API can then relay the (signed) result to the appropriate location. For example, Flare’s data providers relay signed FDC2 attestations back onto Flare. Data Provider Augmentation.In this setting, the third point is where the data providers do the majority of the work: the user sends an instruction to the TEE contract on Flare asking for the data providers to instruct the TEEs. This instruction need not contain the necessary details for the TEEs to actually complete the instruction. Instead, it is up to the data providers to correctly assemble the package required by the TEE to successfully execute the instruction. For example, in the PMW case, this is where data providers assemble the transaction correctly; in the FDC2 setting, in this step the data providers are responsible for verifying the attestation. Thus, use cases need to be vetted and clearly defined in advance, so that Flare’s data providers are able to bootstrap an instruction on Flare to an instruction that the TEEs can implement. Since the data providers do their work off-chain, this allows substantial flexibility in the types of instruction supported by FCC: as long as the data providers can be convinced to support them, building use cases can be left to the imagination of Flare’s wider community. Instruction Management.Users are only able to issue instructions from a pre-defined list of available instructions on the extension. Adding and removing instructions from the extension is a responsibility of the extension management. TEEs demonstrate their capability to fulfill each instruction on the extension via an attestation, with the list of TEEs that support each instruction stored on the management contract. Included in the definition of an instruction is a list of users, or types of entity, who have permission to issue the instruction on the extension. 9 Signing Thresholds.The extension owner equips each possible instructionI(·) with a signing thresholdW I(·) , so that the instruction will only be executed once the TEE machine receives signatures from data providers with a combined weight on the current signing policy exceeding this thresholdW I(p) . The default threshold is 50%, in accordance with Flare’s usual signing threshold. Cosigners.For particularly security conscious users, an option to augment the data provider signature requirement with an additional cosigner option is available. In this case, the user who is instructing TEE operations on Flare specifies up toncosigner addresses and a pa- rameterkfor an (n, k) threshold signature scheme. When this option is enabled, the TEE requires both enough weight of data provider signatures andkor more cosigner signatures in order to execute an instruction. The choice of cosigners is arbitrary and up to the instructing user. Note that since data provider signatures are still required to instruct TEE operations, misbehaving cosigners can only compromise liveness of the TEE operations. Thus, users choosing this option must be careful to nominate reliable cosigners who they expect to provide consistent availability. Cosigner Enforcement.One additional security consideration is enforcement of cosigner signatures: data providers could, in theory, send the TEE machine a modified version of an instructionI(p) for which the user has requested cosigners, redacted such that the cosigners field has been removed. Since it is not possible to prevent this on a per-instruction basis, each extension much have its own method for enforcing that cosigner signatures are checked. For example, in the PMW case (see Section 4), each key stored by a TEE for signing transactions has an optional metadata field storing parameters (n, k) andncosigner addresses. When this field is enabled, all instructions using that key require at leastksignatures from the designated cosigners, so that if the data providers redact cosigner information on an instruction it is automatically rejected. Using Instruction Results.Typically, the instruction executed by the TEEs will result in them making signed data available on an API at their proxy, with results retrieved by data providers to be published on the Flare network. Results will be signed by the executing TEE, either with the key corresponding to TEE id or by some other key owned by the TEE. Once they are published on the chain, users can verify the results and use them as inputs in smart contracts on the network. Some instructions, such as PMW transactions, will require that results be relayed to external chains: in this case, the extension must have its own method for ensuring that this step is completed. 3.3 Fees and Rewarding In order to access FCC, users must pay fees, which are paid on Flare in its native FLR. Fees are charged to users for each function call made to the TEE contract, with each type of call having a different fee. The fees will be distributed to Flare’s data providers to reward their role in securing the system and to the TEE operators to cover their infrastructure costs and reward their participation. Rewards are distributed to the data providers in accordance with their weight and the quantity of requests that they handled in a timely manner. As part of their operation, TEEs will periodically compile and sign a list of which data providers gave their signatures in an allotted time frame for each relayed instruction. This signed rewarding data is then collated and published to the network by the data providers. Each data provider will receive a proportion of the rewards allocated to each instruction for which their signature was received 10 by the TEE in a timely manner, with the proportion received corresponding to their signing weight. Here, a timely manner means that either their signature arrived within the first 50% of the weight of signatures or within a short grace window after the required 50% majority was reached. Rewards that would be allocated to data providers who did not fulfill this criteria for a given instruction are burnt. Rewards allocated to TEE machine owners will be assigned corresponding to the amount and type of instructions executed by the TEEs under their ownership, with each instruction having its own fee. In the case when multiple TEEs fulfill the same instruction, rewards will be split evenly among those TEEs. 4 TEE Protocol Managed Wallet A TEE Protocol Managed Wallet (PMW) is a blockchain account managed on Flare but hosted on an external chain, such as the XRP Ledger or the Bitcoin Blockchain, that is dedicated to submitting payment transactions. It is a data structure contained within three places: on smart contracts on Flare, where its configurations and instructions are managed, on a set of TEE machines that store keys and sign transactions, and on the external network where the transactions are issued. The TEE PMW infrastructure is hosted as an application on the system extension of FCC. For clarity, a more precise definition follows. Definition 4.1A TEE protocol managed wallet is an accountW C on a blockchainCwhose private key or keyssk 1, . . . , skn are stored on one or more Trusted Execution Environments TEE1, . . .TEEm that are signed up to the system extension on FCC. These TEEs are deployed with code such that they only sign transactions fromW C in response to instructions that have been signed by a threshold of the signing weight of Flare’s data providers. In turn, Flare’s data providers only submit the instructions to the TEE in response to transaction instructions issued on the TEE smart contract by registered wallet owners on Flare. Once a transaction is signed by the appropriate TEEs, it is available to be relayed to the blockchainCso that it is correctly issued byW C. In particular, the issuance of transactions from the wallet is triggered by the Flare user who own the wallet by issuing the corresponding instructions on Flare; these are then signed by Flare’s data providers and relayed to the TEEs, who sign the final transaction. The TEEs run code controlling access to keys that manage the accountW C such that there is no other way for transactions to be issued 4.1 Initialization Any user on Flare can setup and own a TEE PMW. A user who wishes to own a PMW must first register a Project, a data structure that stores multiple wallets with the same owner. Then, to initialize a walletW C on a chainC, the user issues an initialization instruction on the system extension containing the following parameters: •Project ID: The ID of the project to which the wallet belongs. •W allet ID: A unique identifier for the wallet. •Admin Address: The (Flare) address that instantiated and administrates the wallet. Note that this is not the address that issues payment instructions; rather, it is responsible for configuration and issuing configuration commands. •W allet Address: The (external) addressW C of the wallet on blockchainC. 11 •Issuing Address: The (Flare) address that is allowed to issue payment instructions. •Key Admin Information: The (Flare) addresses of Key Admins, used as cosigners in the key recovery process of corrupted keys, and a signing threshold for their cosigning. •Key Definitions: The information on which TEEs generate and hold the keys to sign transactions from the wallet address on blockchainC. Note that the external payment address may be a multi-sig address, thus more than one key may be needed. To approve each key, an FDC2 attestation request is made to verify the details of the holding TEE. In response to an initialization call to the TEE smart contract, the specified TEEs generate keys according to the Key Definitions and initialize the accountW C onC. Key Definitions and Storage.For each key related to the Wallet ID, the key definition parameter contains the required information about the structure of the key. As well as functional information, including the expiration time of the key and the signing method of the wallet, this also includes information around the TEE storage structure. A TEE with ID TEE id that generates and stores the key is assigned for each key. Additionally, each key is backed up using a secret sharing scheme among Flare’s data providers and additional key admins. More detailed information on key recovery can be found in Section 4.3. Ongoing Management.Once a wallet has been initialized, its ongoing management is also handled through the TEE wallet contract. The complete list of possible calls is too long to enumerate here, but some particular functions of interest include: •Deleting keys from the wallet. •Triggering the restoration of a backup of a key on a specified TEE. •Transferring ownership of the TEE wallet to a new user on Flare. •Pausing, resuming, or deleting the wallet. FCC Key Management.The management structure for keys described in this section, where data is organized in a system of projects, wallets, and keys with associated backup and management mechanics, is generic to the FCC. Since it is not specific to the PMW infrastructure, FCEs that require TEEs to handle private/public key pairs beyond those required for the TEE identities may re-use it if desired. 4.2 Submitting a Transaction Once the TEE wallet has been set up, the user can now order transactions to be sent on blockchainCvia Flare. To do so, they submit a payment instruction detailing the transaction to the smart contract on Flare. This instruction is picked up by the data providers, who compile the details required to complete the transaction onC, then sign and relay it to the key holding TEE(s). Once a TEE has received a weight of signatures exceeding the signing threshold (50% for PMW transactions) from the current signing policy, it signs the transaction with its stored keys. The transaction can then be retrieved from the TEE proxy and relayed toC. Assuming that all steps were completed correctly, the transaction will now be accepted onC. Submitting a payment instruction in this way is an example of the generalized instruction flow depicted in Section 3.2. For clarity the method for sending a transaction is depicted in Figure 3 and laid out in detail below: 12 Figure 3: Issuing a PMW Transaction on Flare 1. The user submits an instruction to the TEE contract on Flare instructing a transaction TC be issued on blockchainCfrom accountW C. The instruction specifies the Wallet ID of the TEE PMW. The transaction instruction includes the amount to be transferred, the receiving address, the offered fee (on the source chain), and a payment reference. The instruction and wallet address implicitly includes a list of the one or more TEE machines to which the instructions need to be relayed. 2. Upon picking up the payment instruction, Flare’s data providers eac
프로젝트로 돌아가기