Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
add yprvs
Browse files Browse the repository at this point in the history
add yprv output
  • Loading branch information
coinables committed Mar 30, 2021
1 parent c654ae6 commit 4e49288
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
6 changes: 5 additions & 1 deletion bip39/buidl.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,8 @@ function fromXpub(xpub, acctNumber, keyindex, type){
}

function xprvToWIF(xprv, change, index){
let wif = bitcoin.HDNode.fromBase58(xprv).derivePath(change+"/"+index).keyPair.toWIF();
var inputExt = convertXpub(xprv,"xprv");
let wif = bitcoin.HDNode.fromBase58(inputExt).derivePath(change+"/"+index).keyPair.toWIF();
return{
wif
}
Expand Down Expand Up @@ -460,6 +461,9 @@ function convertXpub(xpub,target){
['Upub', '024289ef'],
['vpub', '045f1cf6'],
['Vpub', '02575483'],
['xprv', '0488ade4'],
['yprv', '049d7878'],
['zprv', '04b2430c']
]
);

Expand Down
11 changes: 6 additions & 5 deletions bip39/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ <h1>SegWit HD Wallet</h1>

<br>
<button id="entropyRef" onclick="return btnCreate();" class="btn btn-primary">Generate New Mnenomic</button>
<select id="wordLength"><option value="twty">24 Words</option><option value="twlv">12 Words</option></select>
<select id="wordLength" class="btn btn-info"><option value="twty">24 Words</option><option value="twlv">12 Words</option></select>
<br>
<!-- mouse entropy canvas -->
<canvas id="entropyCanvas" width="800" height="200" style="border: 1px solid black;"></canvas>
Expand All @@ -217,7 +217,7 @@ <h1>SegWit HD Wallet</h1>
<br>
<!-- footer -->
<a href="https://bitcoincore.org/en/segwit_adoption/"><span class="label-default"><span id="wit">SEG</span>WIT</span></a>
<a href="https://github.com/coinables/segwitaddress/bip39"><span class="label-primary">OPEN SOURCE</span></a>
<a href="https://github.com/coinables/segwitaddress/tree/master/bip39"><span class="label-primary">OPEN SOURCE</span></a>
<a href="https://github.com/coinables/buidljs"><span class="label-success">BUIDLJS</span></a>
<script>
function btnCreate(){
Expand Down Expand Up @@ -281,15 +281,16 @@ <h1>SegWit HD Wallet</h1>
var thisxpub = buidl.seedToXpub(makeseedhex.seedHex, 49, 0);
var thisypub = buidl.convertXpub(thisxpub.xpub,"ypub");
var thisxprv = buidl.seedToXprv(makeseedhex.seedHex, 49, 0);
var thisyprv = buidl.convertXpub(thisxprv.xprv,"yprv");

//show deriv and xpub
document.getElementById("derivpath").style.display = "block";
document.getElementById("derivpath").innerHTML = '<table width="100%"><tr><td>BIP: </td><td><input value="49" disabled readonly></td></tr><tr><td>Coin: </td><td><input value="0" disabled readonly></td></tr><tr><td>Account: </td><td><input value="0" disabled readonly></td></tr><tr><td>Change: </td><td><input value="0" disabled readonly></td></tr></table><br><br><table width="100%"><tr><td align="left"><div id="qrxpub"></div><br>XPUB: <input type="text" style="font-size: 10px" value="'+thisypub+'" width="99%" disabled readonly></td></tr><tr><td align="right"><div id="qrxprv"></div><br>XPRV: <input type="text" style="font-size: 10px" value="'+thisxprv.xprv+'" width="99%" disabled readonly></td></tr></table><p>Create a watch-only wallet with Electrum by scanning the XPUB.<li>File-> New/Restore</li><li>Choose Standard Wallet</li><li>Use a Master Key</li><li>Scan you XPUB QR with webcam</li><li>Wallet is now watch only (view/receive only, cannot spend)</li></p>';
document.getElementById("derivpath").innerHTML = '<table width="100%"><tr><td>BIP: </td><td><input value="49" disabled readonly></td></tr><tr><td>Coin: </td><td><input value="0" disabled readonly></td></tr><tr><td>Account: </td><td><input value="0" disabled readonly></td></tr><tr><td>Change: </td><td><input value="0" disabled readonly></td></tr></table><br><br><table width="100%"><tr><td align="left"><div id="qrxpub"></div><br>XPUB: <input type="text" style="font-size: 10px" value="'+thisypub+'" width="99%" disabled readonly></td></tr><tr><td align="right"><div id="qrxprv"></div><br>XPRV: <input type="text" style="font-size: 10px" value="'+thisyprv+'" width="99%" disabled readonly></td></tr></table><p>Create a watch-only wallet with Electrum by scanning the XPUB.<li>File-> New/Restore</li><li>Choose Standard Wallet</li><li>Use a Master Key</li><li>Scan you XPUB QR with webcam</li><li>Wallet is now watch only (view/receive only, cannot spend)</li></p>';

document.getElementById("qrxpub").innerHTML = "";
document.getElementById("qrxprv").innerHTML = "";
new QRCode(document.getElementById("qrxpub"),thisxpub.xpub);
new QRCode(document.getElementById("qrxprv"),thisxprv.xprv);
new QRCode(document.getElementById("qrxpub"),thisypub);
new QRCode(document.getElementById("qrxprv"),thisyprv);

document.getElementById("addrs").style.display = "block";

Expand Down

0 comments on commit 4e49288

Please sign in to comment.