-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathdash.html
More file actions
91 lines (79 loc) · 3.4 KB
/
dash.html
File metadata and controls
91 lines (79 loc) · 3.4 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Dash Cold Wallet Generator</title>
<meta name="description"
content="A lightweight, client-side, reliable, fast, open-source universal cold wallet generator supporting almost every major cryptocurrency">
<meta name="keywords"
content="minimal, reliable, fast, universal, cold, wallet, generator, offline, dash, cryptocurrency">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/style2.css">
</head>
<body onload="generate()">
<div class="container">
<h1>Dash Cold Wallet</h1>
<div class="button-group">
<button onclick="window.location.href='index.html'">Home</button>
<button onclick="generate()">Generate</button>
<button onclick="window.print()">Print</button>
</div>
<div class="info-box">
<label>Public Address (SHARE)</label>
<span id="public">Click Generate to create wallet</span>
<div id="public_qr" class="qr-code"></div>
</div>
<div class="info-box">
<label>Mnemonic Seed (SECRET)</label>
<span id="secret">Click Generate to create wallet</span>
<div id="secret_qr" class="qr-code"></div>
</div>
</div>
<script src="js/bitcoinjs-lib.js"></script>
<script src="js/bip39.min.js"></script>
<script src="js/qrcode.js"></script>
<script>
async function generate() {
// Generate a 12-word mnemonic
const mnemonic = bip39.generateMnemonic(256);
// Derive seed from mnemonic
const seed = await bip39.mnemonicToSeed(mnemonic);
// Dash network params
const dash = bitcoin.networks.bitcoin;
dash.pubKeyHash = 0x4c;
dash.wif = 0xcc;
dash.scriptHash = 0x10;
// Derive root and first account: m/44'/5'/0'/0/0 (Dash BIP44)
const root = bitcoin.bip32.fromSeed(seed, dash);
const child = root.derivePath("m/44'/5'/0'/0/0"); // Dash coin_type is 5
const { address } = bitcoin.payments.p2pkh({ pubkey: child.publicKey, network: dash });
const publicElem = document.getElementById("public");
const mnemonicElem = document.getElementById("secret");
const publicQRElem = document.getElementById("public_qr");
const mnemonicQRElem = document.getElementById("secret_qr");
if (publicElem && mnemonicElem && publicQRElem && mnemonicQRElem) {
publicElem.textContent = address;
mnemonicElem.textContent = mnemonic;
publicQRElem.innerHTML = "";
mnemonicQRElem.innerHTML = "";
new QRCode(publicQRElem, {
text: address,
width: 100,
height: 100,
colorDark: "#e0e0e0",
colorLight: "#1e1e1e",
correctLevel: QRCode.CorrectLevel.H
});
new QRCode(mnemonicQRElem, {
text: mnemonic,
width: 100,
height: 100,
colorDark: "#e0e0e0",
colorLight: "#1e1e1e",
correctLevel: QRCode.CorrectLevel.H
});
}
}
</script>
</body>
</html>