diff --git a/browser/index.html b/browser/index.html index 5679d1c9..1b414db8 100644 --- a/browser/index.html +++ b/browser/index.html @@ -73,7 +73,7 @@

BCoin, the browser full node

-Welcome. Your machine is currently validating the segnet4 blockchain. +Welcome. Your machine is currently validating the blockchain. The blocks and wallet are stored on your local disk with indexed DB. You are connecting to the actual bitcoin P2P network via a websocket->tcp proxy. Enjoy. (See the bcoin repo for @@ -219,8 +219,12 @@ more bitcoin magic). var html = ''; var key = wallet.master.toJSON(); html += 'Wallet
'; - html += 'Current Address (p2wpkh): ' + wallet.getAddress() + '
'; - html += 'Current Address (p2wpkh behind p2sh): ' + wallet.getProgramAddress() + '
'; + if (bcoin.networkType === 'segnet4') { + html += 'Current Address (p2wpkh): ' + wallet.getAddress() + '
'; + html += 'Current Address (p2wpkh behind p2sh): ' + wallet.getProgramAddress() + '
'; + } else { + html += 'Current Address: ' + wallet.getAddress() + '
'; + } html += 'Extended Private Key: ' + key.xprivkey + '
'; html += 'Mnemonic: ' + key.phrase + '
'; wallet.getBalance(function(err, balance) { @@ -236,7 +240,7 @@ more bitcoin magic).
txs.forEach(function(tx) { var el = create('' + tx.rhash + ''); wdiv.appendChild(el); - el.onclick = function(ev) { + el.onmouseup = function(ev) { show(tx); ev.stopPropagation(); return false; @@ -247,15 +251,37 @@ more bitcoin magic). }); } + var query = (function() { + var query = {}; + var search = (window.location.search + '').substring(1); + var s = search.split('&'); + var i, parts; + + for (i = 0; i < s.length; i++) { + parts = s[i].split('='); + if (parts[0]) + query[parts[0]] = parts[1]; + } + + return query; + })(); + + var proxyServer = window.location.protocol + + '//' + window.location.hostname + + (window.location.port ? ':' + window.location.port : ''); + bcoin.set({ - network: 'segnet4', + network: query.network || 'segnet4', debug: true, - // db: 'memory', + db: query.db || null, logger: logger, - useWorkers: true + useWorkers: true, + proxyServer: proxyServer }); - node = new bcoin.fullnode(); + node = new bcoin.fullnode({ + prune: query.prune === 'true' || query.prune === '1' + }); node.on('error', function(err) { bcoin.error(err);