-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy path2_6_unit_cost_calculator.html
More file actions
347 lines (330 loc) · 18.5 KB
/
Copy path2_6_unit_cost_calculator.html
File metadata and controls
347 lines (330 loc) · 18.5 KB
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
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
<html>
<head>
<title>Compare Unit Costs</title>
<style>
.table {
border-collapse:collapse;
}
input {
width: 100px;
}
.table>tbody>tr {
border: 1px solid #a2a9b1;
padding: 0.2em 0.4em;
}
.table>tbody>tr>th {
border: 1px solid #a2a9b1;
padding: 0.2em 0.4em;
background-color: #eaecf0;
}
.table>tbody>tr>td {
border: 1px solid #a2a9b1;
padding: 0.2em 0.4em;
background-color: #f8f9fa;
}
</style>
</head>
<body>
<table>
<tbody>
<tr>
<td style="vertical-align:top">
<h3>Benchmark Hardware</h3>
<table class="table">
<thead>
<td></td>
<td>Cost ($ per CPU or 1 TiB of storage)</td>
<td>Hashrate (h/s)</td>
<td>Chunk Processing Rate</td>
<td>Sequential Read (MiB/s)</td>
<td>Power Consumption (Watt)</td>
<td>Lifetime (years)</td>
</thead>
<tbody>
<tr>
<td>On-demand Packing CPU</td>
<td><input type=number id="on_demand_cpu_cost" value="1600" oninput="refresh()"></td>
<td><input type=number id="on_demand_cpu_hashrate" value="30000" oninput="refresh()"></td>
<td>-</td>
<td>-</td>
<td><input type=number id="on_demand_cpu_watt" value="260" oninput="refresh()"></td>
<td><input type=number id="on_demand_cpu_lifetime" value="7" oninput="refresh()"></td>
</tr>
<tr>
<td>Honest Mining CPU</td>
<td><input type=number id="cpu_cost" value="250" oninput="refresh()"></td>
<td>-</td>
<td><input type=number id="chunk_processing_rate" value="40000" oninput="refresh()"></td>
<td>-</td>
<td><input type=number id="cpu_watt" value="65" oninput="refresh()"></td>
<td><input type=number id="cpu_lifetime" value="7" oninput="refresh()"></td>
</tr>
<tr>
<td>Additional Costs</td>
<td><input type=number id="extra_cpu_cost" value="280" oninput="refresh()"></td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td>SSD</td>
<td><input type=number id="ssd_disk_cost" value="230" oninput="refresh()"></td>
<td>-</td>
<td>-</td>
<td><input type=number id="ssd_read_rate" value="7000" oninput="refresh()"></td>
<td><input type=number id="ssd_disk_watt" value="5" oninput="refresh()"></td>
<td><input type=number id="ssd_disk_lifetime" value="5" oninput="refresh()"></td>
</tr>
<tr>
<td>HDD</td>
<td><input type=number id="disk_cost" value="10" oninput="refresh()"></td>
<td>-</td>
<td>-</td>
<td><input type=number id="read_rate" value="200" oninput="refresh()"></td>
<td><input type=number id="disk_watt" value="2" oninput="refresh()"></td>
<td><input type=number id="disk_lifetime" value="4" oninput="refresh()"></td>
</tr>
</tbody>
</table>
<h3>Electricity</h3>
<table class="table">
<tbody>
<td>Kilowatt-Hour Cost</td>
<td><input type=number id="kilowatt_hour_cost" value="0.068" oninput="refresh()"></td>
</tbody>
</table>
<h3>Protocol Parameters</h3>
<table class="table">
<tbody>
<td>Search Space Size (TiB)</td>
<td><input type=number id="search_space_size" value="4" oninput="refresh()"></td>
<td>Recall Space Size (MiB)</td>
<td><input type=number id="recall_space_size" value="200" oninput="refresh()"></td>
<td>Packing Difficulty (RandomX h/chunk)</td>
<td><input type=number id="packing_difficulty" value="30" oninput="refresh()"></td>
</tbody>
</table>
</td>
<td style="vertical-align:top">
<h3>Results</h3>
<table class="table">
<tbody>
<tr>
<td colSpan=2><b>On-Demand Mining</b></td>
</tr>
<tr>
<td>Unit Packing Cost (USD)</td>
<td style="text-align:right"><span id="on_demand_packing_cost"></span></td>
</tr>
<!--<tr>
<td>Unit Nonce Limiter Cost (USD)</td>
<td style="text-align:right"><span id="nonce_limiter_cost"></span></td>
</tr>-->
<tr>
<td>Total (USD)</td>
<td style="text-align:right"><span id="on_demand_total_cost"></span></td>
</tr>
<tr>
<td colSpan=2><b>Honest Mining</b></td>
</tr>
<tr>
<td>CPU Cost (USD)</td>
<td style="text-align:right"><span id="honest_cpu_cost"></span></td>
</tr>
<tr>
<td>Read Cost (USD)</td>
<td style="text-align:right"><span id="read_cost"></span></td>
</tr>
<tr>
<td>Total (USD)</td>
<td style="text-align:right"><span id="honest_total_cost"></span></td>
</tr>
<tr>
<td colSpan=2><b>On-Demand Cost / Honest Cost</b></td>
</tr>
<tr>
<td></td>
<td style="text-align:right"><span id="cost_ratio"></span></td>
</tr>
<!--<tr>
<td colSpan=2><b>On-Demand Pool Worker Cost / Honest Pool Worker Cost</b></td>
</tr>
<tr>
<td></td>
<td style="text-align:right"><span id="pool_cost_ratio"></span></td>
</tr>-->
<tr>
<td colSpan=2><b>On-Demand CPU Packs TiB/day</b></td>
</tr>
<tr>
<td></td>
<td style="text-align:right"><span id="single_miner_throughput"></span></td>
</tr>
<tr>
<td colSpan=2><b>Honest SSD Mining</b></td>
</tr>
<tr>
<td>Read Cost (USD)</td>
<td style="text-align:right"><span id="ssd_read_cost"></span></td>
</tr>
<tr>
<td>Total (USD)</td>
<td style="text-align:right"><span id="ssd_honest_total_cost"></span></td>
</tr>
<tr>
<td colSpan=2><b>Honest SSD Costs / Honest HDD Costs</b></td>
</tr>
<tr>
<td></td>
<td style="text-align:right"><span id="ssd_hdd_cost_ratio"></span></td>
</tr>
<tr>
<td colSpan=2><b>2.5 Unit Consumption Cost Share</b></td>
</tr>
<tr>
<td></td>
<td style="text-align:right"><span id="2_5_unit_consumption_cost_share"></span>%</td>
</tr>
<tr>
<td colSpan=2><b>2.6 Unit Consumption Cost Share</b></td>
</tr>
<tr>
<td></td>
<td style="text-align:right"><span id="2_6_unit_consumption_cost_share"></span>%</td>
</tr>
<tr>
<td colSpan=2><b>2.6 SSD Unit Consumption Cost Share</b></td>
</tr>
<tr>
<td></td>
<td style="text-align:right"><span id="2_6_ssd_unit_consumption_cost_share"></span>%</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<script>
window.refresh = function() {
var unit_cost =
function(cost, rate, lifetime, consumption, kilowatt_hour_cost) {
return (cost +
consumption * lifetime * 365 * 24 * kilowatt_hour_cost / 1000)
/ (rate * lifetime * 365 * 24 * 60 * 60)
};
var unit_consumption_cost =
function(rate, lifetime, consumption, kilowatt_hour_cost) {
return (consumption * lifetime * 365 * 24 * kilowatt_hour_cost / 1000)
/ (rate * lifetime * 365 * 24 * 60 * 60)
};
var get_value =
function(id) {
return document.getElementById(id).valueAsNumber
};
var packing_difficulty = get_value("packing_difficulty");
var on_demand_packing_cost = unit_cost(get_value("on_demand_cpu_cost")
+ get_value("extra_cpu_cost"),
get_value("on_demand_cpu_hashrate") / packing_difficulty,
get_value("on_demand_cpu_lifetime"),
get_value("on_demand_cpu_watt"),
get_value("kilowatt_hour_cost"));
var read_rate = get_value("read_rate");
var recall_space_size = get_value("recall_space_size");
var cpu_cost = unit_cost(get_value("cpu_cost") + get_value("extra_cpu_cost"),
get_value("chunk_processing_rate"),
get_value("cpu_lifetime"), get_value("cpu_watt"),
get_value("kilowatt_hour_cost"));
var cpu_cost_no_consumption = unit_cost(
get_value("cpu_cost") + get_value("extra_cpu_cost"),
get_value("chunk_processing_rate"),
get_value("cpu_lifetime"), get_value("cpu_watt"), 0);
var search_space_size = get_value("search_space_size");
var read_cost =
// from every so many terabytes bought
unit_cost(get_value("disk_cost") * search_space_size,
// we get this many chunks per second
Math.min(read_rate, recall_space_size) * 4,
get_value("disk_lifetime"),
get_value("disk_watt") * search_space_size,
get_value("kilowatt_hour_cost"));
var read_cost_no_consumption =
unit_cost(get_value("disk_cost") * search_space_size,
Math.min(read_rate, recall_space_size) * 4,
get_value("disk_lifetime"),
get_value("disk_watt") * search_space_size,
0);
var precision = 12;
document.getElementById("on_demand_packing_cost").innerText
= on_demand_packing_cost.toFixed(precision);
var on_demand_total = on_demand_packing_cost;
document.getElementById("on_demand_total_cost").innerText
= on_demand_total.toFixed(precision);
var total = read_cost + cpu_cost;
document.getElementById("read_cost").innerText
= read_cost.toFixed(precision);
document.getElementById("honest_cpu_cost").innerText
= cpu_cost.toFixed(precision);
document.getElementById("honest_total_cost").innerText
= total.toFixed(precision);
document.getElementById("cost_ratio").innerText
= (on_demand_total / total).toFixed(2);
document.getElementById("single_miner_throughput").innerText
= (60 * 60 * 24
* (((get_value("on_demand_cpu_hashrate") / packing_difficulty) / 4)
/ (1024 * 1024))).toFixed(precision);
var ssd_read_rate = get_value("ssd_read_rate");
var ssd_read_cost =
unit_cost(get_value("ssd_disk_cost") * search_space_size,
Math.min(ssd_read_rate, recall_space_size) * 4,
get_value("ssd_disk_lifetime"),
get_value("ssd_disk_watt") * search_space_size,
get_value("kilowatt_hour_cost"));
var ssd_read_cost_no_consumption =
unit_cost(get_value("ssd_disk_cost") * search_space_size,
Math.min(ssd_read_rate, recall_space_size) * 4,
get_value("ssd_disk_lifetime"),
get_value("ssd_disk_watt") * search_space_size,
0);
document.getElementById("ssd_read_cost").innerText
= ssd_read_cost.toFixed(precision);
var ssd_total = ssd_read_cost + cpu_cost;
document.getElementById("ssd_honest_total_cost").innerText
= ssd_total.toFixed(precision);
document.getElementById("ssd_hdd_cost_ratio").innerText
= (ssd_total / total).toFixed(2);
// We assume no synchronization costs,
// i.e., free infinite-bandwidth links between CPUs.
var unit_consumption_cost_2_5 =
unit_consumption_cost(
get_value("on_demand_cpu_hashrate") / 2,
get_value("on_demand_cpu_lifetime"),
get_value("on_demand_cpu_watt"),
get_value("kilowatt_hour_cost"));
var unit_cost_2_5 =
unit_cost(
get_value("on_demand_cpu_cost"),
get_value("on_demand_cpu_hashrate") / 2,
get_value("on_demand_cpu_lifetime"),
get_value("on_demand_cpu_watt"),
get_value("kilowatt_hour_cost"));
var unit_consumption_cost_share_2_5 = unit_consumption_cost_2_5 / unit_cost_2_5;
var unit_consumption_cost_share_2_6
= (read_cost - read_cost_no_consumption
+ cpu_cost - cpu_cost_no_consumption) / total;
var ssd_unit_consumption_cost_share_2_6
= (ssd_read_cost - ssd_read_cost_no_consumption
+ cpu_cost - cpu_cost_no_consumption) / ssd_total;
document.getElementById("2_5_unit_consumption_cost_share").innerText
= unit_consumption_cost_share_2_5.toFixed(2) * 100;
document.getElementById("2_6_unit_consumption_cost_share").innerText
= unit_consumption_cost_share_2_6.toFixed(2) * 100;
document.getElementById("2_6_ssd_unit_consumption_cost_share").innerText
= ssd_unit_consumption_cost_share_2_6.toFixed(2) * 100;
}
refresh();
</script>
</body>
</html>