-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.html
161 lines (144 loc) · 6.91 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
<!DOCTYPE html>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<head>
<title>Export Counterparty Addresses & Keys</title>
<script type="text/javascript" src="js/bitcore-lib.min.js"></script>
<script type="text/javascript" src="js/bitcore-message.min.js"></script>
<script type="text/javascript" src="js/util.bitcore.js"></script>
<script type="text/javascript" src="js/bitcoinjs-lib.min.js"></script>
<script type="text/javascript" src="js/mnemonic.js"></script>
<script type="text/javascript" src="js/xcp-tools-passphrase.js"></script>
<script>
function createAddress(passphrase, i, network) {
wallet = Mnemonic.fromWords(passphrase.trim().split(" ")).toHex(),
network = bitcore.Networks[network],
seed = bitcore.HDPrivateKey.fromSeed(wallet, network),
derive = seed.derive("m/0'/0/" + i),
addr_legacy = bitcore.Address(derive.publicKey, network).toString(),
privkey_legacy = derive.privateKey.toWIF(),
derive = seed.derive("m/0'/0/" + i),
addr_segwit = bitcoinjs.payments.p2wpkh({ pubkey: derive.publicKey.toBuffer(), network: bitcoinjs.networks[network] }).address,
privkey_segwit = 'p2wpkh:'+privkey_legacy;
return([addr_legacy, addr_segwit, privkey_legacy, privkey_segwit]);
}
function createAddressList() {
let net = document.getElementById('network').value;
let pp = document.getElementById('passphrase').value;
let addr = document.getElementById('amount').value;
let sep = document.getElementById('separator').value;
let chk_ind = document.querySelector('#display0').checked;
let chk_leg = document.querySelector('#display1').checked;
let chk_seg = document.querySelector('#display2').checked;
let chk_key = document.querySelector('#display3').checked;
let chk_key_seg = document.querySelector('#display4').checked;
let chk_show_pp = document.querySelector('#display5').checked;
let chk_show_ch = document.querySelector('#display6').checked;
let out = '';
let br = '<br>';
//Converts string to lowercase and eliminates unwanted spaces and signs
pp = cleanPPformat(pp);
//Check if Counterparty PP
if(!isValidPP(pp)) {
let out = 'Passphrase is not valid';
document.getElementById('output').innerHTML = out;
return;
}
//Output passphrase
if (chk_show_pp) out += 'Passphrase: ' + pp + br;
//Output column headers
if (chk_show_ch) {
let row = [];
if (chk_ind) row.push('Count');
if (chk_leg) row.push('Legacy Address');
if (chk_seg) row.push('Segwit Address');
if (chk_key) row.push('Private Key');
if (chk_key_seg) row.push('Private Key w/ Segwit Prefix');
out += row.join(sep) + br;
}
//Output addresses + keys
for(let i=0;i<addr;i++){
let a = createAddress(pp, i, net);
let row = [];
if (chk_ind) row.push(String(i+1));
if (chk_leg) row.push(a[0]);
if (chk_seg) row.push(a[1]);
if (chk_key) row.push(a[2]);
if (chk_key_seg) row.push(a[3]);
out += row.join(sep) + br;
}
document.getElementById('output').innerHTML = out;
}
</script>
<style>
#content {
font-family: Helvetica, sans-serif;
margin: auto;
max-width: 1030px;
border: 2px solid #8B8B81;
border-radius: 12px;
background-color: #F5F5F5;
padding: 20px;
text-align: left;
}
#passphrase {
width: 100%;
}
#network, input[type=submit] {
width: 8em;
}
#amount, #separator {
width: 3.5em;
}
</style>
</head>
<body>
<div id="content">
<h1>Export Counterparty Addresses & Keys</h1>
<p>This script outputs addresses (legacy and segwit) with private keys.</p>
<p>The input passphrase (seed) must be a classic 12-word passphrase from Counterwallet, FreeWallet.io, Rare Pepe Wallet, etc.</p>
<p>A BIP39 seed will not work.</p>
<p><br><b>WARNING #1:</b> If you enter a wrong word, e.g. <i>'sad'</i> insted of <i>'said'</i> you will generate a wrong list of addresses. Always double check!</p>
<p><b>WARNING #2:</b> It is recommended to <a href="https://github.com/Jpja/XCP-Export-Segwit">download</a> the code and run it on an offline computer.</p>
<label for="network"><br><b>Network</b></label><br>
<select name="network" id="network"><br>
<option value="bitcoin" selected="selected">Bitcoin</option>
<option value="testnet">Testnet</option>
</select><br><br>
<label for="passphrase"><b>Passphrase</b></label><br>
<input type="text" id="passphrase" name="passphrase"><br><br>
<label for="amount"><b>Addresses</b></label><br>
<input type="number" id="amount" name="amount" value="20"><br><br>
<label for="separator"><b>Separator</b></label><br>
<input type="text" id="separator" name="separator" value=","><br><br>
<b>Display</b><br>
<input type="checkbox" id="display0" name="display0" value="display0" checked>
<label for="display0"> Count</label><br>
<input type="checkbox" id="display1" name="display1" value="display1" checked>
<label for="display1"> Legacy Addresses</label><br>
<input type="checkbox" id="display2" name="display2" value="display2" checked>
<label for="display2"> Segwit Addresses</label><br>
<input type="checkbox" id="display3" name="display3" value="display3" checked>
<label for="display3"> Private Keys</label><br>
<input type="checkbox" id="display4" name="display4" value="display4">
<label for="display4"> Private Keys w/ Segwit Prefix</label><br>
<input type="checkbox" id="display5" name="display5" value="display5" checked>
<label for="display5"> Passphrase</label><br>
<input type="checkbox" id="display6" name="display6" value="display6" checked>
<label for="display6"> Column Headers</label>
<br><br><input type="submit" value="Submit" onclick="createAddressList()">
<pre><code id="output"> <br> <br> <br> <br></code></pre>
<div id="footer">
<br>Made by JP Janssen<br>
Source code on <a href="https://github.com/Jpja/XCP-Export-Segwit">Github</a><br>
MIT license<br><br>
<a href="https://jpjanssen.com/donation-dispensers-for-my-xcp-projects/">Donate</a><br>
BTC: bc1qg8vldv8kk4mqafs87z2yv0xpq4wr4csucr3cj7<br>
DOGE: DChdsuLuEvAPZb9ZXpiEpimgidSJ5VqShq<br>
ETH: 0x4144CbaF54044510AB2F2f3c51061Dd5558cD604<br>
<i>BTC and DOGE addresses have dispensers installed.<br>
You automatically get vintage tokens in return.</i>
</div>
</div>
</body>
</html>