Compare commits

...

19 Commits

Author SHA1 Message Date
Simon 53a3a2845b Fix package.json 2018-09-18 09:41:35 -07:00
Simon 1803cb983e Add Sapling transaction support. 2018-09-17 22:45:57 -07:00
Ian Munoz 1ab4e2fd55
Merge pull request #1 from ianamunoz/master
change source in scaffold/lib/create.js
2018-06-18 12:12:10 -04:00
Ian Munoz d85bd7404f Merge branch 'master' of https://github.com/zcash-hackworks/bitcore-node-zcash 2018-06-18 10:32:13 -04:00
Ian Munoz f2e287d901 change url to zcash-hackworks in lib/scaffold/create.js 2018-06-18 10:22:22 -04:00
Simon 34a0a90e1d Update url to zcash-hackworks. 2018-05-09 14:26:14 -07:00
Simon 4f0edd4bd6 Update contributors. 2018-05-07 23:37:20 -07:00
Simon 0fe30a61f8 Add support for Overwinter transactions. 2018-05-07 23:35:57 -07:00
Ian Munoz 3405d2edeb update dependencies to my repo 2018-05-01 12:17:26 -06:00
Jack Grigg 9212ef3c9e Create nodes using GitHub links to bitcore-*-zcash packages 2016-08-30 17:15:45 +12:00
Jack Grigg f5b864f29e Remove hosted download 2016-08-30 15:42:10 +12:00
Jack Grigg 433a08d070 Add JoinSplit public values to getDetailedTransaction() 2016-08-29 21:01:16 +12:00
Jack Grigg 3ecbe21697 Zcash-ify console output 2016-08-28 14:53:22 +12:00
Jack Grigg 112c6d896d Zcash-ify daemon, config files etc. 2016-08-28 14:53:22 +12:00
Jack Grigg 10b44b6392 Use bitcore-lib-zcash 2016-08-28 14:53:21 +12:00
Jack Grigg 0a9d654ca7 Zcash-ify package 2016-08-28 14:52:41 +12:00
Braydon Fuller 639fdc941e Bump package version to 3.1.2 2016-07-28 10:59:12 -04:00
Chris Kleeschulte b5401b0269 Merge pull request #472 from braydonf/0.12.1-bitcore-2
Bump bitcoind tag to v0.12.1-bitcore-2
2016-07-28 10:53:01 -04:00
Braydon Fuller 75d41acdd6 Bump bitcoind tag to v0.12.1-bitcore-2 2016-07-26 15:48:15 -04:00
27 changed files with 157 additions and 111 deletions

View File

