Internet Computer 백서

Internet Computer

원문

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

vent and detect any (accidental) non-deterministic computation, should it arise. The per-round certified state is one of the mechanisms used to do this. • Coordination with consensus. The per-round certified state is also used to coordinate the execution and consensus layers, in two different ways: – If consensus is running ahead of execution (whose progress is determined by the last round whose state is certified), consensus will be “throttled”. – Inputs to consensus must pass certain validity checks, and these validity checks may depend on certified state, which all replicas must agree upon. 2.3.2 Query calls vs update calls As we have described it so far, ingress messages must pass through consensus so that they are processed in the same order by all replicas on a subnet. However, an important optimization is available to those ingress messages whose processing does not modify the replicated state of a subnet. These are called query calls — as opposed to other ingress messages, which are called update calls. Query calls are allowed to perform computations which read and possibly update the state of a canister, but any updates to the state of a canister are never committed to the replicated state. As such, a query call may be processed directly by a single replica without passing through consensus, which greatly reduces the latency for obtaining a response from a query call. In general, a response to a query call is not recorded in theingress history data structure, and therefore cannot be authenticated using the per-round certified state mechanism as described above. However, the IC makes it possible for canisters to store data (while processing update calls) in special certified variables, which can be authenticated by this mechanism; as such, query calls that return as their value a certified variable can still be authenticated. 2.3.3 External user authentication One of the main differences between an ingress message and a cross-subnet message is the mechanism used for authenticating these messages. While chain-key cryptography is used 15 to authenticate cross-subnet messages, a different mechanism is used to authenticate ingress messages from external users. There is no central registry for external users. Rather, an external user identifies himself to a canister using a user identifier (aka principal), which is a hash of a public signature- verification key. The user holds a corresponding secret signing key, which is used to sign ingress messages. Such a signature, as well as the corresponding public key, is sent along with the ingress message. The IC automatically authenticates the signature and passes the user identifier to the appropriate canister. The canister may then authorize the requested operation, based on the user identifier and other parameters to the operation specified in the ingress message. First-time users generate a key pair and derive their user identifier from the public key during their first interaction with the IC. Returning users are authenticated using the secret key that is stored by the user agent. A user may associate several key pairs with a single user identity, using signature delegation. This is useful, as it allows a single user to access the IC from several devices using the same user identity. 2.4 Execution layer The execution layer processes one input at a time. This input is taken from one of the input queues, and is directed to one canister. Based on this input and the state of the canister, the execution environment updates the state of the canister, and additionally may add messages to output queues and update the ingress history (possibly with a response to an earlier ingress message). Each subnet has access to a distributed pseudorandom generator (PRG). Pseudo- random bits are derived from a seed that itself is a threshold signature called the Random Tape (see Section 1.6.1 and more detail in Section 3). There is a different Random Tape for each round of the consensus protocol. The basic properties of the random tape are: 1. Before a block at height h is finalized by any honest replica, the Random Tape at heighth + 1 is guaranteed to be unpredictable. 2. By the time a block at height h + 1 is finalized by any honest replica, that replica will typically have all the shares it needs to construct the Random Tape at height h + 1. To obtain pseudorandom bits, a subnet must make a request for these bits via a “system call” from the execution layer in some round, say h. The system will then respond to that request later, using the Random Tape at heighth+1. By property (1) above, it is guaranteed that the requested pseudorandom bits are unpredictable at the time the request is made. Consensus will actually deliver to message routing both the Random Tape and payload at h + 1 at the same time; by property (2) above, this will typically not incur any additional delay. 2.5 Putting it all together We trace through the typical flow to process a user request on the IC. 16 Query call 1. A user’s query call M to a canister C is sent by the user’s client to a boundary node (see Section 1.9), and the boundary node sends M to a replica on the subnet that hosts canister C. After receiving M, this replica will compute the response and send it back to the user via the boundary node. Update call 1. A user’s request M to a canisterC is sent by the user’s client to a boundary node (see Section 1.9), and the boundary node sends M to a replica on the subnet that hosts canister C. 2. After receiving M, this replica will broadcast M to all other replicas on the subnet, using the peer-to-peer layer (see Section 2.1). 3. Having received M, the leader for the next round of consensus (see Section 2.2) will bundleM with other inputs to form the payload for a blockB that the leader proposes. 4. Some time later, block B is finalized and the payload is sent to the message routing layer (see Section 2.3) for processing. Note that the peer-to-peer layer is also used by consensus to finalize this block. 5. The message routing layer will place M in the input queue of the canister C. 6. Some time later, the execution layer (see Section 2.4) will process M, updating the internal state of the canister C. In some situations, the canister C will be able to immediately compute a response R to the request M. In this case, R is placed in the ingress history data structure. In other situations, processing the requestM may require making a request to another canister. In this example, let us suppose that to process this particular request M, the canisterC must make a requestM′ to another canisterC′ that resides on another subnet. This second request M′ will be placed in the output queue of C, and then the following steps are performed. 7. Some time later, message routing will move M′ into an appropriate cross-subnet stream, and this will eventually be transported to the subnet hosting C′. 8. On the second subnet, the request M′ will be obtained from the first subnet, and eventually pass through consensus and message routing on the second subnet and then be processed by execution. The execution layer will update the internal state of canister C′ and generate a response R′ to the request M′. The response R′ will go in the output queue of canister C′, and eventually be placed in a cross-subnet stream and transported back to the first subnet. 9. Back on the first subnet, the response R′ will be obtained from the second subnet, and eventually pass through consensus and message routing on the first subnet and then be processed by execution. The execution layer will update the internal state 17 of canister C and generate a response R to the original request message M. This response will be recorded in the ingress history data structure. Regardless of which execution path is taken, the responseR to requestM will eventually be recorded in the ingress history data structure on the subnet that hosts canister C. To obtain this response, the user’s client must perform a kind of “query call” (see Section 2.3.2). As discussed in Section 2.3.1, this response will be authenticated via chain-key cryptography (specifically, using a threshold signature). The authentication logic itself (i.e., threshold signature verification) will be performed by the client using the service worker originally obtained by the client from the boundary node. 3 Chain-key crytography I: threshold signatures A critical component of the IC’s chain-key cryptography is a threshold signature scheme [Des87]. The IC uses threshold signatures for a number of purposes. Let n be the number of replicas in a subnet and let f be a bound on the number of corrupt replicas. • The Consensus Layer makes use of an ( f + 1)-out-of-n threshold signature to realize a random beacon (see Section 5.5). • The Execution Layer makes use of an ( f + 1)-out-of-n threshold signature to realize a random tape, which is used to provide unpredictable pseudorandom numbers to canisters (see Section 7.1). • The Execution Layer makes use of an ( n−f)-out-of-n threshold signature to certify the replicated state . This is used both to authenticate the outputs of a subnet (see Section 6.1) and to implement the fast-forwarding feature of the IC’s chain-evolution technology (see Section 8.2). For the first two applications (the random beacon and random tape), it is essential that the threshold signatures are unique, i.e., for a given public key and message, there is only one valid signature. This is required as we use the signature as a seed to a pseudorandom generator, and all replicas who compute such a threshold signature must agree on the same seed. 3.1 Threshold BLS signatures We implement threshold signatures based on the BLS signature scheme [BLS01], which is trivial to adapt to the threshold setting. The ordinary (i.e., non-threshold) BLS signature scheme makes use of two groups, G and G′, both of prime order q. We assume that G is generated byg∈ G and G′ is generated by g′∈ G′. We also assume a hash function HG′ that maps its inputs to G′ (and which is modeled as a random oracle). The secret signing key is an element x∈ Zq and the public verification key is V :=gx∈ G. In the non-threshold setting, to sign a message m, the signer computes h′←HG′(m)∈ G′ and then computes the signatureσ := (h′)x∈ G′. To verify that such a signature is valid, one must test if logh′σ = loggV . To be able to perform this test efficiently, the BLS scheme 18 uses the notion of a pairing on the groups G and G′, which is an algebraic operation that is available when G and G′ are elliptic curves of a special type. We shall not be able to go into the details of pairings and elliptic curves here. See [BLS01] for more details. BLS signatures have the nice property (mentioned above) that signatures are unique. In the t-out-of-n threshold setting, we have n replicas, any t of which may be used to generate a signature on a message. In somewhat more detail, each replica Pj holds a share xj ∈ Zq of the secret signing key x∈ Zq, which is privately held by Pj, while the group element Vj := gxj is publicly available. The shares ( x1,...,x n) are a t-out-of-n secret-sharing of x (see Section 3.4). Given a message m, replica Pj can generate a signature share σj := (h′)xj∈ G′, where h′ := HG′(m) as before. To verify that such a signature share is valid, one must test if log h′σj = loggVj. Computing the discrete logarithms is intractable, but this can be checked using a pairing — in fact, this is exactly the same as the validity test for an ordinary BLS signature with public key Vj. This scheme satisfies the following reconstruction property: Given any collection of t valid signature shares σj on a message m (contributed by distinct replicas), we can efficiently compute a valid BLS signature σ on m under the public verification key. In fact, σ can be computed as σ← ∏ j σλjj , (1) where the λj’s can be efficiently computed just from the indices of the t con- tributing replicas. Under reasonable intractability assumptions for G, and modeling HG′ as a random oracle, this scheme satisfies the following security property: Assume that at most f replicas may be corrupted by an adversary. Then it is infeasible for the adversary to compute a valid signature on a message unless it obtains signature shares on that message from at least t−f honest replicas. 3.2 Distributed key distribution To implement threshold BLS, we need a way to distribute the shares of the secret signing key to the replicas. One way to do this would be to have a trusted party compute all of these shares directly and distribute them to all the replicas. Unfortunately, this would create a single point of failure. Instead, we use a distributed key generation (DKG) protocol, which allows the replicas to essentially carry out the logic of such a trusted party using a secure distributed protocol. We sketch the high level ideas of the protocol currently implemented. We refer the reader to [Gro21] for more details. The DKG protocol used is essentially non-interactive. It uses two essential ingredients: 19 • a publicly verifiable secret sharing (PVSS) scheme, and • a consensus protocol. Although any consensus protocol could be used, not surprisingly, the one we use is that in Section 5 (see also Section 8). 3.3 Assumptions The basic assumptions made are the same as outlined in Section 1: • asynchronous communication, and • f <n/3. We only indirectly make use of a partial synchrony assumption (as in Section 5.1) to ensure that the consensus protocol attains liveness. We also assume that for a t-out-of-n threshold signature scheme, we have f <t≤n−f, which (among other things) ensures that (1) the corrupt replicas cannot sign all by them- selves, and (2) the honest replicas can sign all by themselves. We also assume that every replica is associated with some public keys, where each replica also holds the corresponding private key. One public key is the signing key (the same one as in Section 5.4). Another public key is a public encryption key for a specific public-key encryption scheme needed to implement the PVSS scheme (details follow). 3.4 PVSS scheme Let G be the group of prime order q generated by g∈ G introduced above. Let s∈ Zq be a secret. Recall that a t-out-of-n Shamir secret-sharing of s is a vector (s1,...,s n)∈ Znq , where sj :=a(j) ( j = 1,...,n ). and a(x) :=a0 +a1x +··· +at−1xt−1∈ Zq[x] is a polynomial of degree less than t with a0 := s. The key properties of such a secret sharing are • from any collection of t of the sj’s, we can efficiently compute (via polynomial inter- polation) the secret s =a0 =a(0), and • ifa1,...,a t−1 are chosen uniformly and independently over Zq, then any collection of fewer than t of the sj’s reveals no information about the secret s. At a high level, a PVSS scheme allows one replica, Pi, called the dealer, to take such a sharing, and compute an object called a dealing, which contains • a vector of group elements (A0,...,A t−1), where Ak :=gak for k = 0,...,t − 1, 20 • a vector of ciphertexts (c1,...,c n), where cj is the encryption of sj under Pj’s public encryption key, • a non-interactive zero-knowledge proof π that each cj does indeed encrypt such a share — more precisely, that each cj decrypts the value sj satisfying gsj = t−1∏ k=0 Ajkk =ga(j). (2) We note that to establish the overall security of our DKG protocol, the PVSS scheme must provide an appropriate level of chosen ciphertext security. Specifically, the dealer must embed its identity as associated data in the dealing, and the encrypted shares must remain hidden, even under a chosen ciphertext attack wherein an adversary is allowed to decrypt arbitrary dealings which are decrypted under associated data that is distinct from the associated data used to create the dealing. It is easy to realize a PVSS scheme, if one is not too concerned about efficiency. The idea is to use an ElGamal-like encryption scheme to encrypt each sj bit by bit, and then use a standard non-interactive zero-knowledge proof for the relation (2), which would be based on a standard application of the Fiat-Shamir transform (see [FS86]) to an appropriate Sigma protocol (see [CDS94]). While this yields a polynomial-time scheme, it is not that practical. However, there are many possible ways to optimize this type of scheme. See [Gro21] for the details on the highly optimized PVSS scheme used in the IC. 3.5 The basic DKG protocol Using the PVSS scheme and a consensus protocol, the basic DKG protocol is very simple. 1. Each replica broadcasts a signed dealing of a random secret to all other replicas. Such a signed dealing includes a dealing, along with the identity of the dealer and a signature on the dealing under the dealer’s public signing key. Such a signed dealing is calledvalid if it has the right syntactic form, and the signature and non-interactive zero knowledge proof are valid. 2. Using consensus the replicas agree on a set S of f + 1 valid signed dealings (from distinct dealers). 3. Suppose that the ith dealing in the set S contains the vector of group elements (Ai,0,...,A i,t−1) and the vector of ciphertexts ( ci,1,...,c i,n). Then the public verification key for the threshold signature scheme is V := ∏ i Ai,0. Note that the secret signing key is implicitly defined as x := loggV. 21 Pj’s share of the secret signing key x is xj := ∑ i si,j, where si,j is the decryption of ci,j under Pj’s secret decryption key. The public verification key for replica Pj is Vj := ∏ i t−1∏ k=0 Ajki,k =gxj. Note that the shares xj comprise a t-out-of-n Shamir secret-sharing of x. As such, the λj values appearing in (1) are just Lagrange interpolation coefficients. This establishes the reconstruction property stated in Section 3.1. As for the security property stated in Section 3.1, this can be proved to hold modeling HG′ as a random oracle, and assuming that the PVSS scheme is secure, and that the groups G and G′ (with a pairing) satisfy a certain type of one-more Diffie-Hellman hardness assumption, which can be stated as saying that no efficient adversary can win the following game with non-negligible probability: The challenger chooses µ1,...,µ k∈ Zq andν1,...,ν 𝓁∈ Zq at random, and gives {gµi}ki=1 and{(g′)νj}𝓁j=1 to the adversary. The adversary makes a sequence of queries to the challenger, each of which is a vector of the form {κi,j}i,j, to which the challenger responds with ∏ i,j ( (g′)µiνj )κi,j . To end the game, the adversary outputs a vector {λi,j}i,j and a group element h′∈ G′, and wins the game if h′ =∏ i,j ( (g′)µiνj )λi,j and the output vector {λi,j}i,j is not a linear combination of the query vectors. While this type of one-more Diffie-Hellman assumption is needed in the case where t>f + 1, one can get by with a weaker assumption when t =f + 1 (the so-called co-CDH assumption, on which the security of the ordinary BLS scheme is based). 3.6 A resharing protocol The basic DKG protocol can be easily modified so that instead of creating a sharing of a fresh random secret x, it instead creates a fresh, random sharing of a previously shared secret. • Step 1 of the basic protocol is modified so that each replica broadcasts a signed dealing of its existing share. 22 • Step 2 is modified so that a set of t valid signed dealings is agreed upon. Also, each dealing is verified to ensure that it is indeed a dealing of the appropriate existing share (this means that the value of Ai,0 in the ith dealing should be equal to the old value of Vi). • In Step 3, the computation of the newxj (andVj) values weight the sum (and product) on i Lagrange interpolation coefficients. 4 Peer-to-peer layer The peer-to-peer layer’s task is to transport protocol messages between the replicas in a subnet. These protocol messages consist of • messages used to implement consensus, e.g., block proposals, notarizations, etc. (see Section 5); • ingress messages (see Section 6). Basically, the service provided by the peer-to-peer is a “best effort” broadcast channel: if an honest replica broadcasts a message, then t
프로젝트로 돌아가기