Monero 백서

Monero

원문

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

ily be derived from some password. For example, µs = Hn(password) and µv =Hn(µs). Or, as is done in Monero, mask the spend and view keys with a string src/multisig/ multisig.cpp get multi- sig blind- ed secret key() e.g. µs,µv = “Multisig”. This implies Monero only supports one multisig base spend key per normal address, although in reality making a wallet multisig causes users to lose access to the original wallet [114]. Users must make a new wallet with their normal address to access its funds, assuming the multisig wasn’t made from a brand new normal address. CHAPTER 9. MULTISIGNATURES IN MONERO 89 be kv,basee =Hn(kve,µve) ks,basee =Hn(kse,µse) If participants don’t want observers to gather the new keys and test for key aggregation, they would have to communicate their new key components to each other securely. 5 If key aggregation tests are not a concern, they could publish their public key base components (Kv,basee ,Ks,basee ) as normal addresses. Any third party could then compute the group address from those individual addresses and send funds to it, without interacting with any of the joint recipients [90]. Key cancellation If the group spend key is a sum of public keys, a dishonest participant who learns his collaborators’ spend key base components ahead of time can cancel them. For example, say Alice and Bob want to make a group address. Alice, in good faith, tells Bob her key components ( kv,baseA ,Ks,baseA ). Bob privately makes his key components ( kv,baseB ,Ks,baseB ) but doesn’t tell Alice right away. Instead, he computes K′s,baseB =Ks,baseB −Ks,baseA and tells Alice (kv,baseB ,K′s,baseB ). The group address is: Kv,grp = (kv,baseA +kv,baseB )G =kv,grpG Ks,grp =Ks,baseA +K′s,baseB =Ks,baseA + (Ks,baseB −Ks,baseA ) =Ks,baseB This leaves a group address (kv,grpG,Ks,baseB ) where Alice knows the private group view key, and Bob knows both the private view keyand private spend key! Bob can sign transactions on his own, fooling Alice, who might believe funds sent to the address can only be spent with her permission. We could solve this issue by requiring each participant, before aggregating keys, to make a signature proving they know the private key to their spend key component [109]. 6 This is inconvenient and vulnerable to implementation mistakes. Fortunately a solid alternative is available. 9.2.3 Robust key aggregation To easily resist key cancellation we make a small change to spend key aggregation (leaving view key aggregation the same). Let the set of N signers’ base spend key components be Sbase = 5 As we will see in Section 9.6, key aggregation does not work on M-of-N multisig when M < N due to the presence of shared secrets. 6 Monero’s current (and first) iteration of multisig, made available in April 2018 [62] (with M-of-N integration following in October 2018 [11]), used this naive key aggregation, and required users sign src/wallet/ wallet2.cpp get multi- sig info() their spend key components. CHAPTER 9. MULTISIGNATURES IN MONERO 90 {Ks,base1 ,...,K s,baseN }, ordered according to some convention (such as smallest to largest numerically, i.e. lexicographically). 7 The robust aggregated spend key is [111] 8,9 Ks,grp = ∑ e Hn(Tagg, Sbase,Ks,basee )Ks,basee Now if Bob tries to cancel Alice’s spend key, he gets stuck with a very difficult problem. Ks,grp =Hn(Tagg, S,KsA)KsA +Hn(Tagg, S,K′sB)K′sB =Hn(Tagg, S,KsA)KsA +Hn(Tagg, S,K′sB)KsB−Hn(Tagg, S,K′sB)KsA = [Hn(Tagg, S,KsA)−Hn(Tagg, S,K′sB)]KsA +Hn(Tagg, S,K′sB)KsB We leave Bob’s frustration to the reader’s imagination. Just like with the naive approach, any third party who knows Sbase and the corresponding public view keys can compute the group address. Since participants don’t need to prove they know their private spend keys, or really interact at all before signing transactions, our robust key aggregation meets the so-called plain public-key model, where “the only requirement is that each potential signer has a public key”[90]. 10 Functions premerge and merge More formally, and for the sake of clarity going forward, we can say there is an operationpremerge which takes in a set of base keys Sbase, and outputs a set of aggregation keys Kagg of equal size, where element11 Kagg[e] =Hn(Tagg, Sbase,Ks,basee )Ks,basee The aggregation private keys kagge are used in group signatures. 12 There is another operation merge which takes the aggregation keys from premerge and constructs the group signing key (e.g. spend key for Monero) Kgrp = ∑ e Kagg[e] We generalize these functions for (N-1)-of-N and M-of-N in Section 9.6.2, and further generalize them for nested multisig in Section 9.7.2. 7 Sbase needs to be ordered consistently so participants can be sure they are all hashing the same thing. 8 Recalling Section 3.6, hash functions should be domain separated by prefixing them with tags, e.g. Tagg = “Multisig Aggregation”. We leave tags out for examples like the next section’s Schnorr signatures. 9 It is important to include Sbase in the aggregation hashes to avoid sophisticated key cancellation attacks involving Wagner’s generalized solution to the birthday problem [137]. [139] [90] 10 As we will see later, key aggregation only meets the plain public-key model for N-of-N and 1-of-N multisig. 11 Notation: Kagg[e] is the e th element of the set. 12 Robust key aggregation has not yet been implemented in Monero, but since participants can store and use private keykagge (for naive key aggregation, kagge =kbasee ), updating Monero to use robust key aggregation will only change the premerge process. CHAPTER 9. MULTISIGNATURES IN MONERO 91 9.3 Thresholded Schnorr-like signatures It takes a certain amount of signers for a multisignature to work, so we say there is a ‘threshold’ of signers below which the signature can’t be produced. A multisignature with N participants that requires all N people to build a signature, usually referred to as N-of-N multisig , would have a threshold of N. Later we will extend this to M-of-N (M ≤ N) multisig where N participants create the group address but only M people are needed to make signatures. Let’s take a step back from Monero. All signature schemes in this document lead from Maurer’s general zero-knowledge proof of knowledge [87], so we can demonstrate the essential form of thresholded signatures using a simple Schnorr-like signature (recall Section 2.3.5) [109]. Signature Say there are N people who each have a public key in the setKagg, where each persone∈{ 1,...,N} knows the private key kagge . Their N-of-N group public key, which they will use to sign messages, is Kgrp. Suppose they want to jointly sign a message m. They could collaborate on a basic Schnorr-like signature like this 1. Each participant e∈{ 1,...,N} does the following: (a) picks random component αe∈R Zl, (b) computes αeG (c) commits to it with Cαe =Hn(Tcom,αeG), (d) and sends Cαe to the other participants securely. 2. Once all commitments Cαe have been collected, each participant sends theirαeG to the other participants securely. They must verify that Cαe ?=Hn(Tcom,αeG) for all other participants. 3. Each participant computes αG = ∑ e αeG 4. Each participant e∈{ 1,...,N} does the following: 13 (a) computes the challenge c =Hn(m, [αG]), (b) defines their response component re =αe−c∗kagge (mod l), (c) and sends re to the other participants securely. 5. Each participant computes r = ∑ e re 6. Any participant can publish the signature σ(m) = (c,r ). 13 As in Section 2.3.4, it is important not to reuseαe for different challengesc. This means to reset a multisignature process where responses have been sent out, it should start again from the beginning with new αe values. CHAPTER 9. MULTISIGNATURES IN MONERO 92 Verification GivenKgrp, m, and σ(m) = (c,r ): 1. Compute the challenge c′ =Hn(m, [rG +c∗Kgrp]). 2. If c =c′ then the signature is legitimate except with negligible probability. We included the superscript grp for clarity, but in reality the verifier has no way to tell Kgrp is a merged key unless a participant tells him, or unless he knows the base or aggregation key components. Why it works Response r is the core of this signature. Participant e knows two secrets in re (αe and kagge ), so his private keykagge is information-theoretically secure from other participants (assuming he never reuses αe). Moreover, verifiers use the group public key Kgrp, so all key components are needed to build signatures. rG = ( ∑ e re)G = ( ∑ e (αe−c∗kagge ))G = ( ∑ e αe)G−c∗ ( ∑ e kagge )G =αG−c∗Kgrp αG =rG +c∗Kgrp Hn(m, [αG]) =Hn(m, [rG +c∗Kgrp]) c =c′ Additional commit-and-reveal step The reader may be wondering where Step 2 came from. Without commit-and-reveal [111], a malicious co-signer could learn all αeG before the challenge is computed. This lets him control the challenge produced to some degree, by modifying his own αeG prior to sending it out. He can use the response components collected from multiple controlled signatures to derive other signers’ private keyskagge in sub-exponential time [53], a serious security threat. This threat relies on Wagner’s generalization [137] (see also [139] for a more intuitive explanation) of the birthday problem [141].14 14 Commit-and-reveal is not used in the current implementation of Monero multisig, although it is being looked at for future releases. [102] CHAPTER 9. MULTISIGNATURES IN MONERO 93 9.4 MLSTAG Ring Confidential signatures for Monero Monero thresholded ring confidential transactions add some complexity because MLSTAG (thresh- olded MLSAG) signing keys are one-time addresses and commitments to zero (for input amounts). Recalling Section 4.2.1, a one-time address assigning ownership of a transaction’s tth output to whoever has public address (Kvt,Kst ) goes like this Kot =Hn(rKvt,t )G +Kst = (Hn(rKvt,t ) +kst )G kot =Hn(rKvt,t ) +kst We can update our notation for outputs received by a group address ( Kv,grpt ,Ks,grpt ): Ko,grpt =Hn(rKv,grpt ,t )G +Ks,grpt ko,grpt =Hn(rKv,grpt ,t ) +ks,grpt Just as before, anyone with kv,grpt andKs,grpt can discoverKo,grpt is their address’s owned output, and can decode the Diffie-Hellman term for output amount and reconstruct the corresponding commitment mask (Section 5.3). This also means multisig subaddresses are possible (Section 4.3). Multisig transactions using funds received to a subaddress require some fairly straightforward modifications to the following algorithms, which we mention in footnotes. 15 9.4.1 RCTTypeBulletproof2 with N-of-N multisig Most parts of a multisig transaction can be completed by whoever initiated it. Only the ML- STAG signatures require collaboration. An initiator should do these things to prepare for an RCTTypeBulletproof2 transaction (recall Section 6.2): 1. Generate a transaction private key r∈R Zl (Section 4.2) and compute the corresponding public key rG (or multiple such keys if dealing with a subaddress recipient; Section 4.3). 2. Decide the inputs to be spent ( j∈{ 1,...,m} owned outputs with one-time addresses Ko,grpj and amounts a1,...,a m), and recipients to receive funds (t∈{ 0,...,p − 1} new outputs with amounts b0,...,b p−1 and one-time addresses Kot ). This includes the miner’s fee f and its commitmentfH . Decide each input’s set of decoy ring members. 3. Encode each output’s amount amountt (Section 5.3), and compute the output commitments Cbt . 4. Select, for each input j ∈ {1,...,m − 1}, pseudo output commitment mask components x′j∈R Zl, and compute the mth mask as (Section 5.4) x′m = ∑ t yt− m−1∑ j=1 x′j Compute the pseudo output commitments C′aj . 15 Multisig subaddresses are supported in Monero. CHAPTER 9. MULTISIGNATURES IN MONERO 94 5. Produce the aggregate Bulletproof range proof for all outputs. Recall Section 5.5. 6. Prepare for MLSTAG signatures by generating, for the commitments to zero, seed compo- nentsαzj∈R Zl, and computing αzjG.16 He sends all this information to the other participants securely. Now the group of signers is ready to build input signatures with their private keysks,agge , and the commitments to zeroCaπ,j−C′aπ,j = zjG. MLSTAG RingCT First src/wallet/ wallet2.cpp sign multi- sig tx() they construct the group key images for all inputs j∈{ 1,...,m} with one-time addresses Ko,grpπ,j .17 1. For each input j each participant e does the following: (a) computes partial key image ˜Koj,e =ks,agge Hp(Ko,grpπ,j ), (b) and sends ˜Koj,e to the other participants securely. 2. Each participant can now compute, using uj as the output index in the transaction where Ko,grpπ,j was sent to the multisig address, 18 ˜Ko,grpj =Hn(kv,grprG,uj)Hp(Ko,grpπ,j ) + ∑ e ˜Koj,e Then they build a MLSTAG signature for each input j. 1. Each participant e does the following: (a) generates src/wallet/ wallet2.cpp get multi- sig kLRki() seed components αj,e∈R Zl and computes αj,eG, and αj,eHp(Ko,grpπ,j ), (b) generates, for i∈{ 1,...,v + 1} except i =π, random components ri,j,e and rzi,j,e, (c) computes the commitment Cαj,e =Hn(Tcom,αj,eG,αj,eHp(Ko,grpπ,j ),r 1,j,e,...,r v+1,j,e,rz1,j,e,...,r zv+1,j,e) (d) and sends Cαj,e to the other participants securely. 16 There is no need to commit-and-reveal these since the commitments to zero are known by all signers. 17 IfKo,grpπ,j is built from an i-indexed multisig subaddress, then (from Section 4.3) its private key is a composite: ko,grpπ,j =Hn(kv,grprujKs,grp,i,uj) + ∑ e ks,agge +Hn(kv,grp,i ) 18 If the one-time address corresponds to an i-indexed multisig subaddress, add src/crypto- note basic/ cryptonote format utils.cpp generate key image helper precomp() ˜Ko,grpj =... +Hn(kv,grp,i )Hp(Ko,grpπ,j ) CHAPTER 9. MULTISIGNATURES IN MONERO 95 2. Upon receiving all Cαj,e from the other participants, send all αj,eG,αj,eHp(Ko,grpπ,j ), and ri,j,e and rzi,j,e, and verify each participant’s original commitment was valid. 3. Each participant can compute all αjG = ∑ e αj,eG αjHp(Ko,grpπ,j ) = ∑ e αj,eHp(Ko,grpπ,j ) ri,j = ∑ e ri,j,e rzi,j = ∑ e rzi,j,e 4. Each participant can build the signature loop (see Section 3.5). 5. To finish closing the signature, each participant e does the following: (a) defines rπ,j,e =αj,e−cπks,agge (mod l), (b) and sends rπ,j,e to the other participants securely. 6. Everyone src/ringct/ rctSigs.cpp signMulti- sig() can compute (recall αzj,e was created by the initiator) 19 rπ,j = ∑ e rπ,j,e−cπ∗Hn(kv,grprG,uj) rzπ,j =αzj,e−cπzj (mod l) The signature for input j is σj(m) = (c1,r 1,j,rz1,j,...,r v+1,j,rzv+1,j) with ˜Ko,grpj . Since in Monero the message m and the challenge cπ depend on all other parts of the transaction, any participant who tries to cheat by sending the wrong value, at any point in the whole process, to his fellow signers will cause the signature to fail. The response rπ,j is only useful for the m and cπ it is defined for. 9.4.2 Simplified communication It takes a lot of steps to build a multisignature Monero transaction. We can reorganize and simplify some of them so that signer interactions are encompassed by two parts with five total rounds. 1. Key aggregation for a multisig public address : Anyone with a set of public addresses can run premerge on them and then merge an N-of-N address, but no participant will know the group view key unless they learn all the components, so the group starts by sendingkve andKs,basee to 19 If the one-time address Ko,grpπ,j corresponds to an i-indexed multisig subaddress, include src/crypto- note basic/ cryptonote format utils.cpp generate key image helper precomp() rπ,j =...−cπ∗Hn(kv,grp,i ) CHAPTER 9. MULTISIGNATURES IN MONERO 96 each other securely src/wallet/ wallet2.cpp pack multi- signature keys() . Any participant can premerge and merge and publish (Kv,grp,Ks,grp), allowing the group to receive funds to the group address. M-of-N aggregation requires more steps, which we describe in Section 9.6. 2. Transactions: (a) Some participant or sub-coalition (the initiator) src/wallet/ wallet2.cpp transfer selected rct() decides to write a transaction. They choose m inputs with one-time addresses Ko,grpj and amount commitments Caj , m sets of v additional one-time addresses and commitments to be used as ring decoys, pick p output recipients with public addresses (Kvt,Kst ) and amounts bt to send them, decide a transaction fee f, pick a transaction private key r,20 generate pseudo output com- mitment masks x′j with j⁄= m, construct the ECDH term amountt for each output, produce an aggregate range proof, and generate signature openers αzj for all inputs’ commitments to zero and random scalars ri,j andrzi,j withi⁄=πj.21 They also prepare their contribution for the next communication round. The initiator src/wallet/ wallet2.cpp save multi- sig tx() sends all this information to the other participants securely. 22 The other participants can signal agreement by sending their part of the next communication round, or negotiate for changes. (b) Each participant chooses their opening components for the MLSTAG signature(s), com- mits to them, calculates their partial key images, and sends those commitments and partial images to other participants securely. MLSTAG Signature(s): key image ˜Koj,e, signature randomnessαj,eG, andαj,eHp(Ko,grpπ,j ). Partial key images don’t need to be in committed data, as they can’t be used to extract signers’ private keys. They are also useful for viewing which owned outputs have been spent, so for the sake of modular design should be handled separately. (c) Upon receiving all signature commitments, each participant sends the committed in- formation to the other participants securely. (d) Each participant closes their part of the MLSTAG signature(s), sending all rπj,j,e to the other participants securely. 23 Assuming the process went well, all participants can finish writing the transaction and broadcast it on their own. Transactions authored by a multisig coalition are indistinguishable from those authored by individuals. 20 Or transaction private keys rt if sending to at least one subaddress. 21 Note that we simplify the signing process by letting the initiator generate random scalars ri,j andrzi,j, instead of each co-signer generating components that eventually get summed together. 22 He doesn’t need to send the output amounts bt directly, as they can be computed from amountt. Monero takes the reasonable approach of creating a partial transaction filled with the information selected by the initiator, and sending that to other cosigners along with a list of related information like transaction private keys, destination addresses, the real inputs, etc. 23 It is imperative that each signing attempt by a signer use a unique αj,e, to avoid leaking his private spend key to other signers (recall Section 2.3.4) [111]. Wallets should fundamentally enforce this by always deleting src/wallet/ wallet2.cpp save multi- sig tx() αj,e whenever a response that uses it has been transmitted outside of the wallet. CHAPTER 9. MULTISIGNATURES IN MONERO 97 9.5 Recalculating key images If someone loses their records and wants to calculate their address’s balance (received minus spent funds), they need to check the blockchain. View keys are only useful for reading received funds, so users need to calculate key images for all owned outputs to see if they have been spent, by comparing with key images stored in the blockchain. Since members of a group address can’t compute key images on their own, they need to enlist the other participants’ help. Calculating key images from a simple sum of components might fail if dishonest participants report false keys.24 Given a received output with one-time addressKo,grp, the group can produce a simple ‘linkable’ Schnorr-like proof (basically single-key bLSTAG, recall Sections 3.1 and 3.4) to prove the key image ˜Ko,grp is legitimate without revealing their private spend key components or needing to trust each other. Proof 1. Each participant e does the following: (a) computes ˜Koe =ks,agge Hp(Ko,grp), (b) generates seed component αe∈R Zl and computes αeG and αeHp(Ko,grp), (c) commits to the data with Cαe =Hn(Tcom,αeG,αeHp(Ko,grp))
프로젝트로 돌아가기