@ -5,7 +5,7 @@ var bitcoin = require('bitcoin');
var async = require('async');
var maxTime = 20;
console.log('Bitcoin Service native interface vs. Bitcoin JSON RPC interface');
console.log('Zcash Service native interface vs. Zcash JSON RPC interface');
console.log('----------------------------------------------------------------------');
// To run the benchmarks a fully synced Bitcore Core directory is needed. The RPC comands
@ -28,7 +28,7 @@ var fixtureData = {
var bitcoind = require('../').services.Bitcoin({
node: {
datadir: process.env.HOME + '/.bitcoin',
datadir: process.env.HOME + '/.zcash',
network: {
name: 'testnet'
}
@ -43,12 +43,12 @@ bitcoind.start(function(err) {
if (err) {
throw err;
}
console.log('Bitcoin Core started');
console.log('Zcash started');
});
bitcoind.on('ready', function() {
console.log('Bitcoin Core ready');
console.log('Zcash ready');
var client = new bitcoin.Client({
host: 'localhost',

View File

@ -49,7 +49,7 @@ var myNode = new bitcore.Node({
config: {
spawn: {
datadir: '/home/<username>/.bitcoin',
exec: '/home/<username>/bitcore-node/bin/bitcoind'
exec: '/home/<username>/bitcore-node/bin/zcashd'
}
}
},

View File

@ -48,7 +48,7 @@ To start reindexing add `reindex=1` during the **first startup only**.
"bitcoind": {
"spawn": {
"datadir": "/home/<username>/.bitcoin",
"exec": "/home/<username>/bitcore-node/bin/bitcoind"
"exec": "/home/<username>/bitcore-node/bin/zcashd"
}
}
}

View File

@ -24,4 +24,4 @@ module.exports.cli.daemon = require('./lib/cli/daemon');
module.exports.cli.bitcore = require('./lib/cli/bitcore');
module.exports.cli.bitcored = require('./lib/cli/bitcored');
module.exports.lib = require('bitcore-lib');
module.exports.lib = require('bitcore-lib-zcash');

View File

@ -1,6 +1,6 @@
'use strict';
var bitcore = require('bitcore-lib');
var bitcore = require('bitcore-lib-zcash');
var _ = bitcore.deps._;
var colors = require('colors/safe');

View File

@ -3,7 +3,7 @@
var util = require('util');
var EventEmitter = require('events').EventEmitter;
var async = require('async');
var bitcore = require('bitcore-lib');
var bitcore = require('bitcore-lib-zcash');
var Networks = bitcore.Networks;
var $ = bitcore.util.preconditions;
var _ = bitcore.deps._;

View File

@ -4,7 +4,7 @@ var async = require('async');
var fs = require('fs');
var path = require('path');
var spawn = require('child_process').spawn;
var bitcore = require('bitcore-lib');
var bitcore = require('bitcore-lib-zcash');
var utils = require('../utils');
var $ = bitcore.util.preconditions;
var _ = bitcore.deps._;

View File

@ -1,7 +1,7 @@
'use strict';
var spawn = require('child_process').spawn;
var bitcore = require('bitcore-lib');
var bitcore = require('bitcore-lib-zcash');
var async = require('async');
var $ = bitcore.util.preconditions;
var _ = bitcore.deps._;
@ -14,13 +14,13 @@ var defaultBaseConfig = require('./default-base-config');
var version = '^' + packageFile.version;
var BASE_PACKAGE = {
description: 'A full Bitcoin node build with Bitcore',
description: 'A full Zcash node build with Bitcore',
repository: 'https://github.com/user/project',
license: 'MIT',
readme: 'README.md',
dependencies: {
'bitcore-lib': '^' + bitcore.version,
'bitcore-node': version
'bitcore-lib-zcash': 'zcash-hackworks/bitcore-lib-zcash',
'bitcore-node-zcash': 'zcash-hackworks/bitcore-node-zcash'
}
};

View File

@ -22,8 +22,8 @@ function getDefaultBaseConfig(options) {
servicesConfig: {
bitcoind: {
spawn: {
datadir: options.datadir || path.resolve(process.env.HOME, '.bitcoin'),
exec: path.resolve(__dirname, '../../bin/bitcoind')
datadir: options.datadir || path.resolve(process.env.HOME, '.zcash'),
exec: path.resolve(__dirname, '../../bin/zcashd')
}
}
}

View File

@ -38,7 +38,7 @@ function getDefaultConfig(options) {
bitcoind: {
spawn: {
datadir: path.resolve(defaultPath, './data'),
exec: path.resolve(__dirname, '../../bin/bitcoind')
exec: path.resolve(__dirname, '../../bin/zcashd')
}
}
}

View File

@ -1,6 +1,6 @@
'use strict';
var bitcore = require('bitcore-lib');
var bitcore = require('bitcore-lib-zcash');
var $ = bitcore.util.preconditions;
var _ = bitcore.deps._;
var path = require('path');

View File

@ -5,7 +5,7 @@ var fs = require('fs');
var npm = require('npm');
var path = require('path');
var spawn = require('child_process').spawn;
var bitcore = require('bitcore-lib');
var bitcore = require('bitcore-lib-zcash');
var $ = bitcore.util.preconditions;
var _ = bitcore.deps._;
var utils = require('../utils');

View File

@ -3,7 +3,7 @@
var path = require('path');
var BitcoreNode = require('../node');
var index = require('../');
var bitcore = require('bitcore-lib');
var bitcore = require('bitcore-lib-zcash');
var _ = bitcore.deps._;
var log = index.log;
var shuttingDown = false;
@ -22,8 +22,8 @@ function checkConfigVersion2(fullConfig) {
if (!datadirUndefined || addressDefined || dbDefined) {
console.warn('\nConfiguration file is not compatible with this version. \n' +
'A reindex for bitcoind is necessary for this upgrade with the "reindex=1" bitcoin.conf option. \n' +
'There are changes necessary in both bitcoin.conf and bitcore-node.json. \n\n' +
'A reindex for zcashd is necessary for this upgrade with the "reindex=1" zcash.conf option. \n' +
'There are changes necessary in both zcash.conf and bitcore-node.json. \n\n' +
'To upgrade please see the details below and documentation at: \n' +
'https://github.com/bitpay/bitcore-node/blob/bitcoind/docs/upgrade.md \n');
@ -34,7 +34,7 @@ function checkConfigVersion2(fullConfig) {
bitcoind: {
spawn: {
datadir: fullConfig.datadir,
exec: path.resolve(__dirname, '../../bin/bitcoind')
exec: path.resolve(__dirname, '../../bin/zcashd')
}
}
}

View File

@ -5,7 +5,7 @@ var path = require('path');
var spawn = require('child_process').spawn;
var util = require('util');
var mkdirp = require('mkdirp');
var bitcore = require('bitcore-lib');
var bitcore = require('bitcore-lib-zcash');
var zmq = require('zmq');
var async = require('async');
var LRU = require('lru-cache');
@ -331,16 +331,16 @@ Bitcoin.prototype._expandRelativeDatadir = function() {
Bitcoin.prototype._loadSpawnConfiguration = function(node) {
/* jshint maxstatements: 25 */
$.checkArgument(this.options.spawn, 'Please specify "spawn" in bitcoind config options');
$.checkArgument(this.options.spawn.datadir, 'Please specify "spawn.datadir" in bitcoind config options');
$.checkArgument(this.options.spawn.exec, 'Please specify "spawn.exec" in bitcoind config options');
$.checkArgument(this.options.spawn, 'Please specify "spawn" in zcashd config options');
$.checkArgument(this.options.spawn.datadir, 'Please specify "spawn.datadir" in zcashd config options');
$.checkArgument(this.options.spawn.exec, 'Please specify "spawn.exec" in zcashd config options');
this._expandRelativeDatadir();
var spawnOptions = this.options.spawn;
var configPath = path.resolve(spawnOptions.datadir, './bitcoin.conf');
var configPath = path.resolve(spawnOptions.datadir, './zcash.conf');
log.info('Using bitcoin config file:', configPath);
log.info('Using zcash config file:', configPath);
this.spawn = {};
this.spawn.datadir = this.options.spawn.datadir;
@ -395,29 +395,29 @@ Bitcoin.prototype._checkConfigIndexes = function(spawnConfig, node) {
$.checkState(
spawnConfig.server && spawnConfig.server === 1,
'"server" option is required to communicate to bitcoind from bitcore. ' +
'"server" option is required to communicate to zcashd from bitcore. ' +
'Please add "server=1" to your configuration and restart'
);
$.checkState(
spawnConfig.zmqpubrawtx,
'"zmqpubrawtx" option is required to get event updates from bitcoind. ' +
'"zmqpubrawtx" option is required to get event updates from zcashd. ' +
'Please add "zmqpubrawtx=tcp://127.0.0.1:<port>" to your configuration and restart'
);
$.checkState(
spawnConfig.zmqpubhashblock,
'"zmqpubhashblock" option is required to get event updates from bitcoind. ' +
'"zmqpubhashblock" option is required to get event updates from zcashd. ' +
'Please add "zmqpubhashblock=tcp://127.0.0.1:<port>" to your configuration and restart'
);
$.checkState(
(spawnConfig.zmqpubhashblock === spawnConfig.zmqpubrawtx),
'"zmqpubrawtx" and "zmqpubhashblock" are expected to the same host and port in bitcoin.conf'
'"zmqpubrawtx" and "zmqpubhashblock" are expected to the same host and port in zcash.conf'
);
if (spawnConfig.reindex && spawnConfig.reindex === 1) {
log.warn('Reindex option is currently enabled. This means that bitcoind is undergoing a reindex. ' +
log.warn('Reindex option is currently enabled. This means that zcashd is undergoing a reindex. ' +
'The reindex flag will start the index from beginning every time the node is started, so it ' +
'should be removed after the reindex has been initiated. Once the reindex is complete, the rest ' +
'of bitcore-node services will start.');
@ -477,7 +477,7 @@ Bitcoin.prototype._initChain = function(callback) {
}
self.genesisBuffer = blockBuffer;
self.emit('ready');
log.info('Bitcoin Daemon Ready');
log.info('Zcash Daemon Ready');
callback();
});
});
@ -488,10 +488,10 @@ Bitcoin.prototype._initChain = function(callback) {
Bitcoin.prototype._getDefaultConf = function() {
var networkOptions = {
rpcport: 8332
rpcport: 8232
};
if (this.node.network === bitcore.Networks.testnet) {
networkOptions.rpcport = 18332;
networkOptions.rpcport = 18232;
}
return networkOptions;
};
@ -499,9 +499,9 @@ Bitcoin.prototype._getDefaultConf = function() {
Bitcoin.prototype._getNetworkConfigPath = function() {
var networkPath;
if (this.node.network === bitcore.Networks.testnet) {
networkPath = 'testnet3/bitcoin.conf';
networkPath = 'testnet3/zcash.conf';
if (this.node.network.regtestEnabled) {
networkPath = 'regtest/bitcoin.conf';
networkPath = 'regtest/zcash.conf';
}
}
return networkPath;
@ -581,7 +581,7 @@ Bitcoin.prototype._updateTip = function(node, message) {
if (Math.round(percentage) >= 100) {
self.emit('synced', self.height);
}
log.info('Bitcoin Height:', self.height, 'Percentage:', percentage.toFixed(2));
log.info('Zcash Height:', self.height, 'Percentage:', percentage.toFixed(2));
}
});
}
@ -759,7 +759,7 @@ Bitcoin.prototype._checkReindex = function(node, callback) {
}
var percentSynced = response.result.verificationprogress * 100;
log.info('Bitcoin Core Daemon Reindex Percentage: ' + percentSynced.toFixed(2));
log.info('Zcash Daemon Reindex Percentage: ' + percentSynced.toFixed(2));
if (Math.round(percentSynced) >= 100) {
node._reindex = false;
@ -796,7 +796,7 @@ Bitcoin.prototype._loadTipFromNode = function(node, callback) {
Bitcoin.prototype._stopSpawnedBitcoin = function(callback) {
var self = this;
var spawnOptions = this.options.spawn;
var pidPath = spawnOptions.datadir + '/bitcoind.pid';
var pidPath = spawnOptions.datadir + '/zcashd.pid';
function stopProcess() {
fs.readFile(pidPath, 'utf8', function(err, pid) {
@ -812,11 +812,11 @@ Bitcoin.prototype._stopSpawnedBitcoin = function(callback) {
return callback(null);
}
try {
log.warn('Stopping existing spawned bitcoin process with pid: ' + pid);
log.warn('Stopping existing spawned zcash process with pid: ' + pid);
self._process.kill(pid, 'SIGINT');
} catch(err) {
if (err && err.code === 'ESRCH') {
log.warn('Unclean bitcoin process shutdown, process not found with pid: ' + pid);
log.warn('Unclean zcash process shutdown, process not found with pid: ' + pid);
return callback(null);
} else if(err) {
return callback(err);
@ -858,7 +858,7 @@ Bitcoin.prototype._spawnChildProcess = function(callback) {
return callback(err);
}
log.info('Starting bitcoin process');
log.info('Starting zcash process');
self.spawn.process = spawn(self.spawn.exec, options, {stdio: 'inherit'});
self.spawn.process.on('error', function(err) {
@ -867,14 +867,14 @@ Bitcoin.prototype._spawnChildProcess = function(callback) {
self.spawn.process.once('exit', function(code) {
if (!self.node.stopping) {
log.warn('Bitcoin process unexpectedly exited with code:', code);
log.warn('Restarting bitcoin child process in ' + self.spawnRestartTime + 'ms');
log.warn('Zcash process unexpectedly exited with code:', code);
log.warn('Restarting zcash child process in ' + self.spawnRestartTime + 'ms');
setTimeout(function() {
self._spawnChildProcess(function(err) {
if (err) {
return self.emit('error', err);
}
log.warn('Bitcoin process restarted');
log.warn('Zcash process restarted');
});
}, self.spawnRestartTime);
}
@ -903,7 +903,7 @@ Bitcoin.prototype._spawnChildProcess = function(callback) {
return callback(err);
}
if (exitShutdown) {
return callback(new Error('Stopping while trying to spawn bitcoind.'));
return callback(new Error('Stopping while trying to spawn zcashd.'));
}
self._initZmqSubSocket(node, self.spawn.config.zmqpubrawtx);
@ -949,7 +949,7 @@ Bitcoin.prototype._connectProcess = function(config, callback) {
return callback(err);
}
if (exitShutdown) {
return callback(new Error('Stopping while trying to connect to bitcoind.'));
return callback(new Error('Stopping while trying to connect to zcashd.'));
}
self._initZmqSubSocket(node, config.zmqpubrawtx);
@ -1000,7 +1000,7 @@ Bitcoin.prototype.start = function(callback) {
return callback(err);
}
if (self.nodes.length === 0) {
return callback(new Error('Bitcoin configuration options "spawn" or "connect" are expected'));
return callback(new Error('Zcash configuration options "spawn" or "connect" are expected'));
}
self._initChain(callback);
});
@ -1947,6 +1947,20 @@ Bitcoin.prototype.getDetailedTransaction = function(txid, callback) {
}
}
function addJoinSplitsToTx(tx, result) {
tx.joinSplits = [];
var netJoinSplitZatoshis = 0;
for (var jsIndex = 0; jsIndex < result.vjoinsplit.length; jsIndex++) {
var jsdesc = result.vjoinsplit[jsIndex];
netJoinSplitZatoshis += jsdesc.vpub_newZat - jsdesc.vpub_oldZat;
tx.joinSplits.push({
oldZatoshis: jsdesc.vpub_oldZat,
newZatoshis: jsdesc.vpub_newZat,
});
}
return netJoinSplitZatoshis;
}
if (tx) {
return setImmediate(function() {
callback(null, tx);
@ -1966,6 +1980,7 @@ Bitcoin.prototype.getDetailedTransaction = function(txid, callback) {
version: result.version,
hash: txid,
locktime: result.locktime,
fOverwintered: result.overwintered,
};
if (result.vin[0] && result.vin[0].coinbase) {
@ -1975,14 +1990,36 @@ Bitcoin.prototype.getDetailedTransaction = function(txid, callback) {
addInputsToTx(tx, result);
addOutputsToTx(tx, result);
var netJoinSplitZatoshis = 0;
if (tx.version >= 2) {
netJoinSplitZatoshis = addJoinSplitsToTx(tx, result);
}
if (!tx.coinbase) {
tx.feeSatoshis = tx.inputSatoshis - tx.outputSatoshis;
tx.feeSatoshis = tx.inputSatoshis - tx.outputSatoshis + netJoinSplitZatoshis;
} else {
tx.feeSatoshis = 0;
}
self.transactionDetailedCache.set(txid, tx);
if (tx.fOverwintered) {
tx.nVersionGroupId = parseInt(result.versiongroupid, 16);
tx.nExpiryHeight = result.expiryheight;
}
// Sapling START
if (tx.fOverwintered && tx.version >= 4) {
tx.valueBalance = result.valueBalance;
tx.spendDescs = result.vShieldedSpend;
tx.outputDescs = result.vShieldedOutput;
if (result.bindingSig) {
tx.bindingSig = result.bindingSig;
}
// Update tx.feeSatoshis with custom explorer JSON field 'valueBalanceZat'
tx.feeSatoshis = tx.feeSatoshis + result.valueBalanceZat;
}
// Sapling END
self.transactionDetailedCache.set(txid, tx);
done(null, tx);
});
}, callback);
@ -2080,7 +2117,7 @@ Bitcoin.prototype.stop = function(callback) {
if (!exited) {
exited = true;
if (code !== 0) {
var error = new Error('bitcoind spawned process exited with status code: ' + code);
var error = new Error('zcashd spawned process exited with status code: ' + code);
error.code = code;
return callback(error);
} else {
@ -2092,7 +2129,7 @@ Bitcoin.prototype.stop = function(callback) {
setTimeout(function() {
if (!exited) {
exited = true;
return callback(new Error('bitcoind process did not exit'));
return callback(new Error('zcashd process did not exit'));
}
}, this.shutdownTimeout).unref();
} else {

View File

@ -9,7 +9,7 @@ var socketio = require('socket.io');
var inherits = require('util').inherits;
var BaseService = require('../service');
var bitcore = require('bitcore-lib');
var bitcore = require('bitcore-lib-zcash');
var _ = bitcore.deps._;
var index = require('../');
var log = index.log;

View File

@ -1,13 +1,13 @@
{
"name": "bitcore-node",
"description": "Full node with extended capabilities using Bitcore and Bitcoin Core",
"name": "bitcore-node-zcash",
"description": "Full node with extended capabilities using Bitcore and Zcash",
"author": "BitPay <dev@bitpay.com>",
"version": "3.1.1",
"version": "3.1.2",
"main": "./index.js",
"repository": "git://github.com/bitpay/bitcore-node.git",
"homepage": "https://github.com/bitpay/bitcore-node",
"repository": "git://github.com/zcash-hackworks/bitcore-node-zcash.git",
"homepage": "https://github.com/zcash-hackworks/bitcore-node-zcash",
"bugs": {
"url": "https://github.com/bitpay/bitcore-node/issues"
"url": "https://github.com/zcash-hackworks/bitcore-node-zcash/issues"
},
"contributors": [
{
@ -24,15 +24,24 @@
{
"name": "Patrick Nagurny",
"email": "patrick@bitpay.com"
},
{
"name": "Jack Grigg",
"email": "jack@z.cash"
},
{
"name": "Simon Liu",
"email": "simon@z.cash"
},
{
"name": "Ian Munoz",
"email": "ian.org@gmail.com"
}
],
"bin": {
"bitcore-node": "./bin/bitcore-node",
"bitcoind": "./bin/bitcoind"
"bitcore-node": "./bin/bitcore-node"
},
"scripts": {
"preinstall": "./scripts/download",
"verify": "./scripts/download --skip-bitcoin-download --verify-bitcoin-download",
"test": "mocha -R spec --recursive",
"regtest": "./scripts/regtest",
"jshint": "jshint --reporter=node_modules/jshint-stylish ./lib",
@ -40,13 +49,13 @@
"coveralls": "./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- --recursive -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"
},
"tags": [
"bitcoin",
"bitcoind"
"zcash",
"zcashd"
],
"dependencies": {
"async": "^1.3.0",
"bitcoind-rpc": "^0.6.0",
"bitcore-lib": "^0.13.13",
"bitcore-lib-zcash": "zcash-hackworks/bitcore-lib-zcash",
"body-parser": "^1.13.3",
"colors": "^1.1.2",
"commander": "^2.8.1",

View File

@ -7,7 +7,7 @@ var index = require('..');
var log = index.log;
var chai = require('chai');
var bitcore = require('bitcore-lib');
var bitcore = require('bitcore-lib-zcash');
var BN = bitcore.crypto.BN;
var async = require('async');
var rimraf = require('rimraf');
@ -26,7 +26,7 @@ var coinbasePrivateKey;
var privateKey = bitcore.PrivateKey();
var destKey = bitcore.PrivateKey();
describe('Bitcoind Functionality', function() {
describe('Zcashd Functionality', function() {
before(function(done) {
this.timeout(60000);
@ -46,7 +46,7 @@ describe('Bitcoind Functionality', function() {
bitcoind = require('../').services.Bitcoin({
spawn: {
datadir: datadir,
exec: path.resolve(__dirname, '../bin/bitcoind')
exec: path.resolve(__dirname, '../bin/zcashd')
},
node: {
network: regtestNetwork,
@ -60,10 +60,10 @@ describe('Bitcoind Functionality', function() {
log.error('error="%s"', err.message);
});
log.info('Waiting for Bitcoin Core to initialize...');
log.info('Waiting for Zcash to initialize...');
bitcoind.start(function() {
log.info('Bitcoind started');
log.info('Zcashd started');
client = new BitcoinRPC({
protocol: 'http',

View File

@ -6,7 +6,7 @@ var spawn = require('child_process').spawn;
var BitcoinRPC = require('bitcoind-rpc');
var rimraf = require('rimraf');
var bitcore = require('bitcore-lib');
var bitcore = require('bitcore-lib-zcash');
var chai = require('chai');
var should = chai.should();
@ -19,11 +19,11 @@ var BitcoinService = index.services.Bitcoin;
describe('Bitcoin Cluster', function() {
var node;
var daemons = [];
var execPath = path.resolve(__dirname, '../bin/bitcoind');
var execPath = path.resolve(__dirname, '../bin/zcashd');
var nodesConf = [
{
datadir: path.resolve(__dirname, './data/node1'),
conf: path.resolve(__dirname, './data/node1/bitcoin.conf'),
conf: path.resolve(__dirname, './data/node1/zcash.conf'),
rpcuser: 'bitcoin',
rpcpassword: 'local321',
rpcport: 30521,
@ -32,7 +32,7 @@ describe('Bitcoin Cluster', function() {
},
{
datadir: path.resolve(__dirname, './data/node2'),
conf: path.resolve(__dirname, './data/node2/bitcoin.conf'),
conf: path.resolve(__dirname, './data/node2/zcash.conf'),
rpcuser: 'bitcoin',
rpcpassword: 'local321',
rpcport: 30522,
@ -41,7 +41,7 @@ describe('Bitcoin Cluster', function() {
},
{
datadir: path.resolve(__dirname, './data/node3'),
conf: path.resolve(__dirname, './data/node3/bitcoin.conf'),
conf: path.resolve(__dirname, './data/node3/zcash.conf'),
rpcuser: 'bitcoin',
rpcpassword: 'local321',
rpcport: 30523,

View File

@ -9,7 +9,7 @@ var log = index.log;
log.debug = function() {};
var chai = require('chai');
var bitcore = require('bitcore-lib');
var bitcore = require('bitcore-lib-zcash');
var rimraf = require('rimraf');
var node;
@ -53,7 +53,7 @@ describe('Node Functionality', function() {
config: {
spawn: {
datadir: datadir,
exec: path.resolve(__dirname, '../bin/bitcoind')
exec: path.resolve(__dirname, '../bin/zcashd')
}
}
}

View File

@ -10,7 +10,7 @@ var p2p = require('bitcore-p2p');
var Peer = p2p.Peer;
var Messages = p2p.Messages;
var chai = require('chai');
var bitcore = require('bitcore-lib');
var bitcore = require('bitcore-lib-zcash');
var Transaction = bitcore.Transaction;
var BN = bitcore.crypto.BN;
var async = require('async');
@ -52,7 +52,7 @@ describe('P2P Functionality', function() {
bitcoind = require('../').services.Bitcoin({
spawn: {
datadir: datadir,
exec: path.resolve(__dirname, '../bin/bitcoind')
exec: path.resolve(__dirname, '../bin/zcashd')
},
node: {
network: bitcore.Networks.testnet
@ -63,13 +63,13 @@ describe('P2P Functionality', function() {
log.error('error="%s"', err.message);
});
log.info('Waiting for Bitcoin Core to initialize...');
log.info('Waiting for Zcash to initialize...');
bitcoind.start(function(err) {
if (err) {
throw err;
}
log.info('Bitcoind started');
log.info('Zcashd started');
client = new BitcoinRPC({
protocol: 'http',

View File

@ -7,7 +7,7 @@ platform=`uname -a | awk '{print tolower($1)}'`
arch=`uname -m`
version="0.12.1"
url="https://github.com/bitpay/bitcoin/releases/download"
tag="v0.12.1-bitcore"
tag="v0.12.1-bitcore-2"
if [ "${platform}" == "linux" ]; then
if [ "${arch}" == "x86_64" ]; then

View File

@ -2,7 +2,7 @@
var should = require('chai').should();
var sinon = require('sinon');
var bitcore = require('bitcore-lib');
var bitcore = require('bitcore-lib-zcash');
var Networks = bitcore.Networks;
var proxyquire = require('proxyquire');
var util = require('util');

View File

@ -94,7 +94,7 @@ describe('#add', function() {
var callCount = 0;
var oldPackage = {
dependencies: {
'bitcore-lib': '^v0.13.7',
'bitcore-lib-zcash': '^v0.13.7',
'bitcore-node': '^v0.2.0'
}
};

View File

@ -33,7 +33,7 @@ describe('#create', function() {
if (err) {
throw err;
}
mkdirp(testDir + '/.bitcoin', function(err) {
mkdirp(testDir + '/.zcash', function(err) {
if (err) {
throw err;
}
@ -104,7 +104,7 @@ describe('#create', function() {
dirname: 'mynode3',
name: 'My Node 3',
isGlobal: true,
datadir: '../.bitcoin'
datadir: '../.zcash'
}, function(err) {
if (err) {
throw err;
@ -139,7 +139,7 @@ describe('#create', function() {
dirname: 'mynode4',
name: 'My Node 4',
isGlobal: false,
datadir: '../.bitcoin'
datadir: '../.zcash'
}, function(err) {
should.exist(err);
err.message.should.equal('There was an error installing dependencies.');

View File

@ -14,8 +14,8 @@ describe('#defaultBaseConfig', function() {
info.config.port.should.equal(3001);
info.config.services.should.deep.equal(['bitcoind', 'web']);
var bitcoind = info.config.servicesConfig.bitcoind;
bitcoind.spawn.datadir.should.equal(home + '/.bitcoin');
bitcoind.spawn.exec.should.equal(path.resolve(__dirname, '../../bin/bitcoind'));
bitcoind.spawn.datadir.should.equal(home + '/.zcash');
bitcoind.spawn.exec.should.equal(path.resolve(__dirname, '../../bin/zcashd'));
});
it('be able to specify a network', function() {
var info = defaultBaseConfig({network: 'testnet'});

View File

@ -6,7 +6,7 @@ var sinon = require('sinon');
var proxyquire = require('proxyquire');
describe('#defaultConfig', function() {
var expectedExecPath = path.resolve(__dirname, '../../bin/bitcoind');
var expectedExecPath = path.resolve(__dirname, '../../bin/zcashd');
it('will return expected configuration', function() {
var config = JSON.stringify({

View File

@ -6,7 +6,7 @@ var path = require('path');
var EventEmitter = require('events').EventEmitter;
var should = require('chai').should();
var crypto = require('crypto');
var bitcore = require('bitcore-lib');
var bitcore = require('bitcore-lib-zcash');
var _ = bitcore.deps._;
var sinon = require('sinon');
var proxyquire = require('proxyquire');
@ -18,13 +18,13 @@ var log = index.log;
var errors = index.errors;
var Transaction = bitcore.Transaction;
var readFileSync = sinon.stub().returns(fs.readFileSync(path.resolve(__dirname, '../data/bitcoin.conf')));
var readFileSync = sinon.stub().returns(fs.readFileSync(path.resolve(__dirname, '../data/zcash.conf')));
var BitcoinService = proxyquire('../../lib/services/bitcoind', {
fs: {
readFileSync: readFileSync
}
});
var defaultBitcoinConf = fs.readFileSync(path.resolve(__dirname, '../data/default.bitcoin.conf'), 'utf8');
var defaultBitcoinConf = fs.readFileSync(path.resolve(__dirname, '../data/default.zcash.conf'), 'utf8');
describe('Bitcoin Service', function() {
var txhex = '01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0704ffff001d0104ffffffff0100f2052a0100000043410496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858eeac00000000';
@ -357,7 +357,7 @@ describe('Bitcoin Service', function() {
afterEach(function() {
sandbox.restore();
});
it('will parse a bitcoin.conf file', function() {
it('will parse a zcash.conf file', function() {
var TestBitcoin = proxyquire('../../lib/services/bitcoind', {
fs: {
readFileSync: readFileSync,
@ -369,7 +369,7 @@ describe('Bitcoin Service', function() {
}
});
var bitcoind = new TestBitcoin(baseConfig);
bitcoind.options.spawn.datadir = '/tmp/.bitcoin';
bitcoind.options.spawn.datadir = '/tmp/.zcash';
var node = {};
bitcoind._loadSpawnConfiguration(node);
should.exist(bitcoind.spawn.config);
@ -423,7 +423,7 @@ describe('Bitcoin Service', function() {
it('should throw an exception if txindex isn\'t enabled in the configuration', function() {
var TestBitcoin = proxyquire('../../lib/services/bitcoind', {
fs: {
readFileSync: sinon.stub().returns(fs.readFileSync(__dirname + '/../data/badbitcoin.conf')),
readFileSync: sinon.stub().returns(fs.readFileSync(__dirname + '/../data/badzcash.conf')),
existsSync: sinon.stub().returns(true),
},
mkdirp: {
@ -466,7 +466,7 @@ describe('Bitcoin Service', function() {
}
};
var bitcoind = new TestBitcoin(config);
bitcoind.options.spawn.datadir = '/tmp/.bitcoin';
bitcoind.options.spawn.datadir = '/tmp/.zcash';
var node = {};
bitcoind._loadSpawnConfiguration(node);
});
@ -480,7 +480,7 @@ describe('Bitcoin Service', function() {
afterEach(function() {
sandbox.restore();
});
it('should warn the user if reindex is set to 1 in the bitcoin.conf file', function() {
it('should warn the user if reindex is set to 1 in the zcash.conf file', function() {
var bitcoind = new BitcoinService(baseConfig);
var config = {
txindex: 1,
@ -829,7 +829,7 @@ describe('Bitcoin Service', function() {
}
};
var bitcoind = new BitcoinService(config);
bitcoind._getNetworkConfigPath().should.equal('testnet3/bitcoin.conf');
bitcoind._getNetworkConfigPath().should.equal('testnet3/zcash.conf');
});
it('will get default rpc port for regtest', function() {
bitcore.Networks.enableRegtest();
@ -843,7 +843,7 @@ describe('Bitcoin Service', function() {
}
};
var bitcoind = new BitcoinService(config);
bitcoind._getNetworkConfigPath().should.equal('regtest/bitcoin.conf');
bitcoind._getNetworkConfigPath().should.equal('regtest/zcash.conf');
});
});
@ -1749,7 +1749,7 @@ describe('Bitcoin Service', function() {
bitcoind._loadSpawnConfiguration = sinon.stub();
bitcoind.spawn = {};
bitcoind.spawn.exec = 'testexec';
bitcoind.spawn.configPath = 'testdir/bitcoin.conf';
bitcoind.spawn.configPath = 'testdir/zcash.conf';
bitcoind.spawn.datadir = 'testdir';
bitcoind.spawn.config = {};
bitcoind.spawn.config.rpcport = 20001;
@ -1766,7 +1766,7 @@ describe('Bitcoin Service', function() {
spawn.callCount.should.equal(1);
spawn.args[0][0].should.equal('testexec');
spawn.args[0][1].should.deep.equal([
'--conf=testdir/bitcoin.conf',
'--conf=testdir/zcash.conf',
'--datadir=testdir',
'--testnet'
]);
@ -1800,7 +1800,7 @@ describe('Bitcoin Service', function() {
bitcoind.spawn = {};
bitcoind.spawn.exec = 'bitcoind';
bitcoind.spawn.datadir = '/tmp/bitcoin';
bitcoind.spawn.configPath = '/tmp/bitcoin/bitcoin.conf';
bitcoind.spawn.configPath = '/tmp/bitcoin/zcash.conf';
bitcoind.spawn.config = {};
bitcoind.spawnRestartTime = 1;
bitcoind._loadTipFromNode = sinon.stub().callsArg(1);
@ -1838,7 +1838,7 @@ describe('Bitcoin Service', function() {
bitcoind.spawn = {};
bitcoind.spawn.exec = 'bitcoind';
bitcoind.spawn.datadir = '/tmp/bitcoin';
bitcoind.spawn.configPath = '/tmp/bitcoin/bitcoin.conf';
bitcoind.spawn.configPath = '/tmp/bitcoin/zcash.conf';
bitcoind.spawn.config = {};
bitcoind.spawnRestartTime = 1;
bitcoind._loadTipFromNode = sinon.stub().callsArg(1);
@ -1885,7 +1885,7 @@ describe('Bitcoin Service', function() {
bitcoind.spawn = {};
bitcoind.spawn.exec = 'bitcoind';
bitcoind.spawn.datadir = '/tmp/bitcoin';
bitcoind.spawn.configPath = '/tmp/bitcoin/bitcoin.conf';
bitcoind.spawn.configPath = '/tmp/bitcoin/zcash.conf';
bitcoind.spawn.config = {};
bitcoind.spawnRestartTime = 1;
bitcoind._loadTipFromNode = sinon.stub().callsArg(1);
@ -1924,7 +1924,7 @@ describe('Bitcoin Service', function() {
bitcoind._loadSpawnConfiguration = sinon.stub();
bitcoind.spawn = {};
bitcoind.spawn.exec = 'testexec';
bitcoind.spawn.configPath = 'testdir/bitcoin.conf';
bitcoind.spawn.configPath = 'testdir/zcash.conf';
bitcoind.spawn.datadir = 'testdir';
bitcoind.spawn.config = {};
bitcoind.spawn.config.rpcport = 20001;
@ -1954,7 +1954,7 @@ describe('Bitcoin Service', function() {
bitcoind._loadSpawnConfiguration = sinon.stub();
bitcoind.spawn = {};
bitcoind.spawn.exec = 'testexec';
bitcoind.spawn.configPath = 'testdir/bitcoin.conf';
bitcoind.spawn.configPath = 'testdir/zcash.conf';
bitcoind.spawn.datadir = 'testdir';
bitcoind.spawn.config = {};
bitcoind.spawn.config.rpcport = 20001;