-
Notifications
You must be signed in to change notification settings - Fork 26
/
index.html
666 lines (662 loc) · 34.7 KB
/
index.html
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
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no">
<link rel="stylesheet" type="text/css" href="styles.css">
<script src="https://bundle.run/[email protected]"></script>
<script src="https://unpkg.com/@cmdcode/[email protected]"></script>
<script src="scripts/utils.js"></script>
<script src="scripts/network.js"></script>
<script src="scripts/vm.js"></script>
<script src="scripts/init.js"></script>
<script src="scripts/circuit.js"></script>
<script src="scripts/circuits/bristol.js"></script>
<script src="scripts/circuits/bristol_zero_checker.js"></script>
<script src="scripts/circuits/bristol_size_checker.js"></script>
<script src="scripts/circuits/bristol_addition.js"></script>
<script src="scripts/circuits/bristol_adder_8bit.js"></script>
<script src="scripts/circuits/bristol_shifter.js"></script>
<script src="scripts/circuits/bristol_sha256.js"></script>
<script src="scripts/circuits/bristol_8bit_cpu_64_cycles.js"></script>
</head>
<body>
<div class="home">
<h1>Welcome to BitVM Online</h1>
<p>To run the bitvm there are seven steps:</p>
<ol>
<li>Pick a program</li>
<li>Act as the prover to commit to a certain output</li>
<li>Send money to the program</li>
<li>Act as the prover to share which "inputs" make the code produce the expected output</li>
<li>Act as the verifier to check if the code, with those inputs, produces the expected output</li>
<li>If it does, act as the prover to take the money after a timelock</li>
<li>Otherwise, act as the verifier to take the money by producing the error</li>
</ol>
<h2>Pick a program you want to run</h2>
<p>
<button class="view_zero_checker p_buttons">Zero checker</button>
<button class="view_size_checker p_buttons">Size checker</button>
<button class="view_addition p_buttons">Addition</button>
<button class="view_adder_8bit p_buttons">Adder (8-bit)</button>
<button class="view_shifter p_buttons">Shifter</button>
<button class="view_sha256 p_buttons">SHA256</button>
<button class="view_cpu_8bit_64_cycles p_buttons" disabled>STU-1 CPU (coming soon!)</button>
</p>
<div class="zero_checker hidden">
<h3 class="zero_checker_label">
Zero checker
</h3>
<div class="zero_checker_instructions">
In this program, the prover must share a string of numbers with the verifier within a time limit, but
not before making one of two promises: the string will only be 0s, or the string will *not* only be
zeros. The verifier can take the prover's money if the promise is broken.
</div>
<p><button class="choose_zero_checker">Choose this program</button></p>
</div>
<div class="cpu_8bit_64_cycles hidden">
<h3 class="cpu_8bit_64_cycles_label">
STU-1 CPU
</h3>
<div class="cpu_8bit_64_cycles_instructions">
In this program, the prover must make the CPU halt on its first step. Otherwise, the verifier can take the prover's money.
</div>
<p><button class="choose_cpu_8bit_64_cycles">Choose this program</button></p>
</div>
<div class="size_checker hidden">
<h3 class="size_checker_label">
Size checker
</h3>
<div class="size_checker_instructions">
In this program, the prover must share two numbers with the verifier within a time limit, but not before
making one of two promises: (1) the first number will be bigger than the second number, or (2) the first
number will not be bigger than the second number. The verifier can take the prover's money if the
promise is broken.
</div>
<p><button class="choose_size_checker">Choose this program</button></p>
</div>
<div class="addition hidden">
<h3 class="addition_label">
Addition
</h3>
<div class="addition_instructions">
In this program, the prover must share a number with the verifier, then make a promise: within a time
limit, they will share two numbers that sum to the original number. The verifier can take the prover's
money if the promise is broken.
</div>
<p><button class="choose_addition">Choose this program</button></p>
</div>
<div class="adder_8bit hidden">
<h3 class="adder_8bit_label">
Adder (8-bit)
</h3>
<div class="adder_8bit_instructions">
In this program, the prover must share a number with the verifier, then make a promise: within a time
limit, they will share two numbers that sum to the original number. The verifier can take the prover's
money if the promise is broken.
</div>
<p><button class="choose_adder_8bit">Choose this program</button></p>
</div>
<div class="shifter hidden">
<h3 class="shifter_label">
Shifter
</h3>
<div class="shifter_instructions">
In this program, the prover must share a number with the verifier, then make a promise: within a time
limit, they will share a number that when shifted will become the original number. The verifier can take
the prover's
money if the promise is broken.
</div>
<p><button class="choose_shifter">Choose this program</button></p>
</div>
<div class="sha256 hidden">
<h3 class="sha256_label">
SHA256
</h3>
<div class="sha256_instructions">
In this program, the prover must share a hash with the verifier, then make a promise: within a time
limit, they will share the preimage corresponding to that hash. The verifier can take
the prover's
money if the promise is broken.
</div>
<p><button class="choose_sha256">Choose this program</button></p>
</div>
<hr>
<p><button class="view_caveats">View caveats</button></p>
<ol class="caveats hidden">
<li>This is a toy implementation, don't expect much.</li>
<li>I wrote the VM in about 200 lines of javascript which means it barely works.</li>
<li>It breaks if you put a program with more than about 3000 logic gates in it. <a
href="https://github.com/supertestnet/tapleaf-circuits/" target="_blank">Help me write a better
one!</a></li>
<li>The whitepaper talks about using "binary search" in a challenge to find the shortest path to prove your
counterparty is equivocating. I don't know how to program a binary search so I just didn't. Instead, if
you challenge the prover, he has to *prove the entire computation himself, all on chain.* Which is very
dumb, and expensive. But I wasn't trying to make it the smart way, I was trying to make it the easy way.
Help me improve it!</li>
<li>If Paul doesn't send Vicky the data he promised, she is technically able to take his money after a 10
block timelock, but I didn't automatically give her a transaction for this like I did for Paul. So she's
just out of luck til I do that. (Or you can figure out how to write bitcoin transactions manually and do
it yourself.)</li>
<li>Paul doesn't make Vicky pay him, or even check if her signatures on the presigned transactions are
correct. He just yolos his money right into the bitvm address with no checks or balances, so Vicky can
easily steal from him by just immediately moving it into the challenge address without presigning the
transaction that lets him take it out again. Fixing that is on my todo list. So is having Vicky pay Paul
for the computation.</li>
<li>There are a bunch of other caveats but whatever, it technically works! I'm really looking forward to
testing more functions with this. Bitcoin can run *anything* guys! Let's write some functions for it!
</li>
</ol>
</div>
<div class="zero_checker_program program hidden">
<h1>Zero checker</h1>
<div class="zero_checker_step_one">
<p>
In this demo you will play as Paul, the prover. The first step is to open up the page where Vicky -- the
verifier -- will verify your program, and copy her public key, and paste it here
</p>
<p>Visit Vicky's page: <a class="vicky_link" href="./vicky.html" target="_blank">Vicky page</a></p>
<script>
$('.vicky_link').href = "./vicky.html";
if ($_GET["network"]) $('.vicky_link').href = `./vicky.html?network=${$_GET["network"]}`;
</script>
<p>Enter Vicky's public key</p>
<p><input class="vickys_key"></p>
<p><button class="zero_checker_step_one_done">Done</button></p>
</div>
<div class="zero_checker_step_two hidden">
<p>
Time to make a promise to Vicky! Will your string be all 0s or not all zeros?
</p>
<select class="all_or_none">
<option>All 0s</option>
<option>Not all 0s</option>
</select>
<p><button class="submit_all_or_none">Download your promise file</button></p>
<p>
Click ok when you've sent the promise file to Vicky
</p>
<p><button class="zero_checker_step_two_done">Done</button></p>
</div>
<div class="zero_checker_step_three hidden">
<p>
Enter the bitcoin address where you want your money to go when you get it back:
</p>
<p><input class="zero_checker_bitcoin_address"></p>
<p>
Also, it's time to validate that you and Vicky generated the same bitcoin addresses. Do all of these
match what Vicky got? (Note: don't send any money to them yet)
</p>
<div class="address_validation">loading...</div>
<p><button class="zero_checker_step_three_done">Yes, they match</button> <button
class="zero_checker_step_three_reset">No, they don't match</button></p>
</div>
<div class="zero_checker_step_four hidden">
<p>
Also, send *PRECISELY* 10,000 sats to the following address to start the contract (if you send the wrong
amount it will not work):
</p>
<div class="funding_address_in_step_four">loading...</div>
<p class="asking_for_txid">Asking for txid and vout in 3 seconds</p>
</div>
<div class="zero_checker_step_five hidden">
<p>
Broadcast the following transaction to finalize the contract:
</p>
<div class="starter_txhex">loading...</div>
<p><button class="zero_checker_step_five_done">Done</button></p>
</div>
<div class="zero_checker_step_six hidden">
<p>
What string do you want to reveal to Vicky? Remember, you promised <span
class="step_six_promise_to_vicky"></span> and she can take your money if you lie
</p>
<p><input class="zero_checker_revelation_string" maxlength="64"
oninput="this.value=this.value.replace(/[^0-1]/,'')"></p>
<p>Add this many more characters: <span class="zero_checker_chars_left">64</span></p>
<p>Note that your string must only contain 0s and 1s</p>
<p><button class="zero_checker_step_six_done">Submit</button></p>
</div>
</div>
<div class="addition_program program hidden">
<h1>Addition</h1>
<div class="addition_step_one">
<p>
In this demo you will play as Paul, the prover. The first step is to open up the page where Vicky -- the
verifier -- will verify your program, and copy her public key, and paste it here
</p>
<p>Visit Vicky's page: <a class="vicky_link" href="./vicky.html" target="_blank">Vicky page</a></p>
<script>
$('.vicky_link').href = "./vicky.html";
if ($_GET["network"]) $('.vicky_link').href = `./vicky.html?network=${$_GET["network"]}`;
</script>
<p>Enter Vicky's public key</p>
<p><input class="vickys_key"></p>
<p><button class="addition_step_one_done">Done</button></p>
</div>
<div class="addition_step_two hidden">
<p>
Time to make a promise to Vicky! Enter a number. Later, you will need to enter two numbers that sum to
this number.
</p>
<p><input class="sum_num" type="number" max="4294967295" min="0" step="1"></p>
<p><button class="submit_sum_num">Download your promise file</button></p>
<p>
Click ok when you've sent the promise file to Vicky
</p>
<p><button class="addition_step_two_done">Done</button></p>
</div>
<div class="addition_step_three hidden">
<p>
Enter the bitcoin address where you want your money to go when you get it back:
</p>
<p><input class="addition_bitcoin_address"></p>
<p>Hint: if you don't have a testnet wallet, you can just send it to a testnet faucet at this address:</p>
<p>tb1q349k20q0yft6knyss5cdpcrgmg30taxyt5ggse</p>
<p>
Also, it's time to validate that you and Vicky generated the same bitcoin addresses. Do all of these
match what Vicky got? (Note: don't send any money to them yet)
</p>
<div class="address_validation">loading...</div>
<p><button class="addition_step_three_done">Yes, they match</button> <button
class="addition_step_three_reset">No, they don't match</button></p>
</div>
<div class="addition_step_four hidden">
<p>
Send *PRECISELY* 10,000 sats to the following address to start the contract (if you send the wrong
amount it will not work):
</p>
<div class="funding_address_in_step_four">loading...</div>
<p class="asking_for_txid">Asking for txid and vout in 3 seconds</p>
</div>
<div class="addition_step_five hidden">
<p>
Broadcast the following transaction to finalize the contract:
</p>
<div class="starter_txhex">loading...</div>
<p><button class="addition_step_five_done">Done</button></p>
</div>
<div class="addition_step_six hidden">
<p>
What two numbers do you want to reveal to Vicky? Remember, you promised they would add up to <span
class="step_six_promise_to_vicky">loading...</span> and she can take your money if you lie
</p>
<p>Enter your first number</p>
<p><input class="addition_num_1" type="number" max="4294967295" min="0" step="1"></p>
<p>Enter your second number</p>
<p><input class="addition_num_2" type="number" max="4294967295" min="0" step="1"></p>
<p><button class="addition_step_six_done">Submit</button></p>
</div>
</div>
<div class="adder_8bit_program program hidden">
<h1>Adder (8-bit)</h1>
<div class="adder_8bit_step_one">
<p>
In this demo you will play as Paul, the prover. The first step is to open up the page where Vicky -- the
verifier -- will verify your program, and copy her public key, and paste it here
</p>
<p>Visit Vicky's page: <a class="vicky_link" href="./vicky.html" target="_blank">Vicky page</a></p>
<script>
$('.vicky_link').href = "./vicky.html";
if ($_GET["network"]) $('.vicky_link').href = `./vicky.html?network=${$_GET["network"]}`;
</script>
<p>Enter Vicky's public key</p>
<p><input class="vickys_key"></p>
<p><button class="adder_8bit_step_one_done">Done</button></p>
</div>
<div class="adder_8bit_step_two hidden">
<p>
Time to make a promise to Vicky! Enter a number. Later, you will need to enter two numbers that sum to
this number.
</p>
<p><input class="sum_num_8bit" type="number" max="510" min="0" step="1"></p>
<p><button class="submit_sum_num_8bit">Download your promise file</button></p>
<p>
Click ok when you've sent the promise file to Vicky
</p>
<p><button class="adder_8bit_step_two_done">Done</button></p>
</div>
<div class="adder_8bit_step_three hidden">
<p>
Enter the bitcoin address where you want your money to go when you get it back:
</p>
<p><input class="adder_8bit_bitcoin_address"></p>
<p>Hint: if you don't have a testnet wallet, you can just send it to a testnet faucet at this address:</p>
<p>tb1q349k20q0yft6knyss5cdpcrgmg30taxyt5ggse</p>
<p>
Also, it's time to validate that you and Vicky generated the same bitcoin addresses. Do all of these
match what Vicky got? (Note: don't send any money to them yet)
</p>
<div class="address_validation">loading...</div>
<p><button class="adder_8bit_step_three_done">Yes, they match</button> <button
class="adder_8bit_step_three_reset">No, they don't match</button></p>
</div>
<div class="adder_8bit_step_four hidden">
<p>
Send *PRECISELY* 10,000 sats to the following address to start the contract (if you send the wrong
amount it will not work):
</p>
<div class="funding_address_in_step_four">loading...</div>
<p class="asking_for_txid">Asking for txid and vout in 3 seconds</p>
</div>
<div class="adder_8bit_step_five hidden">
<p>
Broadcast the following transaction to finalize the contract:
</p>
<div class="starter_txhex">loading...</div>
<p><button class="adder_8bit_step_five_done">Done</button></p>
</div>
<div class="adder_8bit_step_six hidden">
<p>
What two numbers do you want to reveal to Vicky? Remember, you promised they would add up to <span
class="step_six_promise_to_vicky">loading...</span> and she can take your money if you lie
</p>
<p>Enter your first number</p>
<p><input class="adder_8bit_num_1" type="number" max="255" min="0" step="1"></p>
<p>Enter your second number</p>
<p><input class="adder_8bit_num_2" type="number" max="255" min="0" step="1"></p>
<p><button class="adder_8bit_step_six_done">Submit</button></p>
</div>
</div>
<div class="size_checker_program program hidden">
<h1>Size checker</h1>
<div class="size_checker_step_one">
<p>
In this demo you will play as Paul, the prover. The first step is to open up the page where Vicky -- the
verifier -- will verify your program, and copy her public key, and paste it here
</p>
<p>Visit Vicky's page: <a class="vicky_link" href="./vicky.html" target="_blank">Vicky page</a></p>
<script>
$('.vicky_link').href = "./vicky.html";
if ($_GET["network"]) $('.vicky_link').href = `./vicky.html?network=${$_GET["network"]}`;
</script>
<p>Enter Vicky's public key</p>
<p><input class="vickys_key"></p>
<p><button class="size_checker_step_one_done">Done</button></p>
</div>
<div class="size_checker_step_two hidden">
<p>
Time to make a promise to Vicky! Enter a number and say whether it is bigger than a number you'll send
Vicky later.
</p>
<p><input class="std_num" type="number" max="4294967295" min="0" step="1"></p>
<p>
Will the number you just entered be bigger than the number you'll send Vicky later?
</p>
<select class="big_or_not">
<option>Bigger</option>
<option>Not bigger</option>
</select>
<p><button class="submit_std_num">Download your promise file</button></p>
<p>
Click ok when you've sent the promise file to Vicky
</p>
<p><button class="size_checker_step_two_done">Done</button></p>
</div>
<div class="size_checker_step_three hidden">
<p>
Enter the bitcoin address where you want your money to go when you get it back:
</p>
<p><input class="size_checker_bitcoin_address"></p>
<p>Hint: if you don't have a testnet wallet, you can just send it to a testnet faucet at this address:</p>
<p>tb1q349k20q0yft6knyss5cdpcrgmg30taxyt5ggse</p>
<p>
Also, it's time to validate that you and Vicky generated the same bitcoin addresses. Do all of these
match what Vicky got? (Note: don't send any money to them yet)
</p>
<div class="address_validation">loading...</div>
<p><button class="size_checker_step_three_done">Yes, they match</button> <button
class="size_checker_step_three_reset">No, they don't match</button></p>
</div>
<div class="size_checker_step_four hidden">
<p>
Send *PRECISELY* 10,000 sats to the following address to start the contract (if you send the wrong
amount it will not work):
</p>
<div class="funding_address_in_step_four">loading...</div>
<p class="asking_for_txid">Asking for txid and vout in 3 seconds</p>
</div>
<div class="size_checker_step_five hidden">
<p>
Broadcast the following transaction to finalize the contract:
</p>
<div class="starter_txhex">loading...</div>
<p><button class="size_checker_step_five_done">Done</button></p>
</div>
<div class="size_checker_step_six hidden">
<p>
What number do you want to reveal to Vicky? Remember, you promised Vicky your original number (<span
class="step_six_second_promise_to_vicky">loading...</span>) would be "<span
class="step_six_promise_to_vicky">loading...</span>" than the number you're about to enter. She can
take your money if you lie.
</p>
<p>Enter your number of comparison</p>
<p><input class="number_of_comparison" type="number" max="4294967295" min="0" step="1"></p>
<p><button class="size_checker_step_six_done">Submit</button></p>
</div>
</div>
<div class="shifter_program program hidden">
<h1>Shifter</h1>
<div class="shifter_step_one">
<p>
In this demo you will play as Paul, the prover. The first step is to open up the page where Vicky -- the
verifier -- will verify your program, and copy her public key, and paste it here
</p>
<p>Visit Vicky's page: <a class="vicky_link" href="./vicky.html" target="_blank">Vicky page</a></p>
<script>
$('.vicky_link').href = "./vicky.html";
if ($_GET["network"]) $('.vicky_link').href = `./vicky.html?network=${$_GET["network"]}`;
</script>
<p>Enter Vicky's public key</p>
<p><input class="vickys_key"></p>
<p><button class="shifter_step_one_done">Done</button></p>
</div>
<div class="shifter_step_two hidden">
<p>
Time to make a promise to Vicky! Enter a number. Later, you will need to enter a number that after
shifting becomes this number that you are about to enter.
</p>
<p><input class="shifted_num" type="number" max="4294967295" min="0" step="1"></p>
<p><button class="submit_shifted_num">Download your promise file</button></p>
<p>
Click ok when you've sent the promise file to Vicky
</p>
<p><button class="shifter_step_two_done">Done</button></p>
</div>
<div class="shifter_step_three hidden">
<p>
Enter the bitcoin address where you want your money to go when you get it back:
</p>
<p><input class="shifter_bitcoin_address"></p>
<p>Hint: if you don't have a testnet wallet, you can just send it to a testnet faucet at this address:</p>
<p>tb1q349k20q0yft6knyss5cdpcrgmg30taxyt5ggse</p>
<p>
Also, it's time to validate that you and Vicky generated the same bitcoin addresses. Do all of these
match what Vicky got? (Note: don't send any money to them yet)
</p>
<div class="address_validation">loading...</div>
<p><button class="shifter_step_three_done">Yes, they match</button> <button
class="shifter_step_three_reset">No, they don't match</button></p>
</div>
<div class="shifter_step_four hidden">
<p>
Send *PRECISELY* 10,000 sats to the following address to start the contract (if you send the wrong
amount it will not work):
</p>
<div class="funding_address_in_step_four">loading...</div>
<p class="asking_for_txid">Asking for txid and vout in 3 seconds</p>
</div>
<div class="shifter_step_five hidden">
<p>
Broadcast the following transaction to finalize the contract:
</p>
<div class="starter_txhex">loading...</div>
<p><button class="shifter_step_five_done">Done</button></p>
</div>
<div class="shifter_step_six hidden">
<p>
What number do you want to reveal to Vicky? Remember, you promised it would become <span
class="step_six_promise_to_vicky">loading...</span> after it gets shifted. She can take your money
if you lie
</p>
<p>Enter your number</p>
<p><input class="shifter_original_num" type="number" max="4294967295" min="0" step="1"></p>
<p>Shift right or left?</p>
<p>
<select class="left_or_right">
<option>Left shift</option>
<option>Right shift</option>
</select>
<p>
<p><button class="shifter_step_six_done">Submit</button></p>
</div>
</div>
<div class="sha256_program program hidden">
<h1>SHA256</h1>
<div class="sha256_step_one">
<p>
In this demo you will play as Paul, the prover. The first step is to open up the page where Vicky -- the
verifier -- will verify your program, and copy her public key, and paste it here
</p>
<p>Visit Vicky's page: <a class="vicky_link" href="./vicky.html" target="_blank">Vicky page</a></p>
<script>
$('.vicky_link').href = "./vicky.html";
if ($_GET["network"]) $('.vicky_link').href = `./vicky.html?network=${$_GET["network"]}`;
</script>
<p>Enter Vicky's public key</p>
<p><input class="vickys_key"></p>
<p><button class="sha256_step_one_done">Done</button></p>
</div>
<div class="sha256_step_two hidden">
<p>
Time to make a promise to Vicky!
<br />
Enter an SHA256 hash in hex format:
<br />
(you can use <a href="https://emn178.github.io/online-tools/sha256.html">this</a> online tool to
generate one)
</p>
<p><input class="final_hash" type="text" maxlength="64"></p>
<p><button class="submit_final_hash">Download your promise file</button></p>
<p>
Click ok when you've sent the promise file to Vicky
</p>
<p><button class="sha256_step_two_done">Done</button></p>
</div>
<div class="sha256_step_three hidden">
<p>
Enter the bitcoin address where you want your money to go when you get it back:
</p>
<p><input class="sha256_bitcoin_address"></p>
<p>Hint: if you don't have a testnet wallet, you can just send it to a testnet faucet at this address:</p>
<p>tb1q349k20q0yft6knyss5cdpcrgmg30taxyt5ggse</p>
<p>
Also, it's time to validate that you and Vicky generated the same bitcoin addresses. Do all of these
match what Vicky got? (Note: don't send any money to them yet)
</p>
<div class="address_validation">loading...</div>
<p><button class="sha256_step_three_done">Yes, they match</button> <button
class="sha256_step_three_reset">No, they don't match</button></p>
</div>
<div class="sha256_step_four hidden">
<p>
Send *PRECISELY* 10,000 sats to the following address to start the contract (if you send the wrong
amount it will not work):
</p>
<div class="funding_address_in_step_four">loading...</div>
<p class="asking_for_txid">Asking for txid and vout in 3 seconds</p>
</div>
<div class="sha256_step_five hidden">
<p>
Broadcast the following transaction to finalize the contract:
</p>
<div class="starter_txhex">loading...</div>
<p><button class="sha256_step_five_done">Done</button></p>
</div>
<div class="sha256_step_six hidden">
<p>
Now enter the preimage corresponding to the hash you promised to Vicky (<span
class="step_six_promise_to_vicky">loading...</span>). She can
take your money if you lie.
</p>
<p>Enter the preimage here:</p>
<p><input class="preimage" type="text" maxlength="55"></p>
<p><button class="sha256_step_six_done">Submit</button></p>
</div>
</div>
<div class="cpu_8bit_64_cycles_program program hidden">
<h1>STU-1 CPU</h1>
<div class="cpu_8bit_64_cycles_step_one">
<p>
In this demo you will play as Paul, the prover. The first step is to open up the page where Vicky -- the
verifier -- will verify your program, and copy her public key, and paste it here
</p>
<p>Visit Vicky's page: <a class="vicky_link" href="./vicky.html" target="_blank">Vicky page</a></p>
<script>
$('.vicky_link').href = "./vicky.html";
if ($_GET["network"]) $('.vicky_link').href = `./vicky.html?network=${$_GET["network"]}`;
</script>
<p>Enter Vicky's public key</p>
<p><input class="vickys_key"></p>
<p><button class="cpu_8bit_64_cycles_step_one_done">Done</button></p>
</div>
<div class="cpu_8bit_64_cycles_step_two hidden">
<p>
Time to make a promise to Vicky! You will cause the program to halt on its first step.
</p>
<select class="cpu_promise">
<option>Okay I guess that's what I'll do then</option>
</select>
<p><button class="submit_cpu_promise">Download your promise file</button></p>
<p>
Click ok when you've sent the promise file to Vicky
</p>
<p><button class="cpu_8bit_64_cycles_step_two_done">Done</button></p>
</div>
<div class="cpu_8bit_64_cycles_step_three hidden">
<p>
Enter the bitcoin address where you want your money to go when you get it back:
</p>
<p><input class="cpu_8bit_64_cycles_bitcoin_address"></p>
<p>
Also, it's time to validate that you and Vicky generated the same bitcoin addresses. Do all of these
match what Vicky got? (Note: don't send any money to them yet)
</p>
<div class="address_validation">loading...</div>
<p><button class="cpu_8bit_64_cycles_step_three_done">Yes, they match</button> <button
class="cpu_8bit_64_cycles_step_three_reset">No, they don't match</button></p>
</div>
<div class="cpu_8bit_64_cycles_step_four hidden">
<p>
Also, send *PRECISELY* 10,000 sats to the following address to start the contract (if you send the wrong
amount it will not work):
</p>
<div class="funding_address_in_step_four">loading...</div>
<p class="asking_for_txid">Asking for txid and vout in 3 seconds</p>
</div>
<div class="cpu_8bit_64_cycles_step_five hidden">
<p>
Broadcast the following transaction to finalize the contract:
</p>
<div class="starter_txhex">loading...</div>
<p><button class="cpu_8bit_64_cycles_step_five_done">Done</button></p>
</div>
<div class="cpu_8bit_64_cycles_step_six hidden">
<p>
What string do you want to reveal to Vicky? Remember, you promised <span
class="step_six_promise_to_vicky"></span> and she can take your money if you lie
</p>
<p><input class="cpu_8bit_64_cycles_paste_program"></p>
<p><button class="cpu_8bit_64_cycles_step_six_done">Submit</button></p>
</div>
</div>
<script src="scripts/view/paul.js"></script>
<script src="scripts/view/zero_checker.js"></script>
<script src="scripts/view/size_checker.js"></script>
<script src="scripts/view/addition.js"></script>
<script src="scripts/view/adder_8bit.js"></script>
<script src="scripts/view/shifter.js"></script>
<script src="scripts/view/sha256.js"></script>
<script src="scripts/view/8bit_cpu_64_cycles.js"></script>
</body>
</html>