forked from jaimehgb/Bitcoin-address-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
177 lines (153 loc) · 6.78 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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<script src="jquery.min.js"></script>
<script src="bootstrap.min.js"></script>
<script src='bitcoinjs.min.js'></script>
<<<<<<< HEAD
<title>Bitcoin address generator</title>
=======
<title>Address Generator</title>
>>>>>>> 5a897414bf4a0fdc6df6bf01714a2edff6e3c04f
</head>
<body>
<div class="main">
<div class="col-sm-12">
<div class="col-sm-12">
<h3>Generate Bitcoin Key Pairs</h3>
<hr/>
<form method="post" class="form-generate">
<div class="form-group">
<label>Number of addresses</label>
<input type="text" name="number" id="number" class="form-control" value=1000>
</div>
<div class="form-group">
<label>Update interval <small>(if small, worse performance. If too big browser can crash)</small></label>
<input type="text" name="interval" id='interval' class="form-control" value=50>
</div>
<div class="form-group">
<label>Bitcoind Installation path <small>(Optional)</small></label>
<input type="text" name="path" id='path' class="form-control" placeholder="e.g.: C:\Program Files\Bitcoin\daemon\bitcoin-cli.exe">
</div>
<div class="form-group">
<input type="submit" name="generate" class="btn btn-primary" value="Generate">
</div>
</form>
<form method="post" class="form-stop">
<div class="form-group">
<input type="submit" class="btn btn-danger" value="STOP">
</div>
</form>
<hr/>
</div>
</div>
<hr/>
<div class="form-group text-center">
<h3>Execution time: <span id='time'></span></h3>
<h4>Addresses generated so far: <span id='count'></span></h4>
</div>
<hr/>
<div class="col-sm-12">
<div class="col-sm-4">
<h3>Public addresses</h3>
<div class="col-xs-12">
<div class="form-group">
<textarea class="form-control" style="height:300px" id="public"></textarea>
</div>
</div>
</div>
<div class="col-sm-4">
<h3>Private Keys</h3>
<div class="col-xs-12">
<div class="form-group">
<textarea class="form-control" style="height:300px" id="private"></textarea>
</div>
</div>
</div>
<div class="col-sm-4">
<h3>Public addresses<span><small>(Dot comma separated)</small></span></h3>
<div class="col-xs-12">
<div class="form-group">
<textarea class="form-control" style="height:300px" id="separated"></textarea>
</div>
</div>
</div>
</div>
<div class="col-xs-12" style="margin-top:3%">
<h3>Bitcoind Import format</h3>
<textarea class="form-control" id='bitcoind' style="height:500px; margin-bottom:5%"></textarea>
</div>
</div>
<script>
running = true;
$('.form-stop').submit(function(){
running = false;
return false;
});
$('.form-generate').submit(function() {
// globals
publics = $('#public');
privates = $('#private');
commas = $('#separated');
counthtml = $('#count');
bitcoind = $('#bitcoind');
running = true;
//clear
publics.html('');
privates.html('');
commas.html('');
bitcoind.html('');
start = new Date().getTime();
//number of addresses
limit = parseInt($('#number').val());
interval = parseInt($('#interval').val());
path = $('#path').val();
counter = 0;
looper();
function looper()
{
if(running)
{
counter += fave(interval);
if(counter < limit)
{
setTimeout(looper, 0)
counthtml.html(counter);
}
else
{
counthtml.html(counter);
var end = new Date().getTime();
var time = end - start;
time = time / 1000;
$('#time').html(time+' seconds.');
}
}
}
return false;
});
function fave(loops = 15)
{
for(var i=0; i<loops; i++)
{
//generate address
var keyPair = bitcoin.ECPair.makeRandom()
//extract public key
var pbl = keyPair.getAddress();
//extract private key
var priv = keyPair.toWIF();
// add them to textareas
publics.append('\n'+pbl);
privates.append('\n'+priv);
commas.append('\n'+pbl+';');
bitcoind.append('\n'+ '\"'+path+'\"' + ' importprivkey ' + priv + ' addr-1DfyaDvr-' + (counter + i + 1) + ' false');
}
return loops;
}
</script>
</body>
</html>