Monero 백서

Monero

원문

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

of() They are prefixed with the string “InProofV2”, and each item (encoded in base-58) contains the sender-receiver shared secret rKv (or rKv,i), and its corresponding σinproof . Verification 1. Calculate the challenge src/crypto/ crypto.cpp check tx proof() (a) Normal address: c′ =Hn(m, [rKv], [rrespG +c∗Kv], [rresp∗rG +c∗kv∗rG], [Ttxprf 2], [Kv], [rG], [0]) (b) Subaddress: c′ =Hn(m, [rKv,i], [rrespKs,i+c∗Kv,i], [rresp∗rKs,i+c∗kv∗rKs,i], [Ttxprf 2], [Kv,i], [rKs,i], [Ks,i]) 2. If c =c′ then the prover knows kv, and kv∗rG is legitimately a shared secret between Kv and rG (except with negligible probability). Prove ‘full’ ownership with the one-time address key While an InProof shows a one-time address was constructed with a specific address (except with negligible probability), it doesn’t necessarily mean the prover can spend that output. Only those who can spend an output actually own it. Proving ownership, once an InProof is complete, is as simple as signing a message with the spend key.8 8 The ability to provide such a signature directly does not seem to be available in Monero, although as we will see ReserveProofs (Section 8.1.6) do include them. CHAPTER 8. MONERO TRANSACTION-RELATED KNOWLEDGE PROOFS 81 8.1.5 Prove an owned output was not spent in a transaction (UnspentProof) It would seem like proving an output is spent or unspent is as simple as recreating its key image with a multi-base proof on J ={G,Hp(Ko)} andK ={Ko, ˜K}. While this does obviously work, verifiers must learn the key image, which also reveals when an unspent output is spent in the future. It turns out we can prove an output wasn’t spent in a specific transaction without revealing the key image. Moreover, we can prove it is currently unspent full stop , by extending this UnspentProof [130] to ‘all the transactions where it was included as a ring member’. 9 More specifically, our UnspentProof says that a given key image from a transaction on the blockchain does, or does not, correspond with a specific one-time address from its correspond- ing ring. Incidentally, as we will see, UnspentProofs go hand-in-hand with InProofs. Setting up an UnspentProof The verifier of an UnspentProof must know rKv, the sender-receiver shared secret for a given owned output with one-time address Ko and transaction public key rG. He either knows the view keykv, which allowed him to calculatekv∗rG and checkKo−Hn(kv∗rG,t )∗G ?=Ks so he knows the output being tested belongs to the prover (recall Section 4.2), or the prover provided rKv. This is where InProofs come in, since with an InProof the verifier can be assured rKv legitimately came from the prover’s view key, and corresponds with an owned output, without learning the private view key. Before verifying an UnspentProof, the verifier will learn the key image to be tested ˜K?, and checks that its corresponding ring includes the prover’s owned output’s one-time address Ko. He then calculates the partial ‘spend’ image ˜Ks?. ˜Ks? = ˜K?−Hn(rKv,t )∗Hp(Ko) If the tested key image was created from Ko then the resultant point will be ˜Ks? =ks∗Hp(Ko). The UnspentProof Our prover creates two multi-base proofs (recall Section 3.1). His address, which owns the output in question, is (Kv,Ks) or (Kv,i,Ks,i).10 1. A 3-base proof, where the signing key is ks, and Junspent3 ={[G], [Ks], [ ˜Ks?]} Kunspent3 ={[Ks], [ks∗Ks], [ks∗ ˜Ks?]} 9 UnspentProofs have not been implemented in Monero. 10 UnspentProofs are made the same way for subaddresses and normal addresses. The full spend key of a subad- dress is required, e.g. ks,i =ks +Hn(kv,i ) (Section 4.3). CHAPTER 8. MONERO TRANSACTION-RELATED KNOWLEDGE PROOFS 82 2. A 2-base proof, where the signing key is ks∗ks, and Junspent2 ={[G], [Hp(Ko)]} Kunspent2 ={[ks∗Ks], [ks∗ks∗Hp(Ko)]} Along with proofs σunspent3 and σunspent2 , the prover makes sure to communicate the public keys ks∗Ks, ks∗ ˜Ks?, and ks∗ks∗Hp(Ko). Verification 1. Confirm σunspent3 and σunspent2 are legitimate. 2. Make sure the same public key ks∗Ks was used in both proofs. 3. Check whether ks∗ ˜Ks? and ks∗ks∗Hp(Ko) are the same. If they are, the output is spent, and if not it is unspent (except with negligible probability). Why it works This seemingly roundabout approach prevents the verifier from learningks∗Hp(Ko) for an unspent output, which he could use in combination with rKv to compute its real key image, while leaving him confident the tested key image doesn’t correspond to that output. Proofσunspent2 can be reused for any number of UnspentProofs involving the same output, although if it actually was spent then only one is really necessary (i.e. UnspentProofs can also be used to demonstrate an output is spent). Performing UnspentProofs on all ring signatures where a given unspent output was referenced should not be computationally expensive. An output is only likely, over time, to be included as decoys in on the order of 11 (current ring size) different rings. 8.1.6 Prove an address has a minimum unspent balance ( ReserveProofV2) Despite the privacy leak of revealing an output’s key image when it isn’t spent yet, it’s still a somewhat useful method and was implemented in Monero [126] before UnspentProofs were invented [130]. Monero’s so-called ‘ReserveProof’ src/wallet/ wallet2.cpp get rese- rve proof() is used to prove an address owns a minimum amount of money by creating key images for some unspent outputs. More specifically, given a minimum balance, the prover finds enough unspent outputs to cover it, demonstrates ownership with InProofs, makes key images for them and proves they are legitimately based on those outputs with 2-base proofs (using a different key prefixing format), and then proves knowledge of the private spend keys used with normal Schnorr signatures (there may be more than one if some outputs are owned by different subaddresses). A verifier can check that the key images have not appeared on the blockchain, and hence their outputs must be unspent. CHAPTER 8. MONERO TRANSACTION-RELATED KNOWLEDGE PROOFS 83 The ReserveProof All the sub-proofs within a ReserveProof sign a different message than other proofs (e.g. Out- Proofs, InProofs, or SpendProofs). This time it is m =Hn(message, address, ˜Ko1,..., ˜Kon), where address is the encoded form (see [5]) of the prover’s normal address (Kv,Ks), and the key images correspond with unspent outputs to be included in the proof. 1. Each output has an InProof, which shows the prover’s address (or one of his subaddresses) owns the output. 2. Each output’s key image is signed with a 2-base proof src/crypto/ crypto.cpp generate ring signa- ture() , where the challenge is formatted like this c =Hn(m, [rG +c∗Ko], [rHp(Ko) +c∗ ˜K]) 3. Each address (and subaddress) that owns at least one output has a normal Schnorr signa- ture (Section 2.3.5), and the challenge looks like (it’s the same for normal addresses and subaddresses) src/crypto/ crypto.cpp generate signature() c =Hn(m,Ks,i, [rG +c∗Ks,i]) To send a ReserveProof to someone else src/wallet/ wallet2.cpp get rese- rve proof() , the prover concatenates prefix string “ ReserveProofV2” with two lists encoded in base-58 (e.g. “ ReserveProofV2, list 1, list 2”). Each item in list 1 is related to a specific output and contains its transaction hash (Section 7.4.1), output index in that transaction (Section 4.2.1), the relevant shared secret rKv, its key image, its InProof σinproof , and its key image proof. List 2 items are the addresses that own those outputs along with their Schnorr signatures. Verification 1. Check the ReserveProof key images have not appeared in the blockchain. src/wallet/ wallet2.cpp check rese- rve proof() 2. Verify the InProof for each output, and that one of the provided addresses owns each one. 3. Verify the 2-base key image signatures. 4. Use the sender-receiver shared secrets to decode the output amounts (Section 5.3). 5. Check each address’s signature. If everything is legitimate, then the prover must own, unspent, at least the total amount contained in the ReserveProof’s outputs (except with negligible probability). 11 11 ReserveProofs, while demonstrating full ownership of funds, do not include proofs that given subaddresses actually correspond with the prover’s normal address. CHAPTER 8. MONERO TRANSACTION-RELATED KNOWLEDGE PROOFS 84 8.2 Monero audit framework In the USA most companies undergo yearly audits of their financial statements [129], which include the income statement, balance sheet, and cash flow statement. Of these the former two involve in large part a company’s internal record-keeping, while the last involves every transaction that affects how much money the company currently has. Cryptocurrencies are digital cash, so any audit of a cryptocurrency user’s cash flow statement must relate to transactions stored on the blockchain. The first task of an audited person is to identify all the outputs they currently own (spent and unspent). This can be one with InProofs using all of their addresses. A large business may have a multitude of subaddresses, especially retailers operating in online marketplaces (see Chapter 10). Creating InProofs on all transactions for every single subaddress may result in enormous computational and storage requirements for both provers and verifiers. Instead, we can make InProofs for just the prover’s normal addresses (on all transactions). The auditor uses those sender-receiver shared secrets to check if any outputs are owned by the prover’s main address or its related subaddresses. Recalling Section 4.3, a user’s view key is enough to identify all outputs owned by an address’s subaddresses. To ensure the prover is not hoodwinking an auditor by hiding the normal address for some of his subaddresses, he also must prove all subaddresses correspond with one of his known normal addresses. 8.2.1 Prove an address and subaddress correspond (SubaddressProof) SubaddressProofs show that a normal address’s view key can be used to identify outputs owned by a given subaddress. 12 The SubaddressProof SubaddressProofs can be made in much the same way as OutProofs and InProofs. Here the base keys areJ ={G,Ks,i}, public keys are K ={Kv,Kv,i}, and signing key is kv. Again, we show just the verification step to clarify our meaning. Verification A verifier knows the prover’s address ( Kv,Ks), subaddress ( Kv,i,Ks,i), and has the Subad- dressProof σsubproof = (c,r ). 12 SubaddressProofs have not been implemented in Monero. CHAPTER 8. MONERO TRANSACTION-RELATED KNOWLEDGE PROOFS 85 1. Calculate the challenge c′ =Hn(m, [Kv,i], [rG +c∗Kv], [rKs,i +c∗Kv,i], [Ttxprf 2], [Kv], [Ks,i], [0]) 2. If c =c′ then the prover knowskv forKv, andKs,i in combination with that view key makes Kv,i (except with negligible probability). 8.2.2 The audit framework Now we are prepared to learn as much as possible about a person’s transaction history. 13 1. The prover gathers a list of all his accounts, where each account consists of a normal address and various subaddresses. He makes SubaddressProofs for all subaddresses. Much like ReserveProofs, he also makes a signature with the spend key of each address and subaddress, demonstrating he has spend-rights over all outputs owned by those addresses. 2. The prover generates, for each of his normal addresses, InProofs on all transactions (e.g. all transaction public keys) in the blockchain. This reveals to the auditor all outputs owned by the prover’s addresses since they can check all one-time addresses with the sender-receiver shared secrets. They can be sure outputs owned by subaddresses will be identified, because of the SubaddressProofs. 14 3. The prover generates, for each of his owned outputs, UnspentProofs on all transaction inputs where they appear as ring members. Now the auditor will know the prover’s balance, and can further investigate spent outputs. 15 4. Optional: The prover generates, for each transaction where he spent an output, an OutProof to show the auditor the recipient and amount. This step is only possible for transactions where the prover saved the transaction private key(s). Importantly, a prover has no way to show the origin of funds directly. His only recourse is to request a set of proofs from people sending him money. 1. For a transaction sending money to the prover, its author makes a SpendProof demonstrating they actually sent it. 2. The prover’s funder also makes a signature with an identifying public key, for example the spend key of their normal address. Both the SpendProof and this signature should sign a message containing that identifying public key, to ensure the SpendProof wasn’t stolen or in fact made by someone else. 13 This audit framework is not completely available in Monero. SubaddressProofs and UnspentProofs are not implemented, InProofs are not prepared for the optimization related to subaddresses that we explained, and there is no real structure to easily get or organize all the necessary information for both provers and verifiers. 14 This step can also be completed by providing the private view keys, although it has obvious privacy implications. 15 Alternatively, he could make ReserveProofs for all owned outputs. Again, revealing the key images of unspent outputs has obvious privacy implications. CHAPTER 9 Multisignatures in Monero Cryptocurrency transactions are not reversible. If someone steals private keys or succeeds in a scam, the money lost could be gone forever. Dividing signing power between people can weaken the potential danger of a miscreant. Say you deposit money into a joint account with a security company that monitors for suspicious activity related to your account. Transactions can only be signed if both you and the company cooperate. If someone steals your keys, you can notify the company there is a problem and the company will stop signing transactions for your account. This is usually called an ‘escrow’ service.1 Cryptocurrencies use a ‘multisignature’ technique to achieve collaborative signing with so-called ‘M-of-N multisig’. In M-of-N, N people cooperate to make a joint key, and only M people (M ≤ N) are needed to sign with that key. We begin this chapter by introducing the basics of N-of-N multisig, progress into N-of-N Monero multisig, generalize for M-of-N multisig, and then explain how to nest multisig keys inside other multisig keys. In this chapter we focus on how we feel multisig should be done, based on the recommendations in [111], and various observations about efficient implementation. We try to point out in foot- notes where the current implementation deviates from what is described. 2 Our contributions are detailing M-of-N multisig, and a novel approach to nesting multisig keys. 1 Multisignatures have a diversity of applications, from corporate accounts to newspaper subscriptions to online marketplaces. 2 As of this writing we are aware of three multisig implementations. First is a very basic manual process using the CLI (command line interface) [114]. Second is the truly excellent MMS (Multisig Messaging System) which enables 86 CHAPTER 9. MULTISIGNATURES IN MONERO 87 9.1 Communicating with co-signers Building joint keys and joint transactions requires communicating secret information between people who could be located all around the globe. To keep that information secure from observers, co-signers need to encrypt the messages they send each other. Diffie-Hellman exchange (ECDH) is a very simple way to encrypt messages using elliptic curve cryptography. We already mentioned this in Section 5.3, where Monero output amounts are communicated to recipients via the shared secret rKv. It looked like this: amountt =bt⊕8Hn(“amount”,Hn(rKvB,t )) We could easily extend this to any message. First encode the message as a series of bits, then break it into chunks equal in size to the output of Hn. Generate a random number r∈ Zl and perform a Diffie-Hellman exchange on all the message chunks using the recipient’s public key K. Send those encrypted chunks along with the public keyrG to the intended recipient, who can then decrypt the message with the shared secret krG. Message senders should also create a signature on their encrypted message (or just the encrypted message’s hash for simplicity) so receivers can confirm messages weren’t tampered with (a signature is only verifiable on the correct message m). Since encryption src/wallet/ wallet2.cpp export multisig() is not essential to the operation of a cryptocurrency like Monero, we do not feel it necessary to go into more detail. Curious readers can look at this excellent conceptual overview [4], or see a technical description of the popular AES encryption scheme here [23]. Also, Dr. Bernstein developed an encryption scheme known as ChaCha [37, 100], which the primary Monero implementation uses to encrypt certain sensitive information src/wallet/ ringdb.cpp related to users’ wallets (such as key images for owned outputs). 9.2 Key aggregation for addresses 9.2.1 Naive approach Let’s say N people want to create a group multisignature address, which we denote (Kv,grp,Ks,grp). Funds can be sent to that address just like any normal address, but, as we will see later, to spend those funds all N people have to work together to sign transactions. Since all N participants should be able to view funds received by the group address, we can let everyone know the group view key kv,grp (recall Sections 4.1 and 4.2). To give all participants equal power, the view key can be a sum of view key components that all participants send each secure, highly automated multisig via the CLI [115, 116]. Third is the commercially available ‘Exa Wallet’, which has initial release code available on their Github repository at https://github.com/exantech (it does not appear up to date with current release version). All three of these rely on the same fundamental core team’s codebase, which essentially means only one implementation exists. CHAPTER 9. MULTISIGNATURES IN MONERO 88 other securely. For participant e∈{ 1,...,N}, his base view key component is kv,basee ∈R Zl, and all participants can compute the group private view key src/multi- sig/multi- sig.cpp generate multisig view sec- ret key() kv,grp = N∑ e=1 kv,basee In a similar fashion, the group spend key Ks,grp = ks,grpG could be a sum of private spend key base components. However, if someone knows all the private spend key components then they know the total private spend key. Add in the private view key and he can sign transactions on his own. It wouldn’t be multisignature, just a plain old signature. Instead, src/multi- sig/multi- sig.cpp generate multisig N N() we get the same effect if the group spend key is a sum of public spend keys. Say the participants have base public spend keys Ks,basee which they send each other securely. Now let them each compute Ks,grp = ∑ e Ks,basee Clearly this is the same as Ks,grp = (∑ e ks,basee )∗G 9.2.2 Drawbacks to the naive approach Using a sum of public spend keys is intuitive and seemingly straightforward, but leads to a couple issues. Key aggregation test An outside adversary who knows all the base public spend keys Ks,basee can trivially test a given public address ( Kv,Ks) for key aggregation by computing Ks,grp = ∑eKs,basee and checking Ks ?= Ks,grp. This ties in with a broader requirement that aggregated keys be indistinguishable from normal keys, so observers can’t gain any insight into users’ activities based on the kind of address they publish. 3 We can get around this by creating new base spend keys for each multisignature address, or by masking old keys. The former case is easy, but may be inconvenient. The second case proceeds like this: given participant e’s old key pair (Kve,Kse) with private keys (kve,kse) and random masks µve,µse,4 let his new base private key components for the group address 3 If at least one honest participant uses components selected randomly from a uniform distribution, then keys aggregated by a simple sum are indistinguishable [122] from normal keys. 4 The random masks could eas
프로젝트로 돌아가기