-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdistributed.pug
More file actions
59 lines (53 loc) · 2.01 KB
/
distributed.pug
File metadata and controls
59 lines (53 loc) · 2.01 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
extends layout
block content
.container-fluid
h1 #{__('Distributed Blockchain')}
- var peers = {1: 'A', 2: 'B', 3: 'C'}
each peer, chain in peers
h3 #{__('Peer')} #{peer}
.row.row-horizon
- var blocks = []
- blocks.push({block: 1, chain: chain, nonce: 11316, previous: '0000000000000000000000000000000000000000000000000000000000000000'})
- blocks.push({block: 2, chain: chain, nonce: 35230, previous: '000015783b764259d382017d91a36d206d0600e2cbb3567748f46a33fe9297cf'})
- blocks.push({block: 3, chain: chain, nonce: 12937, previous: '000012fa9b916eb9078f8d98a7864e697ae83ed54f5146bd84452cdafd043c19'})
- blocks.push({block: 4, chain: chain, nonce: 35990, previous: '0000b9015ce2a08b61216ba5a0778545bf4ddd7ceb7bbd85dd8062b29a9140bf'})
- blocks.push({block: 5, chain: chain, nonce: 56265, previous: '0000ae8bbc96cf89c68be6e10a865cc47c6c48a9ebec3c6cad729646cefaef83'})
each block in blocks
.col-xs-7
include includes/block
script.
$(function() {
setup(1, 1);
setup(2, 1);
setup(3, 1);
setup(4, 1);
setup(5, 1);
setup(1, 2);
setup(2, 2);
setup(3, 2);
setup(4, 2);
setup(5, 2);
setup(1, 3);
setup(2, 3);
setup(3, 3);
setup(4, 3);
setup(5, 3);
});
function getText(block, chain) {
return $('#block'+block+'chain'+chain+'number').val() +
$('#block'+block+'chain'+chain+'nonce').val() +
$('#block'+block+'chain'+chain+'data').val() +
$('#block'+block+'chain'+chain+'previous').val();
}
function setup(block, chain) {
updateHash(block, chain);
$('#block'+block+'chain'+chain+'mineButton').click(function(e) {
e.preventDefault();
var l = Ladda.create(this);
l.start();
setTimeout(function() {
mine(block, chain, true);
l.stop();
}, 250); // give UI time to update
});
}