This repository has been archived by the owner on Aug 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathindex.html
375 lines (372 loc) · 19.2 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
<!DOCTYPE html>
<html lang='en'>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<link rel="shortcut icon" href="assets/favicon.ico" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="assets/bootstrap-4.5.0/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="assets/style/style.css">
<script type="text/javascript" src="assets/bootstrap-4.5.0/js/jquery.js"></script>
<script type="text/javascript" src="assets/bootstrap-4.5.0/js/bootstrap.js"></script>
</head>
<audio controls id="woof" style='display:none;'>
<source src="assets/woof.mp3" type="audio/mpeg">
</audio>
<body>
<div id="page-container">
<div id="content-wrap">
<nav class="navbar navbar-expand-lg sticky-top navbar-light navbarSpecial">
<img class="navbar-brand" src='assets/doge.png' onclick="document.getElementById('woof').play();" alt="Doge" style='vertical-align: middle;width:40px;display:inline'>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav" >
<ul class="navbar-nav mr-auto" style='background-color:#ecd3af;filter: drop-shadow(5px 5px 3px #323232);'>
<li class="nav-item"><a id='start' class="nav-link" onclick="openTab(event, 'home')">Intro</a></li>
<li class="nav-item"><a class="nav-link" style='color:black;' onclick="openTab(event, 'keypair')">Wallets</a></li>
<li class="nav-item"><a class="nav-link" style='color:black;' onclick="openTab(event, 'Transaction')">Create Transaction</a></li>
<li class="nav-item"><a class="nav-link" style='color:black;' onclick="startNetworkTest();openTab(event, 'WalletData');">Network Data</a></li>
<li class="nav-item"><a class="nav-link" style='color:black;' onclick="openTab(event, 'Settings');">Settings</a></li>
</ul>
</div>
</nav>
<br>
<div style='display:none;background-color:red;margin-bottom:15px;' id='outdated'>Warning your version is outdated please update to the newest stable version at the <a href='https://github.com/dogecash/dogecash-web-wallet/releases'>Dogecash Github</a></div>
<div class="container-fluid">
<div class="row no-gutters">
<div class='col-md-1'>
<div style='float:center'>
<div id='Debug' style='color:#ffa500'></div>
<div id='Network' style='color:#ffa500'></div>
</div>
</div>
<div class='col-md-10'>
<div id="home" class="tabcontent">
<center><h3> Welcome to the dogecash Web wallet! </h3></center>
<h4> A wallet for every one! </h4>
<h5 style='text-indent: 30px;'>
This web wallet is designed to be able to run on any computer with a modern browser, from a Rasberry Pie to gaming desktop.
This wallet can do it! It has also been designed to generate wallets and create transactions without a network connection.
Make sure when you run this wallet to run it from a trusted source such as dogec.io or download it from the Github and run it on your computer.
We tryed to make the user interface as friendly as possible but in the event that you don't understand something feel free to check out the tutorials at the github
or create a issue on that github and we will get to it as fast as possible.
</h5>
<h4> Generate Paper wallets </h4>
<h5 style='text-indent: 30px;'>
This web wallet functions much like a paper wallet generator, but with features most normal wallets have. You can also generate transactions offline!
Head over to the wallet tab and generate your first wallet. Make sure to keep the key secure! otherwise you may lose all your coins.
</h5>
</div>
<div id="keypair" class="tabcontent">
<h3>Generate Dogec wallet</h3>
<div id='importWallet' style='display:none;'>
<input type="text" id='privateKey' placeholder="Private Key">
<button onclick="importWallet()">Import wallet</button>
</div>
<div id='generateWallet'>
<button onclick="generateWallet()">Create A New Wallet</button>
</div>
<br>
<div id='generateVanityWallet'>
<input style="display:none;" type="text" id='prefix' placeholder="Address Prefix">
<button onclick="generateVanityWallet()">Create A Vanity Wallet</button>
</div>
<br>
<button id='wToggle'onclick='toggleWallet()'>Access My Wallet</button>
<br>
<br>
<h4 id='genKeyWarning' style='display:none;'><b>Warning: if you do not save your generated private key you will not have access to the coins associated with that key</b></h4>
<br>
<div style='display:none;' id='Privatelabel'>Private:</div><div id='PrivateTxt'></div>
<br>
<div id="PrivateQR"></div>
<br>
<div style='display:none;' id='Publiclabel'>Public:</div><div id='PublicTxt'></div>
<br>
<div id="PublicQR"></div>
</div>
<div id="Transaction" class="tabcontent">
<div id='errorNotice'></div>
<div class='pullDown' style='clear:both;'>
<div onclick='toggleDropDown("loadSimpleTransactions")'>Create Simple Transactions<span style='float:right;'>▼</span></div>
<div id='loadSimpleTransactions'style='display:none'>
In order to use simple transactions you must first load your wallet
<br>
<button onclick='loadUnspendInputs()'>Load Wallet</button>
</div>
<div id='simpleTransactions' style='display:none'>
<label>Address</label>
<input type="text" id="address1s">
<label>Amount</label>
<input type="text" id="value1s">
<br>
<textarea rows="15" cols="70" id="simpleRawTx"></textarea>
<br>
<div id='HumanReadable'></div>
<br>
<button onclick="createSimpleTransation()" id='genIt'>Create Raw Signed Transction</button>
<button onclick="sendTransaction(document.getElementById('simpleRawTx').value)" style='display:none' id='sendIt'>Send Transaction</button>
</div>
<div id='transactionFinal'></div>
</div>
<br>
<div class='pullDown' style='clear:both;'>
<div onclick='toggleDropDown("advTransactions")'>Create Manual Transactions<span style='float:right;'>▼</span></div>
<div id='advTransactions' style='display:none'>
<h2>Inputs</h2>
<label>Trx Hash</label>
<input type="text" id="prevTrxHash">
<label>Index</label>
<input type="text" id="index">
<label>Script</label>
<input type="text" id="script">
<h2>Outputs</h2>
<label>Output Address 1</label>
<input type="text" id="address1">
<label>Amount</label>
<input type="text" id="value1">
<br/>
<label>Output address 2</label>
<input type="text" id="address2">
<label>Amount</label>
<input type="text" id="value2">
<h2>WIF Key</h2>
<label>key</label>
<input type="text" id="wif">
<br/><br/>
<b>WARNING ANY FUNDS NOT ALLOCATED WILL BE USED AS FEES</b>
<br>
<button onclick="createRawTransaction()">Create Raw Signed Transction</button>
<br/><br/><br/>
<h2>Signed Raw Transaction</h2>
<textarea rows="15" cols="70" id="rawTrx"></textarea>
<h3>Don't understand how this works? <a target='_blank' href='https://github.com/Luke-Larsen/DogeCashWebWallet#transaction'>Tutorial Here</a>
<h4>Advanced Details: <br>locktime is set to 0, sequence is set to max. SIGHASH_ALL option is chosen for signing raw Transaction.</h4>
</div>
</div>
</div>
<div id="Settings" class="tabcontent">
<form action="javascript:setExplorer()">
<label for="explorer">Choose a explorer:</label>
<select id="explorer" name="explorer" oninput="explorerCheck()">
<option value="explorer.dogec.io">https://explorer.dogec.io/</option>
<option value="none">https://none.com</option>
<option value="custom">custom (In Development)</option>
</select>
<div id='customExplorer' style='display:none;'>
<input type="text" id="explorerURL" name="explorerURL" placeholder="explorer.dogec.io"><br>
<select id="explorerType" name="explorerType">
<option value="blockbook">blockbook</option>
</select>
</div>
<br>
<input type="submit" style='background-color:#243646;color:#dddfe2;'>
</form>
<br>
<button type="submit" onclick='toggleDebug()'>Toggle Debug mode</button>
<button type="submit" onclick='toggleNetwork()'>Toggle Networking mode</button>
</div>
<div id="WalletData" class="tabcontent">
<div id='networkingNotices'></div>
<div id='readout' style='display:none'>
<div style='float:left;'>
Wallet Details
<hr>
Balance: <span id='balance'></span> | Total Received: <span id='totalReceived'></span> | Total Sent: <span id='totalSent'></span>
<br>
<div class='pullDown' style='clear:both;'>
<div onclick='toggleDropDown("Transactions")'>Transactions:<span id='TransactionNumber'>▼</span><span style='float:right;'>▼</span></div>
<div style='background-color:#D0D0D0; width:100%'><span style='display:none;' id='Transactions'></span></div>
<br>
<br>
</div>
</div>
<!--Right -->
<div id='NetworkDataAddrs'>
<span style='margin-left:1px;'>Address Response</span>
<hr>
<span id='addrStr' style='margin-left:1px;'></span><br>
<span id='addrStrQR' style='margin-left:1px;'></span>
</div>
<div class='pullDown' style='clear:both;'>
<div onclick='toggleDropDown("NetworkingJson")'>Pure json:<span style='float:right;'>▼</span></div>
<div style='background-color:#D0D0D0; width:100%'>
<textarea rows="15" cols="50" id="NetworkingJson" style='display:none;font-size:4vw;width:99%;overflow:hidden;background-color:#D0D0D0;'></textarea>
</div>
</div>
</div>
</div>
</div>
<div class='col-md-1'>
</div>
</div>
</div>
</div>
<div class="footer">
<div style='display:inline;' id='dcfooter'></div>
</div>
</div>
<script type="text/javascript" src="scripts/libs/crypto-min.js"></script>
<script type="text/javascript" src="scripts/libs/crypto-sha256.js"></script>
<script type="text/javascript" src="scripts/libs/crypto-sha256-hmac.js"></script>
<script type="text/javascript" src="scripts/libs/ripemd160.js"></script>
<script type="text/javascript" src="scripts/libs/jsbn.js"></script>
<script type="text/javascript" src="scripts/libs/ellipticcurve.js"></script>
<script type="text/javascript" src="scripts/libs/script.js"></script>
<script type="text/javascript" src="scripts/libs/qrcode.js"></script>
<script type="text/javascript" src="scripts/libs/sha256.js"></script>
<script type="text/javascript" src="scripts/settings.js"></script>
<script type="text/javascript" src="scripts/wallet.js"></script>
<script type="text/javascript" src="scripts/network.js"></script>
<script type="text/javascript" src="scripts/bitTrx.js"></script>
<script>
function toggleWallet(){
var toggle = document.getElementById("wToggle").innerHTML;
// Hide and Reset the Vanity address input
document.getElementById('prefix').value = "";
document.getElementById('prefix').style.display = 'none';
if(toggle === "Access My Wallet"){
document.getElementById("generateWallet").style.display = 'none';
document.getElementById("importWallet").style.display = 'block';
document.getElementById("wToggle").innerHTML = "Create A New Wallet";
}else{
document.getElementById("generateWallet").style.display = 'block';
document.getElementById("importWallet").style.display = 'none';
document.getElementById("wToggle").innerHTML = "Access My Wallet";
}
}
async function generateVanityWallet() {
// Generate a vanity address with the given prefix
let strPrefix = document.getElementById('prefix');
if (strPrefix.value.length === 0) {
// No prefix, display the intro!
strPrefix.style.display = 'block';
document.getElementById('genKeyWarning').style.display = 'block';
document.getElementById('Privatelabel').style.display = 'block';
document.getElementById('Publiclabel').style.display = 'block';
document.getElementById('PrivateTxt').innerHTML = "---";
document.getElementById('PublicTxt').innerHTML = "---";
} else {
// We also don't want users to be mining addresses for years... so cap the letters to four until the generator is more optimized
if (strPrefix.value.length > 4) return alert("This is a long name! This would take a LONG time to find, please choose a shorter name!");
// Cache a lowercase equivilent for lower-entropy comparisons (a case-insensitive search is ALOT faster!) and strip accidental spaces
const nInsensitivePrefix = strPrefix.value.toLowerCase().replace(/ /g, "");
let attempts = 0;
// Begin the search, cap'n!!!
while (true) {
let nWallet = await generateWallet(nInsensitivePrefix);
// Check if the prefix matches the pubkey...
if (nWallet.vanity_match) return console.log("VANITY: Found an address after " + attempts + " attempts!");
// No match, bump the attempts
attempts++;
}
}
}
function explorerCheck(){
let checkcustom = document.getElementById("explorer").value;
let checkcustomOpen = document.getElementById("customExplorer").style.display;
if(checkcustom == 'custom' && checkcustomOpen != "block"){
toggleDropDown('customExplorer')
}else if(checkcustom != 'custom'){
document.getElementById("customExplorer").style.display = 'none';
}
}
function toggleDropDown(id){
var openClosed = document.getElementById(id).style.display;
if(openClosed === 'block'){
document.getElementById(id).style.display = 'none';
}else{
document.getElementById(id).style.display = 'block';
}
}
function startNetworkTest(){
if(networkEnabled){
if(typeof publicKeyForNetwork !== 'undefined'){
checkPubKey(); //readout
document.getElementById("readout").style.display = 'block';
document.getElementById("networkingNotices").innerHTML = '';
}else{
document.getElementById("networkingNotices").innerHTML = 'No public key';
}
}else{
document.getElementById("networkingNotices").innerHTML = 'Network disabled';
}
}
function loadUnspendInputs(){
if(publicKeyForNetwork){
trx = bitjs.transaction();
getUnspentTransactions();
document.getElementById("loadSimpleTransactions").style.display = 'none';
document.getElementById("simpleTransactions").style.display = 'block';
document.getElementById("genIt").style.display = 'block';
}else{
console.log("no Public Key");
}
}
function createSimpleTransation(){
if(trx['inputs']['length'] == amountOfTransactions){
var address = document.getElementById("address1s").value;
var value = document.getElementById("value1s").value;
if(address != '' && value != ''){
calculatefee();
trx.addoutput(address,value);//Sending to this address
addresschange = publicKeyForNetwork;
totalSent = (parseFloat(fee) + parseFloat(value)).toFixed(8);
valuechange = (parseFloat(balance) - parseFloat(totalSent)).toFixed(8);
if(totalSent <= balance){
document.getElementById("HumanReadable").innerHTML = "Balance:" + balance + "<br>Fee:" + fee + "<br>ToAddress:" + address + "<br>HowMuchSend:" + value + "<br>ChangeAddress:" + addresschange + "<br>HowMuchChange:" +valuechange;
trx.addoutput(addresschange,valuechange);//Change Address
if(typeof privateKeyForTransactions !== 'undefined'){
var wif = privateKeyForTransactions;
var textArea = document.getElementById("simpleRawTx");
textArea.value = trx.sign(wif,1);
document.getElementById("genIt").style.display = 'none';
document.getElementById("sendIt").style.display = 'block';
}else{
console.log("No private key");
}
}else{
document.getElementById("HumanReadable").innerHTML = "You are trying to send more then you have!";
}
}else{
console.log("No address or value");
}
}else{
console.log("wallet Still loading");
}
}
function createRawTransaction() {
//advanced transaction creation and signing
var trx = bitjs.transaction();
var txid = document.getElementById("prevTrxHash").value;
var index = document.getElementById("index").value;
var script = document.getElementById("script").value;
trx.addinput(txid,index,script);
var address = document.getElementById("address1").value;
var value = document.getElementById("value1").value;
trx.addoutput(address,value);
var address = document.getElementById("address2").value;
var value = document.getElementById("value2").value;
trx.addoutput(address,value);
var wif = document.getElementById("wif").value;
var textArea = document.getElementById("rawTrx");
textArea.value = trx.sign(wif,1); //SIGHASH_ALL DEFAULT 1
}
function openTab(evt, tabName) {
var i, tabcontent, tablinks;
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
tablinks = document.getElementsByClassName("tablinks");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
document.getElementById(tabName).style.display = "block";
evt.currentTarget.className += " active";
}
document.getElementById("start").click();
</script>
</body>
</html>