-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathdogecoin.html
160 lines (109 loc) · 4.65 KB
/
dogecoin.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Dogecoin Paper Wallet Generator</title>
<meta name="description" content="A lightweight, client-side, reliable, fast, open-source universal paper wallet generator supporting almost every major cryptocurrency">
<meta name="keywords" content="minimal, reliable, fast, universal, paper, wallet, generator, offline, doge, dogecoin, cryptocurrency">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/style2.css">
</head>
<body >
<div id="container"><br>
<div class="noprint"><button onclick="generate()">Generate</button>
<button onclick="window.print()">Print</button>
<a href="index.html"><input type="button" value="Home"/></a>
<!---->
<br>
<div>
<label>My address need include(The longer the custom string, the longer the generation time):</label>
<br>
<input id="SpecifyKeyword" type="" name="" placeholder="66">
<button onclick="generate(true);">Generate custom public address</button>
<button onclick="generate(false);">Generate custom private address</button>
<button id="saveButton">Downlad</button>
</div>
<!---->
</div>
<table>
<tr><h1 id="titlePaper">Dogecoin Paper Wallet</h1></tr>
<tr><th class="grayHeaders">Public Address <span id="shareColor">(SHARE)</span></th></tr>
<tr><td><div id="public"> </div></td></tr>
<tr><td><div id="public_qr"></div></td></tr>
<tr><th class="grayHeaders"><div id="secretLabel">Private Key <span id="secretColor">(SECRET)</span></div></th></tr>
<tr><td><div id="secret"> </div></td></tr>
<tr><td><div id="secret_qr"></div></td></tr>
</table>
</div>
<script src="js/bitcoinjs-lib.js"></script>
<script src="js/qrcode.js"></script>
<script>
async function generate(isPublic) {
console.log("isPublic",isPublic );
document.getElementById("public").textContent = "";
document.getElementById("secret").textContent = "";
document.getElementById("public_qr").textContent = "";
document.getElementById("secret_qr").textContent = "";
const timer = ms => new Promise(res => setTimeout(res, ms))
document.getElementById("public").textContent = "Generating...";
const doge = bitcoin.networks.bitcoin;
doge.pubKeyHash = 0x1e; doge.wif = 0x9e; doge.scriptHash = 0x16;
var keyPair ;
var pubKey ;
var privKey ;
/////////////////////////////////////
var CustomString=document.getElementById('SpecifyKeyword').value;
console.log("CustomString",CustomString );
console.log("CustomString.length",CustomString.length);
do {
await timer(1);
var step;
keyPair = bitcoin.ECPair.makeRandom();
pubKey = keyPair.getAddress();
privKey = keyPair.toWIF();
if (isPublic) {
LastString= pubKey.substr(pubKey.length - CustomString.length);
}else{
LastString= privKey.substr(privKey.length - CustomString.length);
}
// var LastString = pubKey.substr(pubKey.length - CustomString.length);
console.log('LastString:',LastString);
document.getElementById("public").textContent = pubKey;
document.getElementById("secret").textContent = privKey;
// if (pubKey.includes("888")) {
// break;
// }
} while (!LastString.includes(CustomString));
//}
console.log('******pubKey:',pubKey);
/////////////////////////////////////
document.getElementById("public").textContent = pubKey;
document.getElementById("secret").textContent = privKey;
document.getElementById("public_qr").textContent = "";
document.getElementById("secret_qr").textContent = "";
new QRCode(document.getElementById("public_qr"), {text: pubKey, width: 128, height: 128, correctLevel : QRCode.CorrectLevel.H});
new QRCode(document.getElementById("secret_qr"), {text: privKey, width: 128, height: 128, correctLevel : QRCode.CorrectLevel.H});}
document.getElementById('saveButton').addEventListener('click', function() {
const PublicText = document.getElementById("public").innerText;
const SecretText = document.getElementById("secret").innerText;
let FinalText= PublicText + "\n" +SecretText
// Get the value from the textarea
// const text = document.getElementById('textInput').value;
// Create a Blob from the text
const blob = new Blob([FinalText], { type: 'text/plain' });
// Create a link element
const link = document.createElement('a');
// Create a URL for the Blob and set it as the href attribute of the link
link.href = URL.createObjectURL(blob);
// Set the download attribute with a filename
link.download = 'myfile.txt';
// Append the link to the document (not necessary to make it visible)
document.body.appendChild(link);
// Programmatically click the link to trigger the download
link.click();
// Remove the link from the document
document.body.removeChild(link);
});
</script>
</body>
</html>