-
Notifications
You must be signed in to change notification settings - Fork 0
/
cns007.txt
280 lines (147 loc) · 7.98 KB
/
cns007.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
CRYPTONOTE STANDARD 007 Antonio M. Juarez
Category: Main Track Oscar Norton
Neocortex
Albert Werner
CryptoNote
November 2012
CryptoNote Keys and Addresses
Abstract
This document is part of the CryptoNote Standards describing a peer-
to-peer anonymous payment system. It defines various types of user
keys used in CryptoNote and the way the addresses are encoded into
alphanumeric strings.
Copyright and License Notice
Copyright (c) 2012 CryptoNote. This document is available under the
Creative Commons Attribution 3.0 License (international). To view a
copy of the license visit http://creativecommons.org/licenses/by/3.0/
Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 2
2. Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . 2
3. Address and Keys . . . . . . . . . . . . . . . . . . . . . . . 2
4. Address Serialization . . . . . . . . . . . . . . . . . . . . . 3
5. CryptoNote Base58 . . . . . . . . . . . . . . . . . . . . . . . 4
6. References . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Juarez et al. CryptoNote Keys and Addresses [Page 1]
CRYPTONOTE STANDARD 007 November 2012
1. Introduction
CryptoNote Standards can refer to the term "keys" in two cases:
1) One-time private and public keys used in transactions.
txout_to_key is the basic transaction type in CryptoNote. See
[CNS004] for details.
2) User's permanent keys stored in personal CryptoNote wallets.
They are used for checking incoming transaction and deriving one-
time private keys for ring signatures.
Each user has two pairs of (private, public) permanent keys by
default. The public parts of the keys are represented as user
address.
2. Definitions
public key: a datum used to identify a peer for the purpose of
digital signature verification
secret key: data known to a peer only, which enables him to create
digital signatures under his identity
3. Address and Keys
In order to send money, one needs two public keys corresponding to
the two secret keys the receiver possesses. These keys allow him to
send unlinkable payments (see [CNS002] and [CNS006] for details).
+----------------+
| |
| Public key A |
| |
+----------------+
| |
| Public key B |
| |
+----------------+
Figure 3a: Full address for unlinkable payments
When serialized to a string, these keys become a human-friendly
CryptoNote address.
Juarez et al. CryptoNote Keys and Addresses [Page 2]
CRYPTONOTE STANDARD 007 November 2012
Spend key is a pair of secret keys corresponding to the public keys
in a CryptoNote address. Spend key is required to sign transactions.
+-----------------+
| |
| Secret key a |
| |
+-----------------+
| |
| Secret key b |
| |
+-----------------+
Figure 3b: Spend key
View key consists of one secret key corresponding to a public key in
a CryptoNote address and one public key from the same address. View
key allows its holder to identify incoming transactions,
circumventing unlinkability. Said key does not allow the holder to
spend any funds.
+----------------+
| |
| Secret key a |
| |
+----------------+
| |
| Public key B |
| |
+----------------+
Figure 3c: View key
CryptoNote keys are Ed25519 keys encoded into 32 bytes. See
[ED25519].
4. Address Serialization
CryptoNote addresses are serialized to strings using CryptoNote
Base58 encoding scheme. The data encoded consists of three parts:
- public address prefix (used to distinguish the addresses of
different currencies),
- a pair of public keys,
Juarez et al. CryptoNote Keys and Addresses [Page 3]
CRYPTONOTE STANDARD 007 November 2012
- checksum.
The pseudo-code below defines the process of generating an address:
Checksum = H(Varint(Prefix) || A || B)[0..3]
SerializedString = Base58(Prefix || A || B || Checksum)
H here is the Keccak function that is used in CryptoNote, and ||
denotes concatenation. For varint (variable-length encoding of
integers) description see section 3 of [CNS003].
Keccak
+-----------------------------------+
| |
| V
+---------+-------------+-------------+ +----------+--------------+
| Public | | | | Checksum | |
| address | A | B | | (first | Unused |
| prefix | | | | 4 bytes) | |
+---------+-------------+-------------+ +----------+--------------+
+----------------------------------------------------+
|
| Base58
V
+--------------------+
| CryptoNote Address |
+--------------------+
Figure 4: Address serialization algorithm
5. CryptoNote Base58
CryptoNote Base58 is a binary-to-text encoding scheme used to
represent arbitrary binary data as a sequence of alphanumeric
characters.
CryptoNote Base58 uses the following alphabet:
123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz
The input is split into 8-byte blocks. The last block may be smaller
than 8 bytes. Each block is interpreted as a big-endian integer,
converted into base 58 (again, big-endian), and encoded using the
alphabet shown above. The number of base-58 digits used to encode a
block is the smallest number of digits sufficient to encode every
Juarez et al. CryptoNote Keys and Addresses [Page 4]
CRYPTONOTE STANDARD 007 November 2012
block of the same size. For example, 8-byte blocks are encoded using
11 characters.
6. References
[CNS002] "CryptoNote Signatures", CryptoNote Standard 002, May 2012.
[CNS003] "CryptoNote Blockchain", CryptoNote Standard 003, September
2012.
[CNS004] "CryptoNote Transactions", CryptoNote Standard 004,
September 2012.
[CNS006] "CryptoNote One-Time Keys", CryptoNote Standard 006,
November 2012.
[ED25519] Bernstein, D. J., Duif, N., Lange, T., Schwabe, P., and B.-
Y. Yang, "High-speed high-security signatures", 2011,
http://ed25519.cr.yp.to/ed25519-20110926.pdf.
Juarez et al. CryptoNote Keys and Addresses [Page 5]