-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathalias.html
More file actions
69 lines (67 loc) · 2.82 KB
/
Copy pathalias.html
File metadata and controls
69 lines (67 loc) · 2.82 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Alias 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, alias, cryptocurrency">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" href="css/style2.css">
<script src="js/bitcoinjs-lib.js"></script>
<script src="js/bip39.min.js"></script>
<script src="js/qrcode.js"></script>
</head>
<body onload="generate()">
<div class="container">
<h1>Alias 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>
function generate() {
if (typeof bip39 === "undefined" || typeof bitcoin === "undefined") {
alert("bip39 and bitcoinjs-lib are required!");
return;
}
// Alias coin network parameters (ALIAS, coin type 539)
const alias = {
messagePrefix: '\x19Alias Signed Message:\n',
bech32: '',
bip32: { public: 0x2C513BD7, private: 0x2C51C15A },
pubKeyHash: 0x3F,
scriptHash: 0x88,
wif: 0xB3
};
const mnemonic = bip39.generateMnemonic(256);
const seed = bip39.mnemonicToSeedSync(mnemonic);
const root = bitcoin.bip32.fromSeed(seed, alias);
// BIP44 coin type for Alias is 539
const child = root.derivePath("m/44'/539'/0'/0/0");
const { address } = bitcoin.payments.p2pkh({ pubkey: child.publicKey, network: alias });
document.getElementById("public").textContent = address;
document.getElementById("secret").textContent = mnemonic;
document.getElementById("public_qr").innerHTML = "";
document.getElementById("secret_qr").innerHTML = "";
new QRCode(document.getElementById("public_qr"), {
text: address, width: 100, height: 100, colorDark: "#e0e0e0", colorLight: "#1e1e1e", correctLevel: QRCode.CorrectLevel.H
});
new QRCode(document.getElementById("secret_qr"), {
text: mnemonic, width: 100, height: 100, colorDark: "#e0e0e0", colorLight: "#1e1e1e", correctLevel: QRCode.CorrectLevel.H
});
}
</script>
</body>
</html>