Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
makeabignews committed Dec 4, 2018
1 parent 284756a commit 7f01200
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 45 deletions.
1 change: 0 additions & 1 deletion config-files/explorer.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ exports.initial_witnesses = REPLACE_WITNESSES;
exports.initial_peers = [
'ws://127.0.0.1:6616'
];
console.log('finished explorer conf');
1 change: 0 additions & 1 deletion config-files/hub.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ exports.HEARTBEAT_TIMEOUT = 300*1000;
exports.storage = 'sqlite';
exports.initial_witnesses = REPLACE_WITNESSES;
exports.initial_peers = [];
console.log('finished hub conf');
8 changes: 1 addition & 7 deletions config-files/relay.conf.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
"use strict";

exports.port = 6655;
exports.bServeAsHub = false;
exports.bSaveJointJson = true;
exports.bLight = false;

exports.storage = 'sqlite';

exports.initial_witnesses = REPLACE_WITNESSES;

exports.initial_peers = [];

console.log('finished relay conf');
exports.initial_peers = [];
8 changes: 0 additions & 8 deletions config-files/witness-conf.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
/*jslint node: true */
"use strict";

exports.port = null;
//exports.myUrl = 'wss://mydomain.com/bb';
exports.bServeAsHub = false;
exports.bLight = false;

exports.storage = 'sqlite';
exports.admin_email='witness';
exports.from_email='witness';
Expand All @@ -15,11 +11,7 @@ exports.deviceName = 'Witness';
exports.permanent_pairing_secret = 'randomstring';
exports.control_addresses = ['DEVICE ALLOWED TO CHAT'];
exports.payout_address = 'WHERE THE MONEY CAN BE SENT TO';

exports.bSingleAddress = true;
exports.THRESHOLD_DISTANCE = 10;
exports.MIN_AVAILABLE_WITNESSINGS = 100;

exports.KEYS_FILENAME = 'keys.json';

console.log('finished witness conf');
14 changes: 2 additions & 12 deletions config-files/witness-headless-start.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,11 @@ var wallet_id;
var xPrivKey;

function replaceConsoleLog(){
// var log_filename = conf.LOG_FILENAME || (appDataDir + '/log.txt');
// var writeStream = fs.createWriteStream(log_filename);
// console.log('---------------');
// console.log('From this point, output will be redirected to '+log_filename);
// console.log("To release the terminal, type Ctrl-Z, then 'bg'");
// console.log = function(){
// writeStream.write(Date().toString()+': ');
// writeStream.write(util.format.apply(null, arguments) + '\n');
// };
// console.warn = console.log;
// console.info = console.log;

}

function readKeys(onDone){
console.log('-----------------------');

if (conf.control_addresses)
console.log("remote access allowed from devices: "+conf.control_addresses.join(', '));
if (conf.payout_address)
Expand Down
17 changes: 1 addition & 16 deletions genesis-scripts/create_genesis.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,13 @@ var contentb = fs.readFileSync('../../data/witnessAddress.json');
witnesses = JSON.parse(contentb);
allAddress = JSON.parse(contenta);

console.log(JSON.stringify(witnesses));

for (let address of allAddress) {// initial the payment arrOutputs
for(var i=0; i<witness_budget_count; ++i) {
arrOutputs.push({address: address, amount: witness_budget});
}
}

function createPayment(){
console.log('starting createPayment');
var composer = require('trustnote-common/composer.js');
var network = require('trustnote-common/network.js');
var callbacks = composer.getSavingCallbacks({
Expand All @@ -65,16 +62,11 @@ function createPayment(){
function rungen(){
fs.readFile(genesisConfigFile, 'utf8', function(err, data) {
if (err){
console.log("Read genesis input file \"bgenesis.json\" failed: " + err);
process.exit(0);
}
// set global data
genesisConfigData = JSON.parse(data);
console.log("Read genesis input data\n: %s", JSON.stringify(genesisConfigData,null,2) );
createGenesisUnit(witnesses, function(genesisHash) {
console.log("");
console.log("genesisHash:");
console.log(genesisHash);
fs.writeFileSync('../../genesisHash.txt','"'+genesisHash+'"');
process.exit()
});
Expand All @@ -91,22 +83,17 @@ function getConfEntryByAddress(address) {
return item;
}
}
console.log(" \n >> Error: witness address "
+ address +" not founded in the \"bgensis.json\" file!!!!\n");
process.exit(0);
//return null;
}

function getDerivedKey(mnemonic_phrase, passphrase, account, is_change, address_index) {
console.log("**************************************************************");
console.log(mnemonic_phrase);


var mnemonic = new Mnemonic(mnemonic_phrase);
var xPrivKey = mnemonic.toHDPrivateKey(passphrase);
//console.log(">> about to signature with private key: " + xPrivKey);
var path = "m/44'/0'/" + account + "'/"+is_change+"/"+address_index;
var derivedPrivateKey = xPrivKey.derive(path).privateKey;
console.log(">> derived key: " + derivedPrivateKey);
return derivedPrivateKey.bn.toBuffer({size:32}); // return as buffer
}

Expand All @@ -117,7 +104,6 @@ var signer = {
},
readDefinition: function(conn, address, handleDefinition){
var conf_entry = getConfEntryByAddress(address);
// console.log(" \n\n conf_entry is ---> \n" + JSON.stringify(conf_entry,null,2));
var definition = conf_entry["definition"];
handleDefinition(null, definition);
},
Expand Down Expand Up @@ -174,7 +160,6 @@ function createGenesisUnit(witnesses, onDone) {
}

eventBus.once('headless_wallet_ready', function() {
console.log("headless wallet ready !");
if (act == "gen"){
rungen();
}else{
Expand Down

0 comments on commit 7f01200

Please sign in to comment.