-
Notifications
You must be signed in to change notification settings - Fork 1
/
dash.html
28 lines (25 loc) · 1.37 KB
/
dash.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
<script src="js/bitcoinjs-lib.js" integrity="sha384-zGWl15v6CBuUT4k6pkg8+P+rc5xRDr6NKW6Yuh8nbfN5hHeDlz9bu61MrsvohxXL"
crossorigin="anonymous"></script>
<script src="js/qrcode.js" integrity="sha384-+uaAthihb/4g7LTyfTcJu4KOKCIN0f1EeBxAwgcbeu26cV+fCgk/WQTuJ+jiHfhP"
crossorigin="anonymous"></script>
<script>
function generate() {
const dash = bitcoin.networks.bitcoin;
dash.pubKeyHash = 0x4c; dash.wif = 0xcc; dash.scriptHash = 0x10;
const keyPair = bitcoin.ECPair.makeRandom();
const pubKey = keyPair.getAddress();
const privKey = keyPair.toWIF();
document.getElementById("public").textContent = pubKey;
document.getElementById("public_qr").textContent = "";
new QRCode(document.getElementById("public_qr"), { text: pubKey, width: 300, height: 300, correctLevel: QRCode.CorrectLevel.H });
//Start: Set details of crypto
var explorerUrl = 'https://explorer.dash.org/insight/address'; //Ensure there's no "/" at the end
var a = document.getElementById('explorer-url');
a.href = explorerUrl + "/" + pubKey;
document.getElementById('pubKey').value = pubKey;
document.getElementById('privKey').value = privKey;
document.getElementById('cryptoExplorer').value = 'Dash.org';
document.getElementById('cryptoExplorerUrl').value = explorerUrl;
//End
}
</script>