Monero 백서

Monero

원문

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

, (d) and sends Cαe and ˜Koe to the other participants securely. 2. Upon receiving all Cαe , each participant sends the committed information and verifies other participants’ commitments were legitimate. 3. Each participant can compute: 25 ˜Ko,grp =Hn(kv,grprG,u )Hp(Ko,grp) + ∑ e ˜Koe αG = ∑ e αeG αHp(Ko,grp) = ∑ e αeHp(Ko,grp) 4. Each participant computes the challenge 26 c =Hn([αG], [αHp(Ko,grp)]) 5. Each participant does the following: 24 Currently Monero src/wallet/ wallet2.cpp export multi- sig() appears to use a simple sum. 25 If the one-time address corresponds to an i-indexed multisig subaddress, add ˜Ko,grp =... +Hn(kv,grp,i )Hp(Ko,grp) 26 This proof should include domain separation and key prefixing, which we omit for brevity. CHAPTER 9. MULTISIGNATURES IN MONERO 98 (a) defines re =αe−c∗ks,agge (mod l), (b) and sends re to the other participants securely. 6. Each participant can compute 27 rresp = ∑ e re−c∗Hn(kv,grprG,u ) The proof is (c,rresp) with ˜Ko,grp. Verification 1. Check l ˜Ko,grp ?= 0. 2. Compute c′ =Hn([rrespG +c∗Ko,grp], [rrespHp(Ko,grp) +c∗ ˜Ko,grp]). 3. If c = c′ then the key image ˜Ko,grp corresponds to one-time address Ko,grp (except with negligible probability). 9.6 Smaller thresholds At the beginning of this chapter we discussed escrow services, which used 2-of-2 multisig to split signing power between a user and a security company. That setup isn’t ideal, because if the security company is compromised, or refuses to cooperate, your funds may get stuck. We can get around that potentiality with a 2-of-3 multisig address, which has three participants but only needs two of them to sign transactions. An escrow service provides one key and users provide two keys. Users can store one key in a secure location (like a safety deposit box), and use the other for day-to-day purchases. If the escrow service fails, a user can use the secure key and day key to withdraw funds. Multisignatures with sub-N thresholds have a wide range of uses. 9.6.1 1-of-N key aggregation Suppose a group of people want to make a multisig key Kgrp they can all sign with. The solution is trivial: let everyone know the private key kgrp. There are three ways to do this. 1. One participant or sub-coalition selects a key and sends it to everyone else securely. 27 If the one-time address Ko,grp corresponds to an i-indexed multisig subaddress, include rresp =...−c∗Hn(kv,grp,i ) CHAPTER 9. MULTISIGNATURES IN MONERO 99 2. All participants compute private key components and send them securely, using the simple sum as the merged key. 28 3. Participants extend M-of-N multisig to 1-of-N. This might be useful if an adversary has access to the group’s communications. In this case, for Monero, everyone would know the private keys ( kv,grp, 1xN,ks,grp,1xN). Before this section all group keys were N-of-N, but now we use superscript 1xN to denote keys related to 1-of-N signing. 9.6.2 (N-1)-of-N key aggregation In an (N-1)-of-N group key, such as 2-of-3 or 4-of-5, any set of (N-1) participants can sign. We achieve this with Diffie-Hellman shared secrets. Lets say there are participantse∈{ 1,...,N}, with base public keys Kbasee which they are all aware of. Each participant src/multi- sig/multi- sig.cpp generate multisig N1 N() e computes, for w∈{ 1,...,N} but w⁄=e ksh,(N-1)xNe,w =Hn(kbasee Kbasew ) Then he computes allKsh,(N-1)xNe,w =ksh,(N-1)xNe,w G and sends them to the other participants securely. We now use superscript sh to denote keys shared by a sub-group of participants. Each participant will have (N-1) shared private key components corresponding to each of the other participants, making N*(N-1) total keys between everyone. All keys are shared by two Diffie-Hellman partners, so there are really [N*(N-1)]/2 unique keys. Those unique keys compose the set S(N-1)xN. Generalizing premerge and merge This is where we update the definition of premerge from Section 9.2.3. Its input will be the set SMxN, whereM is the ‘threshold’ that the set’s keys are prepared for. WhenM =N, SNxN = Sbase, and when M <N it contains shared keys. The output is Kagg,MxN. The [N*(N-1)]/2 key components in Kagg,(N-1)xN can be sent into merge, outputting Kgrp,(N-1)xN. Importantly, all [N*(N-1)]/2 private key components can be assembled with just (N-1) participants since each participant shares one Diffie-Hellman secret with the N th guy. A 2-of-3 example Say there are three people with public keys {Kbase1 ,Kbase2 ,Kbase3 }, to which they each know a private key, who want to make a 2-of-3 multisig key. After Diffie-Hellman and sending each other the public keys they each know the following: 28 Note that key cancellation is largely meaningless here because everyone knows the full private key. CHAPTER 9. MULTISIGNATURES IN MONERO 100 1. Person 1: ksh,2x31,2 , ksh,2x31,3 , Ksh,2x32,3 2. Person 2: ksh,2x32,1 , ksh,2x32,3 , Ksh,2x31,3 3. Person 3: ksh,2x33,1 , ksh,2x33,2 , Ksh,2x31,2 Where ksh,2x31,2 =ksh,2x32,1 , and so on. The set S2x3 ={Ksh,2x31,2 ,Ksh,2x31,3 ,Ksh,2x32,3 }. Performing premerge and merge creates the group key: 29 Kgrp,2x3 =Hn(Tagg, S2x3,Ksh,2x31,2 )Ksh,2x31,2 + Hn(Tagg, S2x3,Ksh,2x31,3 )Ksh,2x31,3 + Hn(Tagg, S2x3,Ksh,2x32,3 )Ksh,2x32,3 Now let’s say persons 1 and 2 want to sign a message m. We will use a basic Schnorr-like signature to demonstrate. 1. Each participant e∈{ 1, 2} does the following: (a) picks random component αe∈R Zl, (b) computes αeG, (c) commits with Cαe =Hn(Tcom,αeG), (d) and sends Cαe to the other participants securely. 2. On receipt of all Cαe , each participant sends out αeG and verifies the other commitments were legitimate. 3. Each participant computes αG = ∑ e αeG c =Hn(m, [αG]) 4. Participant 1 does the following: (a) computes r1 =α1−c∗ [kagg,2x31,3 +kagg,2x31,2 ], (b) and sends r1 to participant 2 securely. 5. Participant 2 does the following: (a) computes r2 =α2−c∗kagg,2x32,3 , (b) and sends r2 to participant 1 securely. 6. Each participant computes r = ∑ e re 29 Since the merged key is composed of shared secrets, an observer who just knows the original base public keys would not be able to aggregate them (Section 9.2.2) and identify members of the merged key. CHAPTER 9. MULTISIGNATURES IN MONERO 101 7. Either participant can publish the signature σ(m) = (c,r ). The only change with sub-N threshold signatures is how to ‘close the loop’ by defining rπ,e (in the case of ring signatures, with secret index π). Each participant must include their shared secret corresponding to the ‘missing person’, but since all the other shared secrets are doubled up there is a trick. Given the set Sbase of all participants’ original keys, only the first person - ordered by index in Sbase - with the copy of a shared secret uses it to calculate his rπ,e.30,31 In the previous example, participant 1 computes r1 =α1−c∗ [kagg,2x31,3 +kagg,2x31,2 ] while participant 2 only computes r2 =α2−c∗kagg,2x32,3 The same principle applies to computing the group key image in sub-N threshold Monero multisig transactions. 9.6.3 M-of-N key aggregation We can understand M-of-N by adjusting our perspective on (N-1)-of-N. In (N-1)-of-N every shared secret between two public keys, such as Kbase1 and Kbase2 , contains two private keys, kbase1 kbase2 G. It’s a secret because only person 1 can compute kbase1 Kbase2 , and only person 2 can compute kbase2 Kbase1 . What if there is a third person with Kbase3 , there exist shared secrets kbase1 kbase2 G,kbase1 kbase3 G, and kbase2 kbase3 G, and the participants send those public keys to each other (making them no longer secret)? They each contributed a private key to two of the public keys. Now say they make a new shared secret with that third public key. Person 1 src/multi- sig/multi- sig.cpp generate multisig deriv- ations() computes shared secretkbase1 ∗(kbase2 kbase3 G), person 2 computes kbase2 ∗(kbase1 kbase3 G), and person 3 computes kbase3 ∗ (kbase1 kbase2 G). Now they all know kbase1 kbase2 kbase3 G, making a three-way shared secret (so long as no one publishes it). The group could use ksh,1x3 =Hn(kbase1 kbase2 kbase3 G) as a shared private key, and publish Kgrp,1x3 =Hn(Tagg, S1x3,Ksh,1x3)Ksh,1x3 as a 1-of-3 multisig address. 30 In src/wallet/ wallet2.cpp transfer selected rct() practice this means an initiator should determine which subset of M signers will sign a given message. If he discovers O signers are willing to sign, with (O ≥ M), he can orchestrate multiple concurrent signing attempts for each M-size subset within O to increase the chances of one succeeding. It appears Monero uses this approach. It also turns out (an esoteric point) that the original list of output destinations created by the initiator is randomly shuffled, and that random list is then used by all concurrent signing attempts, and all other co-signers (this is related to the obscure flag shuffle outs). 31 Currently Monero appears to use a round-robin signing method src/wallet/ wallet2.cpp sign multi- sig tx() , where the initiator signs with all his private keys, passes the partially signed transaction to another signer who signs with all his private keys (that have not been used to sign with yet), who passes to yet another signer, and so on, until the final signer who can either publish the transaction or send it to other signers so they can publish it. CHAPTER 9. MULTISIGNATURES IN MONERO 102 In a 3-of-3 multisig every 1 person has a secret, in a 2-of-3 multisig every group of 2 people has a shared secret, and in 1-of-3 every group of 3 people has a shared secret. Now we can generalize to M-of-N: every possible group of (N-M+1) people has a shared secret [109]. If (N-M) people are missing, all their shared secrets are owned by at least one of the M remaining people, who can collaborate to sign with the group’s key. M-of-N algorithm Given participants e∈{ 1,...,N} with initial private keys kbase1 ,...,k baseN who wish to produce an M-of-N merged key (M≤ N; M≥ 1 and N≥ 2), we can use an src/wallet/ wallet2.cpp exchange multisig keys() interactive algorithm. We will use Ss to denote all the unique public keys at stage s∈{ 0,..., (N−M)}. The final set SN−M is ordered according to a sorting convention (such as smallest to largest numerically, i.e. lexicographically). This notation is a convenience, and Ss is the same as S(N-s)xN from the previous sections. We will use SKs,e to denote the set of public keys each participant created at stages of the algorithm. In the beginning SK0,e ={Kbasee }. The set Ske will contain each participant’s aggregation private keys at the end. 1. Each participant e sends their original public key set SK0,e ={Kbasee } to the other participants securely. 2. Each participant builds S0 by collecting all SK0,e and removing duplicates. 3. For stage s∈{ 1,..., (N−M)} (skip if M = N) (a) Each participant e does the following: i. For each element gs−1 of Ss−1 /∈ SKs−1,e, compute a new shared secret kbasee ∗ Ss−1[gs−1] ii. Put all new shared secrets in SKs,e. iii. If s = (N−M), compute the shared private key for each element x in SKN−M,e Ske[x] =Hn(SKN−M,e[x]) and overwrite the public key by setting SKN−M,e[x] = Ske[x]∗G. iv. Send the other participants SKs,e. (b) Each participant builds Ss by collecting all SKs,e and removing duplicates. 32 4. Each participant sorts SN−M according to the convention. 5. The premerge function takes S(N−M ) as input, and each aggregation key is, forg∈{ 1,..., (size of SN−M)}, Kagg,MxN[g] =Hn(Tagg, S(N−M ), S(N−M )[g])∗ S(N−M )[g] 32 Participants should keep track of who has which keys at the last stage ( s =N−M), to facilitate collaborative signing, where only the first person in S0 with a certain private key uses it to sign. See Section 9.6.2. CHAPTER 9. MULTISIGNATURES IN MONERO 103 6. The merge function takes Kagg,MxN as input, and the group key is Kgrp,MxN = size of SN−M∑ g=1 Kagg,MxN[g] 7. Each participant e overwrites each element x in Ske with their aggregation private key Ske[x] =Hn(Tagg, S(N−M ), Ske[x]G)∗ Ske[x] Note: If users want to have unequal signing power in a multisig, like 2 shares in a 3-of-4, they should use multiple starting key components instead of reusing the same one. 9.7 Key families Up to this point we have considered key aggregation between a simple group of signers. For example, Alice, Bob, and Carol each contributing key components to a 2-of-3 multisig address. Now imagine Alice wants to sign all transactions from that address, but doesn’t want Bob and Carol to sign without her. In other words, (Alice + Bob) or (Alice + Carol) are acceptable, but not (Bob + Carol). We can achieve that scenario with two layers of key aggregation. First a 1-of-2 multisig aggregation Kagg,1x2BC between Bob and Carol, then a 2-of-2 group key Kgrp,2x2 between Alice and Kagg,1x2BC . Basically, a (2-of-([1-of-1] and [1-of-2])) multisig address. This implies access structures to signing rights can be fairly open-ended. 9.7.1 Family trees We can diagram the (2-of-([1-of-1] and [1-of-2])) multisig address like this: Kgrp,2x2 KbaseA Kagg,1x2BC KbaseB KbaseC CHAPTER 9. MULTISIGNATURES IN MONERO 104 The keys KbaseA ,KbaseB ,KbaseC are considered root ancestors, while Kagg,1x2BC is the child of parents KbaseB andKbaseC . Parents can have more than one child, though for conceptual clarity we consider each copy of a parent as distinct. This means there can be multiple root ancestors that are the same key. For example, in this 2-of-3 and 1-of-2 joined in a 2-of-2, Carol’s key KbaseC is used twice and displayed twice: Kgrp,2x2 Kagg,2x3ABC KbaseA KbaseB KbaseC Kagg,1x2CD KbaseC KbaseD Separate sets S are defined for each multisig sub-coalition. There are three premerge sets in the previous example: S2x3ABC = {Ksh,2x3AB ,Ksh,2x3BC ,Ksh,2x3AC }, S1x2CD = {Ksh,1x2CD }, and S2x3final = {Kagg,2x3ABC , Kagg,1x2CD }. 9.7.2 Nesting multisig keys Suppose we have the following key family Kgrp,2x3 Kgrp,2x3ABC KbaseA KbaseB KbaseC KbaseD KbaseE CHAPTER 9. MULTISIGNATURES IN MONERO 105 If we merge the keys in S2x3ABC corresponding to the first 2-of-3, we run into an issue at the next level. Let’s take just one shared secret, between Kgrp,2x3ABC and KbaseD , to illustrate: kABC,D =Hn(kgrp,2x3ABC KbaseD ) Now, two people from ABC could easily contribute aggregation key components so the sub-coalition can compute kgrp,2x3ABC KbaseD = ∑kagg,2x3ABC KbaseD The problem is everyone from ABC can compute ksh,2x3ABC,D =Hn(kgrp,2x3ABC KbaseD )! If everyone from a lower-tier multisig knows all its private keys for a higher-tier multisig, then the lower-tier multisig might as well be 1-of-N. We get around this by not completely merging keys until the final child key. Instead, we just do premerge for all keys output by low-tier multisigs. Solution for nesting To use Kagg,MxN in a new multisig, we pass it around just like a normal key, with one change. Operations involving Kagg,MxN use each of its member keys, instead of the merged group key. For example, the public ‘key’ of a shared secret between Kagg,2x3x and KbaseA would look like Ksh,1x2x,A ={[Hn(kbaseA Kagg,2x3x [1])∗G], [Hn(kbaseA Kagg,2x3x [2])∗G],...} This way all members of Kagg,2x3x only know shared secrets corresponding to their private keys from the lower-tier 2-of-3 multisig. An operation between a keyset of size two 2KA and keyset of size three 3KB would produce a keyset of size six 6KAB. We can generalize all keys in a key family as keysets, where single keys are denoted 1K. Elements of a keyset are ordered according to some convention (i.e. smallest to largest numerically), and sets containing keysets (e.g. S sets) are ordered by the first element in each keyset, according to some convention. We let the key sets propagate through the family structure, with each nested multisig group send- ing their premerge aggregation set as the ‘base key’ for the next level, 33 until the last child’s aggregation set appears, at which point merge is finally used. Users should store their base private keys, the aggregation private keys for all levels of a multisig family structure, and the public keys for all levels. Doing so facilitates creating new structures, merging nested multisigs, and collaborating with other signers to rebuild a structure if there is a problem. 33 Note that premerge needs to be done to the outputs of all nested multisigs, even when an N’-of-N’ multisig is nested into an N-of-N, because the set S will change. CHAPTER 9. MULTISIGNATURES IN MONERO 106 9.7.3 Implications for Monero Each sub-coalition contributing to the final key needs to contribute components to Monero trans- actions (such as the opening values αG), and so every sub-sub-coalition needs to contribute to its child sub-coalition. This means every root ancestor, even when there are multiple copies of the same key in the family structure, must contribute one root component to their child, and each child one component to its child and so on. We use simple sums at each level. For example, let’s take this family 1Kgrp,2x2 1KbaseA 2Kagg,2x2AB 1KbaseA 1KbaseB Say they need to compute some group value x for a signature. Root ancestors contribute: xA,1, xA,2, xB. The total is x =xA,1 +xA,2 +xB. There are currently no implementations of nested multisig in Monero. CHAPTER 10 Monero in an Escrowed Marketplace Most of the time purchasing from an online retailer goes smoothly. A buyer sends money to a vendor, and the expected product arrives at their doorstep. If the product has a defect, or in some cases if the buyer changes their mind, they can return it and get a refund. It’s difficult to trust a person or organization you have never met, and many shoppers can feel safe in their purchases knowing their credit card company will reverse a payment on request [30]. Cryptocurrency transactions are not reversible, and there is limited legal recourse a buyer or seller can take when something goes wrong, especially for Monero which is not open to easy chain analysis [48]. The cornerstone of robust online shopping with cryptocurrencies is 2-of-3 multisignature- based escrowed exchanges, which enable third parties to mediate disputes. By trusting those third parties, even completely anonymous vendors and shoppers can interact without formality. Since Monero multisig interactions can be rather complex (recall Section 9.4.2), we dedicate this chapter to describing a maximally efficient escrowed shopping environment. 1,2 10.1 Essential features There are several basic requirements and features for streamlined interactions between buyers and sellers online. We take these points from Ren´ e’s OpenBazaar investigation [117], as they are quite 1 Ren´ e “rbrunner7” Brunner, a Monero contributor who created the MMS [116, 115], investigated integrating Monero multisig into the decentralized cryptocurrency-based digital marketplace OpenBazaarhttps://openbazaar. org/. The concepts laid out here are inspired by the hurdles Ren´ e encountered [117] (his ‘earlier analysis’). 2 Our initial impression is Monero’s current implementation of multisig already has a similar transaction creation flow to what we need for an escrowed shopping environment, which is good news for potential implementation efforts. Readers should note that Monero multisig requires some security updates before it can see heavy use [102]. 107 CHAPTER 10. MONERO IN AN ESCROWED MARKETPLACE 108 sensible and extensible. • Offline selling : A buyer should be able to access a vendor’s online shop and place an order while the vendor is offline. Obviously, the vendor must actually go online to receive the order and fulfill it. 3 • Purchase order-based payments: Vendor addresses for receipt of funds are unique for each purchase order, in order to match orders and payments. • High-trust purchasing: A buyer may, if they trust a vendor, pay for a product even before it has been fulfilled or delivered. – Online direct payment : After confirming the vendor is online, and that their product listing is available, the purchaser sends money in a single transaction to the vendor via a vendor-provided address, who then si
프로젝트로 돌아가기