-
Notifications
You must be signed in to change notification settings - Fork 31
/
index.html
110 lines (107 loc) · 5.13 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
<!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 Key Converter</title>
<!-- Bootstrap -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/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>
function processForm() {
document.getElementById('output').innerHTML = changeVersionBytes(document.getElementById('xpub').value, document.getElementById('format').value);
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);
document.getElementById('depth').innerHTML = getDepth(document.getElementById('xpub').value, document.getElementById('format').value);
}
</script>
</head>
<body>
<div class="container">
<h1 class="text-center">Bitcoin Extended Public Key Converter</h1>
<hr/>
<div class="row">
<div class="col-md-12">
<form class="row g-3" role="form" action="javascript:void(0);">
<div class="col-md-12">
<p>You can enter any version of a valid Bitcoin extended public key and convert it to another version of
the same extended public key.</p>
<p>
For more info see <a href="https://github.com/satoshilabs/slips/blob/master/slip-0132.md"
target="_blank">SLIP-0132</a>.
</p>
</div>
<div class="col-md-12 generate-container">
<label class="form-label">What version do you want to convert the extended public key into?</label>
<select id="format" class="format form-select">
<option value="xpub" selected>xpub (mainnet P2PKH or P2SH)</option>
<option value="ypub">ypub (mainnet P2WPKH in P2SH)</option>
<option value="Ypub">Ypub (mainnet P2WSH in P2SH)</option>
<option value="zpub">zpub (mainnet P2WPKH)</option>
<option value="Zpub">Zpub (mainnet P2WSH)</option>
<option value="tpub">tpub (testnet P2PKH or P2SH)</option>
<option value="upub">upub (testnet P2WPKH in P2SH)</option>
<option value="Upub">Upub (testnet P2WSH in P2SH)</option>
<option value="vpub">vpub (testnet P2WPKH)</option>
<option value="Vpub">Vpub (testnet P2WSH)</option>
</select>
</div>
<div class="col-md-12">
<label for="xpub" class="form-label">Paste your extended public key here</label>
<textarea class="form-control border border-primary" id="xpub" rows="4" cols="50" style="width: 100%;"></textarea>
</div>
<div class="col-md-12">
<button class="btn btn-primary" onclick="processForm();return false;">Convert</button>
</div>
<div class="col-md-12">
<h4>Converted extended public key:</h4>
<span id="output"></span>
</div>
<div class="col-md-12">
<p>Fingerprint: <span id="fingerprint"></span></p>
<p>Parent Fingerprint: <span id="parentFingerprint"></span></p>
<p>Depth: <span id="depth"></span></p>
</div>
</form>
<hr/>
<div class="col-md-12">
<h4>This tool is 100% open source code</h4>
<p>
<span>The Bitcoin Extended Public Key Converter repository can be found at </span>
<a href="https://github.com/jlopp/xpub-converter" target="_blank">
https://github.com/jlopp/xpub-converter
</a>
</p>
<p>
<span>This logic is also available as an npm module via </span>
<a href="https://github.com/ExodusMovement/xpub-converter" target="_blank">
https://github.com/ExodusMovement/xpub-converter
</a>
</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>
</div>
</div>
</div>
</body>
</html>