bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 19쪽 중 5쪽
,..., [ri,mG+ciKi,m], [ri,mHp(Ki,m)+ci ˜Km])
5. Define all rπ,j =αj−cπkπ,j (mod l).
The signature will be σ(m) = (c1,r 1,1,...,r 1,m,...,r n,1,...,r n,m), with key images ( ˜K1,..., ˜Km).
Verification
Verification of a signature is done in the following manner:
1. For all j∈{ 1,...,m} checkl ˜Kj ?= 0.
2. For i = 1,...,n compute, replacing n + 1→ 1,
c′i+1 =Hn(m, [ri,1G +ciKi,1], [ri,1Hp(Ki,1) +ci ˜K1],..., [ri,mG +ciKi,m], [ri,mHp(Ki,m) +ci ˜Km])
3. If c1 =c′1 then the signature is valid.
Why it works
Just as with the SAG algorithm, we can readily observe that
• If i⁄=π, then clearly the values c′i+1 are calculated as described in the signature algorithm.
• If i =π then, since rπ,j =αj−cπkπ,j closes the loop,
rπ,jG +cπKπ,j = (αj−cπkπ,j)G +cπKπ,j =αjG
and
rπ,jHp(Kπ,j) +cπ ˜Kj = (αj−cπkπ,j)Hp(Kπ,j) +cπ ˜Kj =αjHp(Kπ,j)
In other words, it holds also that c′π+1 =cπ+1.
Linkability
If a private keykπ,j is re-used to make any signature, the corresponding key image ˜Kj supplied in
the signature will reveal it. This observation matches our generalized definition of linkability. 17
Space requirements
In this scheme we store (1+m∗n) integers, have m EC key images, and use m∗n public keys.
17 As with bLSAG, linked MLSAG signatures do not indicate which public key was used to sign it. However,
if the linking key image’s sub-loops’ rings have only one key in common, the culprit is obvious. If the culprit is
identified, all other signing members of both signatures are revealed since they share the culprit’s indices.
CHAPTER 3. ADVANCED SCHNORR-LIKE SIGNATURES 34
3.6 Concise Linkable Spontaneous Anonymous Group (CLSAG)
signatures
CLSAG [67]18 is sort of half-way between bLSAG and MLSAG. Suppose you have a ‘primary’ key,
and associated with it are several ‘auxiliary’ keys. It is important to prove knowledge of all private
keys, but linkability only applies to the primary. This linkability retraction allows smaller, faster
signatures than afforded by MLSAG.
As with MLSAG, we have a set of n·m keys (n is the ring size, m is the number of signing keys),
and the primary keys are at index 1. In other words, there are n primary keys, and the πth such
key and its auxiliaries will sign.
R ={Ki,j} for i∈{ 1, 2,...,n} and j∈{ 1, 2,...,m}
We know the private keys{kπ,j} corresponding to the subset {Kπ,j} for some index i =π.
Signature
1. Calculate key images ˜Kj =kπ,jHp(Kπ,1) for allj∈{ 1, 2,...,m}. Note the base key is always
the same, and so key images with j >1 are ‘auxiliary key images’. For notational simplicity
we call them all ˜Kj.
2. Generate random numbers α∈R Zl, and ri∈R Zl for i∈{ 1, 2,...,n} (except i =π).
3. Calculate aggregate public keys Wi for i∈{ 1, 2,...,n}, and aggregate key image ˜W 19
Wi =
m∑
j=1
Hn(Tj,R, ˜K1,..., ˜Km)∗Ki,j
˜W =
m∑
j=1
Hn(Tj,R, ˜K1,..., ˜Km)∗ ˜Kj
where wπ = ∑jHn(Tj,... )∗kπ,j is the aggregate private key.
4. Compute
cπ+1 =Hn(Tc,R, m, [αG], [αHp(Kπ,1)])
5. For i =π + 1,π + 2,...,n, 1, 2,...,π − 1 calculate, replacing n + 1→ 1,
ci+1 =Hn(Tc,R, m, [riG +ciWi], [riHp(Ki,1) +ci ˜W ])
6. Define rπ =α−cπwπ (mod l).
Therefore σ(m) = (c1,r 1,...,r n), with primary key image ˜K1, and auxiliary images ( ˜K2,..., ˜Km).
18 The paper this section is based on is a pre-print being finalized for external review. CLSAG is promising as a
replacement for MLSAG in future protocol versions, but has not been implemented, and might not be in the future.
19 The CLSAG paper says to use different hash functions for domain separation, which we model by prefixing
each hash with a tag [67], e.g. T1 = “CLSAG 1”, Tc = “CLSAG c”, etc. Domain separated hash functions have
different outputs even with the same inputs. We also use key prefixing here (including R, which has all the keys, in
the hash). Domain separating is a new policy for Monero development, and will likely be done with all applications
of hash functions added in the future (v13+). Historical uses of hash functions will probably be left alone.
CHAPTER 3. ADVANCED SCHNORR-LIKE SIGNATURES 35
Verification
The verification of a signature is done in the following manner:
1. For all j∈{ 1,...,m} checkl ˜Kj ?= 0.20
2. Calculate aggregate public keys Wi for i∈{ 1, 2,...,n}, and aggregate key image ˜W
Wi =
m∑
j=1
Hn(Tj,R, ˜K1,..., ˜Km)∗Ki,j
˜W =
m∑
j=1
Hn(Tj,R, ˜K1,..., ˜Km)∗ ˜Kj
3. For i = 1,...,n compute, replacing n + 1→ 1,
ci+1 =Hn(Tc,R, m, [riG +ciWi], [riHp(Ki,1) +ci ˜W ])
4. If c1 =c′1 then the signature is valid.
Why it works
The biggest danger in concise signatures like this is key cancellation, where the key images reported
aren’t legitimate, yet still sum to a legitimate aggregate value. This is where the aggregation
coefficientsHn(Tj,R, ˜K1,..., ˜Km) come into play, locking down each key to its expected value.
We leave tracing out the circular repercussions of faking a key image as an exercise to the reader
(perhaps start by imagining those coefficients don’t exist). Auxiliary key images are an artifact
of proving the primary image is legitimate, since the aggregate private key wπ, which contains all
the private keys, is applied to base point Hp(Kπ,1).
Linkability
If a private key kπ,1 is re-used to make any signature, the corresponding primary key image ˜K1
supplied in the signature will reveal it. Auxiliary key images are ignored, as they only exist to
facilitate the ‘Concise’ part of CLSAG.
Space requirements
We store (1+n) integers, have m key images, and use m∗n public keys.
20 In Monero we would only check l∗ ˜K1 ?= 0 for the primary key image. Auxiliary keys would be stored as
(1/8)∗ ˜Kj, and during verification multiplied by 8 (recall Section 2.3.1), which is more efficient. The method
discrepancy is an implementation choice, since linkable key images are very important and so shouldn’t be messed
with aggressively, and the other method was employed in prior protocol versions.
CHAPTER 4
Monero Addresses
The ownership of digital currency stored in a blockchain is controlled by so-called ‘addresses’.
Addresses are sent money which only the address-holder can spend. 1
More specifically, an address owns the ‘outputs’ from some transactions, which are like notes giving
the address-holder spending rights to an ‘amount’ of money. Such a note might say “Address C
now owns 5.3 XMR”.
To spend an owned output, the address-holder references it as the input to a new transaction.
This new transaction has outputs owned by other addresses (or by the sender’s address, if the
sender wants). A transaction’s total input amount equals its total output amount, and once spent
an owned output can’t be respent. Carol, who has Address C, could reference that old output in
a new transaction (e.g. “In this transaction I’d like to spend that old output.”) and add a note
saying “Address B now owns 5.3 XMR”.
An address’s balance is the sum of amounts contained in its unspent outputs. 2
We discuss hiding the amount from observers in Chapter 5, the structure of transactions in Chapter
6 (which includes how to prove you are spending an owned and previously unspent output, without
even revealing which output is being spent), and the money creation process and role of observers
in Chapter 7.
1 Except with negligible probability.
2 Computer applications known as ‘wallets’ are used to find and organize the outputs owned by an address, to
maintain custody of its private keys for authoring new transactions, and to submit those transactions to the network
for verification and inclusion in the blockchain.
36
CHAPTER 4. MONERO ADDRESSES 37
4.1 User keys
Unlike Bitcoin, Monero users have two sets of private/public keys, (kv,Kv) and (ks,Ks), generated
as described in Section 2.3.2.
The address src/
common/
base58.cpp
encode
addr()
of a user is the pair of public keys (Kv,Ks). Her private keys will be the correspond-
ing pair (kv,ks).3
Using two sets of keys allows function segregation. The rationale will become clear later in this
chapter, but for the moment let us call private keykv the view key, andks the spend key. A person
can use their view key to determine if their address owns an output, and their spend key will allow
them to spend that output in a transaction (and retroactively figure out it has been spent). 4
4.2 One-time addresses
To receive money, a Monero user may distribute their address to other users, who can then send
it money via transaction outputs.
The address is never used directly.5 Instead, a Diffie-Hellman-like exchange is applied to it, creating
a unique one-time address for each transaction output to be paid to the user. In this way, even
external observers who know all users’ addresses cannot use them to identify which user owns any
given transaction output. 6
Let’s start with a very simple mock transaction, containing exactly one output — a payment of
‘0’ amount from Alice to Bob.
Bob has private/public keys (kvB,ksB) and (KvB,KsB), and Alice knows his public keys (his address).
The mock transaction could proceed as follows [136]:
1. Alice generates a random number r∈R Zl, and calculates the one-time address 7
3 To communicate an address to other users, it is extremely common to encode it in base-58, a binary-to-text
encoding scheme first created for Bitcoin [28]. See [5] for more details.
4 It src/wallet/
api/wallet.cpp
create()
wallet2.cpp
generate()
get seed()
is currently most common for the view key kv to equalHn(ks). This means a person only needs to save their
spend key ks in order to access (view and spend) all of the outputs they own (spent and unspent). The spend key
is typically represented as a series of 25 words (where the 25th word is a checksum). Other, less popular methods
include: generating kv and ks as separate random numbers, or generating a random 12-word mnemonic a, where
ks = sc reduce32(Keccak(a)) and kv = sc reduce32(Keccak(Keccak(a))). [5]
5 The method described here is not enforced by the protocol, just by wallet implementation standards. This
means an alternate wallet could follow the style of Bitcoin where recipients’ addresses are included directly in
transaction data. Such a non-compliant wallet would produce transaction outputs unusable by other wallets, and
each Bitcoin-esque address could only be used once due to key image uniqueness.
6 Except with negligible probability.
7 In src/crypto/
crypto.cpp
generate
key deri-
vation()
Monero, every instance (including when it’s used for other parts of the transaction) of rkvG is multiplied
by the cofactor 8, so in this case Alice computes 8 ∗rKvB and Bob computes 8 ∗kvBrG. As far as we can tell this
serves no purpose (but it is a rule that users must follow). Multiplying by the cofactor ensures the resulting point
is in G’s subgroup, but if R and Kv don’t share a subgroup to begin with, then the discrete logs r and kv can’t be
used to make a shared secret regardless.
CHAPTER 4. MONERO ADDRESSES 38
Ko =Hn(rKvB)G +KsB src/crypto/
crypto.cpp
derive pu-
blic key()
2. Alice sets Ko as the addressee of the payment, adds the output amount ‘0’ and the value
rG to the transaction data, and submits it to the network.
3. Bob src/crypto/
crypto.cpp
derive
subaddress
public
key()
receives the data and sees the values rG and Ko. He can calculate kvBrG = rKvB. He
can then calculate K′sB = Ko−H n(rKvB)G. When he sees that K′sB = KsB, he knows the
output is addressed to him. 8
The private key kvB is called the ‘view key’ because anyone who has it (and Bob’s public
spend key KsB) can calculate K′sB for every transaction output in the blockchain (record of
transactions), and ‘view’ which ones belong to Bob.
4. The one-time keys for the output are:
Ko =Hn(rKvB)G +KsB = (Hn(rKvB) +ksB)G
ko =Hn(rKvB) +ksB
To spend his ‘0’ amount output [sic] in a new transaction, all Bob needs to do is prove ownership
by signing a message with the one-time key Ko. The private key ksB is the ‘spend key’ since it
is required for proving output ownership, while kvB is the ‘view key’ since it can be used to find
outputs spendable by Bob.
As will become clear in Chapter 6, without ko Alice can’t compute the output’s key image, so she
can never know for sure if Bob spends the output she sent him. 9
Bob may give a third party his view key. Such a third party could be a trusted custodian, an
auditor, a tax authority, etc. Somebody who could be allowed read access to the user’s trans-
action history, without any further rights. This third party would also be able to decrypt the
output’s amount (to be explained in Section 5.3). See Chapter 8 for other ways Bob could provide
information about his transaction history.
4.2.1 Multi-output transactions
Most transactions will contain more than one output. If nothing else, to transfer ‘change’ back to
the sender.10,11
8K′sB is computed with derive subaddress public key() because normal address spend keys are stored at index
0 in the spend key lookup table, while subaddresses are at indices 1,2... This will make sense soon: see Section 4.3.
9 Imagine Alice produces two transactions, each containing the same one-time output address Ko that Bob can
spend. Since Ko only depends on r and KvB, there is no reason she can’t do it. Bob can only spend one of those
outputs because each one-time address only has one key image, so if he isn’t careful Alice might trick him. She
could make transaction 1 with a lot of money for Bob, and later transaction 2 with a small amount for Bob. If he
spends the money in 2, he can never spend the money in 1. In fact, no one could spend the money in 1, effectively
‘burning’ it. Monero wallets have been designed to ignore the smaller amount in this scenario.
10 Actually, as of protocol v12 two outputs are required from each (non-miner) transaction, even if it means
one output has 0 amount ( HF VERSION MIN 2 OUTPUTS). This improves transaction indistinguishability by mixing
1-output cases with the much more common 2-output transactions. Previous to v12 the core wallet software was
already creating 0-value outputs. The core implementation sends 0-amount outputs to a random address. src/wallet/
wallet2.cpp
transfer
selected
rct()
11 After Bulletproofs were implemented in protocol v8, each transaction became limited to no more than 16
outputs ( BULLETPROOF MAX OUTPUTS). Previously there was no limit, aside from a restraint on transaction size (in
CHAPTER 4. MONERO ADDRESSES 39
Monero senders usually generate only one random value r. The curve point rG is typically known
as the transaction public key and is published alongside other transaction data in the blockchain.
To
src/crypto-
note core/
cryptonote
tx utils.cpp
construct
tx with
tx key()
ensure that all one-time addresses in a transaction with p outputs are different even in cases
where the same addressee is used twice, Monero uses an output index. Every output from a
transaction has an index t∈{ 0,...,p − 1}. By appending this value to the shared secret before
hashing it, one can ensure the resulting one-time addresses are unique:
src/crypto/
crypto.cpp
derive pu-
blic key()
Kot =Hn(rKvt,t )G +Kst = (Hn(rKvt,t ) +kst )G
kot =Hn(rKvt,t ) +kst
4.3 Subaddresses
Monero users can generate subaddresses from each address [105]. Funds sent to a subaddress can
be viewed and spent using its main address’s view and spend keys. By analogy: an online bank
account may have multiple balances corresponding to credit cards and deposits, yet they are all
accessible and spendable from the same point of view – the account holder.
Subaddresses are convenient for receiving funds to the same place when a user doesn’t want to link
his activities together by publishing/using the same address. As we will see, most observers would
have to solve the DLP to determine a given subaddress is derived from any particular address
[105].12
They are also useful for differentiating between received outputs. For example, if Alice wants to
buy an apple from Bob on a Tuesday, Bob could write a receipt describing the purchase and make
a subaddress for that receipt, then ask Alice to use that subaddress when she sends him the money.
This way Bob can associate the money he receives with the apple he sold. We explore another
way to distinguish between received outputs in the next section.
Bob src/device/
device de-
fault.cpp
get sub-
address
secret
key()
generates hisi
th
subaddress (i = 1, 2,... ) from his address as a pair of public keys (Kv,i,Ks,i):13
Ks,i =Ks +Hn(kv,i )G
Kv,i =kvKs,i
So,
Kv,i =kv(ks +Hn(kv,i ))G
Ks,i = ( ks +Hn(kv,i ))G
bytes).
12 Prior to subaddresses (added in the software update corresponding with protocol v7 [76]), Monero users could
simply generate many normal addresses. To view each address’s balance, you needed to do a separate scan of the
blockchain record. This was very inefficient. With subaddresses, users maintain a look-up table of (hashed) spend
keys, so one scan of the blockchain takes the same amount of time for 1 subaddress, or 10,000 subaddresses.
13 It turns out the subaddress hash is domain separated, so it’s really Hn(Tsub,kv,i ) where Tsub =“SubAddr”.
We omitTsub throughout this document for brevity.
CHAPTER 4. MONERO ADDRESSES 40
4.3.1 Sending to a subaddress
Let’s say Alice is going to send Bob ‘0’ amount again, this time via his subaddress ( Kv,1B ,Ks,1B ).
1. Alice generates a random number r∈R Zl, and calculates the one-time address
Ko =Hn(rKv,1B , 0)G +Ks,1B
2. Alice sets Ko as the addressee of the payment, adds the output amount ‘0’ and the value
rKs,1B to the transaction data, and submits it to the network.
3. Bob src/crypto/
crypto.cpp
derive
subaddress
public
key()
receives the data and sees the values rKs,1B andKo. He can calculate kvBrKs,1B =rKv,1B .
He can then calculate K′sB =Ko−Hn(rKv,1B , 0)G. When he sees that K′sB =Ks,1B , he knows
the transaction is addressed to him. 14
Bob only needs his private view key kvB and subaddress public spend key Ks,1B to find trans-
action outputs sent to his subaddress.
4. The one-time keys for the output are:
Ko =Hn(rKv,1B , 0)G +Ks,1B = (Hn(rKv,1B , 0) +ks,1B )G
ko =Hn(rKv,1B , 0) +ks,1B
Now, src/crypto-
note core/
cryptonote
tx utils.cpp
construct
tx with
tx key()
Alice’s transaction public key is particular to Bob ( rKs,1B instead of rG). If she creates a
p-output transaction with at least one output intended for a subaddress, Alice needs to make a
unique transaction public key for each output t∈{ 0,...,p − 1}. In other words, if Alice is sending
to Bob’s subaddress (Kv,1B ,Ks,1B ) and Carol’s address (KvC,KsC), she will put two transaction public
keys{r1Ks,1B ,r 2G} in the transaction data. 15,16
14 An advanced attacker may be able to link subaddresses [56] (a.k.a. the Janus attack). With subaddresses (one
of which can be a normal address) K 1B & K 2B the attacker thinks may be related, he makes a transaction output
with Ko =Hn(rKv,2B , 0)G +Ks,1B and includes transaction public key rKs,2B . Bob calculates rKv,2B to find K′s,1B
but has no way of knowing it was his other (sub)address’s key used! If he tells the attacker that he received funds
to K 1B, the attacker will know K 2B is a related subaddress (or normal address). Since subaddresses are outside the
protocol’s scope, mitigations are up to wallet implementers. No known wallets have done so, and any mitigation
would only work for compliant wallets. Potential mitigations include: not informing attackers of received funds,
including encrypted transaction private key r in transaction data, a Schnorr signature on the shared secret using
Ks,1 as the base point instead of G, and including rG in transaction data and verifying the shared secret with
rKs,1 ?= (ks +Hn(kv, 1))∗rG (requires the private spend key). Outputs received by a normal address should also
be verified. See [101] for a discussion of the last mitigation listed.
15 In src/crypto-
note basic/
cryptonote
basic impl.cpp
get account
address as
str()
Monero subaddresses are prefixed with an ‘8’, separating them from addresses, which are prefixed with ‘4’.
This helps senders choose the correct procedure when constructing transactions.
16 There is some intricacy to when additional transaction public keys are used (see the 프로젝트로 돌아가기