forked from jlopp/xpub-converter
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
131 lines (130 loc) · 7.78 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Bitcoin Extended Public & Private Key Converter</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<script src="js/browserified.js"></script>
<script src="js/qrcodejs/qrcode.min.js"></script>
<script>
function processForm() {
document.getElementById('output').innerHTML = changeVersionBytes(document.getElementById('xpub').value, document.getElementById('format').value);
qrcode.makeCode(document.getElementById('output').innerHTML);
document.getElementById('fingerprint').innerHTML = getFingerprint(document.getElementById('xpub').value, document.getElementById('format').value);
document.getElementById('parentFingerprint').innerHTML = getParentFingerprint(document.getElementById('xpub').value, document.getElementById('format').value);
}
</script>
</head>
<body>
<div class="container">
<h1 class="text-center">Bitcoin Extended Public & Private Key Converter</h1>
<hr/>
<div class="row">
<div class="col-md-12">
<form class="form-horizontal" role="form" action="javascript:void(0);">
<div class="form-group">
<div class="col-sm-2">
</div>
<div class="col-sm-10">
<p>You can enter any version of a valid Bitcoin extended public/private key and convert it to another version of the same extended key. (For example, exporting an xpub/ypub/zpub from Ledger Live to use in some other wallet or tool.)</p>
<p>
For more info see <a href="https://github.com/satoshilabs/slips/blob/master/slip-0132.md" target="_blank">SLIP-0132</a>.
</p>
<p><b>The online version of this tool should only ever be used for working with extended public keys (xpub, etc) or for testing/education purposes...</b>
<br>
You should normally never need to convert or handle xprv keys except in VERY SPECIFIC recovery situations... Working with extended private keys (xprv/yprv/zprv, etc) should only ever be done in an offline (all networking disconnected), amnesic environment like TAILS Linux... <a href="https://github.com/3rdIteration/btc-extended-key-converter/archive/master.zip">Click here to download a zip file containing this tool to run offline</a> </p>
</div>
</div>
<div class="form-group generate-container">
<label class="col-sm-2 control-label"></label>
<div class="col-sm-10">
<div class="form-inline">
<div class="input-group-inline">
Paste your extended key to be converted here:<br/>
<textarea id="xpub" rows="4" cols="50" style="width: 500px;height: 50px;"></textarea>
<br/><br/>
<span>What version do you want to convert the extended key into?</span><br/>
<select id="format" class="format form-control">
<option value="xpub" selected>xpub 'Legacy' (mainnet P2PKH or P2SH)</option>
<option value="ypub">ypub 'Segwit' (mainnet P2WPKH in P2SH)</option>
<option value="zpub">zpub 'Native Segwit' (mainnet P2WPKH)</option>
<option value="Ypub">Ypub 'Multisig Segwit' (mainnet P2WSH in P2SH)</option>
<option value="Zpub">Zpub 'Multisig Native Segwit' (mainnet P2WSH)</option>
<option value="tpub">tpub 'Legacy' (testnet P2PKH or P2SH)</option>
<option value="upub">upub 'Segwit' (testnet P2WPKH in P2SH)</option>
<option value="vpub">vpub 'Native Segwit' (testnet P2WPKH)</option>
<option value="Upub">Upub 'Multisig Segwit' (testnet P2WSH in P2SH)</option>
<option value="Vpub">Vpub 'Multisig Native Segwit' (testnet P2WSH)</option>
<option value="xprv">xprv 'Legacy' (mainnet P2PKH or P2SH)</option>
<option value="yprv">yprv 'Segwit' (mainnet P2WPKH in P2SH)</option>
<option value="zprv">zprv 'Native Segwit' (mainnet P2WPKH)</option>
<option value="Yprv">Yprv 'Multisig Segwit' (mainnet P2WSH in P2SH)</option>
<option value="Zprv">Zprv 'Multisig Native Segwit' (mainnet P2WSH)</option>
<option value="tprv">tprv 'Legacy' (testnet P2PKH or P2SH)</option>
<option value="uprv">uprv, 'Segwit' (testnet P2WPKH in P2SH)</option>
<option value="vprv">vprv, 'Native Segwit' (testnet P2WPKH)</option>
<option value="Uprv">Uprv, 'Multisig Segwit' (testnet P2WSH in P2SH)</option>
<option value="Vprv">Vprv, 'Multisig Native Segwit' (testnet P2WSH)</option>
</select>
<br/><br/>
<button class="btn" onclick="processForm();return false;">Convert</button><br/><br/>
<b>Converted extended key:</b><br/><br/>
<span id="output"></span><br><br>
Fingerprint: <span id="fingerprint"></span><br/>
Parent Fingerprint: <span id="parentFingerprint"></span><br/><br>
<b>Extended Key QR Code:</b><br/><br/>
<div id="qrcode"></div>
<script type="text/javascript">
var qrcode = new QRCode(document.getElementById("qrcode"));
</script>
<i>Scan this QR code with a Bitcoin wallet like Blue Wallet or Electrum</i>
<br><br>
</div>
</div>
</div>
</div>
<hr/>
<div class="form-group">
<div class="col-sm-2">
</div>
<div class="col-sm-10">
<h2>This tool is 100% open source code</h2>
<p>
<span>The Bitcoin Extended Public & Private Key Converter repository can be found at </span>
<a href="https://github.com/3rdIteration/btc-extended-key-converter" target="_blank">
https://github.com/3rdIteration/btc-extended-key-converter
</a><br>
<span>This tool expands on the original tool found here: <a href="https://github.com/jlopp/xpub-converter/" target="_blank">
https://github.com/jlopp/xpub-converter/
</a></span>
</p>
<h3>Libraries</h3>
<p>
<span>bs58check: </span>
<a href="https://github.com/bitcoinjs/bs58check" target="_blank">
https://github.com/bitcoinjs/bs58check
</a>
</p>
<p>
<span>Twitter Bootstrap: </span>
<a href="http://getbootstrap.com/" target="_blank">
http://getbootstrap.com/
</a>
</p>
</div>
</form>
</div>
</div>
</div>
</body>
</html>