Socket
Socket
Sign inDemoInstall

bitcore

Package Overview
Dependencies
Maintainers
2
Versions
132
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bitcore - npm Package Compare versions

Comparing version 0.1.16 to 0.1.17

bower.json

17

bitcore.js

@@ -13,4 +13,12 @@ /*

requireWhenAccessed('bignum', 'bignum');
requireWhenAccessed('base58', 'base58-native');
requireWhenAccessed('Bignum', './lib/Bignum');
Object.defineProperty(module.exports, 'bignum', {get: function() {
console.log('bignum (with a lower-case "b") is deprecated. Use bitcore.Bignum (capital "B") instead.');
return require('./lib/Bignum');
}});
requireWhenAccessed('Base58', './lib/Base58');
Object.defineProperty(module.exports, 'base58', {get: function() {
console.log('base58 (with a lower-case "b") is deprecated. Use bitcore.Base58 (capital "B") instead.');
return require('./lib/Base58');
}});
requireWhenAccessed('bufferput', 'bufferput');

@@ -58,6 +66,1 @@ requireWhenAccessed('buffertools', 'buffertools');

if (typeof process.versions === 'undefined') {
// Browser specific
module.exports.bignum.config({EXPONENTIAL_AT: 9999999, DECIMAL_PLACES: 0, ROUNDING_MODE: 1});
}

@@ -27,2 +27,4 @@ 'use strict';

'lib/Address',
'lib/Base58',
'lib/Bignum',
'lib/BIP32',

@@ -98,5 +100,2 @@ 'lib/Block',

b.require(opts.dir + 'browserify-bignum/bignumber.js', {
expose: 'bignum'
});
b.require(opts.dir + 'browserify-buffertools/buffertools.js', {

@@ -108,5 +107,2 @@ expose: 'buffertools'

});
b.require(opts.dir + 'base58-native', {
expose: 'base58-native'
});
b.require(opts.dir + 'buffers', {

@@ -113,0 +109,0 @@ expose: 'buffers'

@@ -20,3 +20,3 @@ 'use strict';

command: grunt.option('target') === 'dev' ?
'node ./browser/build.js -a -d ' : 'node ./browser/build.js -a'
'node ./browser/build.js -a -d; docco lib/* ' : 'node ./browser/build.js -a'
}

@@ -30,3 +30,3 @@ },

scripts: {
files: ['**/*.js', '**/*.html', '!**/node_modules/**', '!browser/bundle.js', '!browser/testdata.js', '!browser/vendor-bundle.js'],
files: ['**/*.js', '**/*.html', '!**/node_modules/**', '!browser/bundle.js', '!browser/testdata.js', '!browser/vendor-bundle.js', '!docs/**'],
tasks: ['shell'],

@@ -33,0 +33,0 @@ },

@@ -15,3 +15,3 @@ 'use strict';

//create a pubKeyHash address
// create a pubKeyHash address
Address.fromPubKey = function(pubKey, network) {

@@ -21,3 +21,3 @@ if (!network)

if (pubKey.length != 33 && pubKey.length != 65)
if (pubKey.length !== 33 && pubKey.length !== 65)
throw new Error('Invalid public key');

@@ -31,2 +31,7 @@

// create an address from a Key object
Address.fromKey = function(key, network) {
return Address.fromPubKey(key.public, network);
};
//create a p2sh m-of-n multisig address

@@ -33,0 +38,0 @@ Address.fromPubKeys = function(mReq, pubKeys, network, opts) {

var imports = require('soop').imports();
var base58 = imports.base58 || require('base58-native').base58;
var base58 = imports.base58 || require('./Base58').base58;
var coinUtil = imports.coinUtil || require('../util');

@@ -7,8 +7,7 @@ var Key = imports.Key || require('./Key');

var SecureRandom = imports.SecureRandom || require('./SecureRandom');
var bignum = imports.bignum || require('bignum');
var crypto = require('crypto');
var bignum = imports.bignum || require('./Bignum');
var networks = require('../networks');
var secp256k1_n = new bignum("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141", 16);
var secp256k1_Gx = new bignum("79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798", 16);
var secp256k1_n = new bignum('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141', 16);
var secp256k1_Gx = new bignum('79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798', 16);

@@ -25,5 +24,5 @@ /*

}
else if (bytes == 'testnet')
else if (bytes == 'testnet') {
this.version = networks['testnet'].bip32privateVersion;
}
if (bytes == 'livenet' || bytes == 'testnet') {

@@ -43,6 +42,6 @@ this.depth = 0x00;

// decode base58
if (typeof bytes === "string") {
if (typeof bytes === 'string') {
var decoded = base58.decode(bytes);
if (decoded.length != 82)
throw new Error("Not enough data");
throw new Error('Not enough data, expected 82 and received '+decoded.length);
var checksum = decoded.slice(78, 82);

@@ -54,3 +53,3 @@ bytes = decoded.slice(0, 78);

if (hash[0] != checksum[0] || hash[1] != checksum[1] || hash[2] != checksum[2] || hash[3] != checksum[3]) {
throw new Error("Invalid checksum");
throw new Error('Invalid checksum');
}

@@ -71,3 +70,3 @@ }

return false; //need more entropy
var hash = coinUtil.sha512hmac(bytes, new Buffer("Bitcoin seed"));
var hash = coinUtil.sha512hmac(bytes, new Buffer('Bitcoin seed'));

@@ -94,3 +93,3 @@ var bip32 = new BIP32(null);

// Both pub and private extended keys are 78 bytes
if(bytes.length != 78) throw new Error("not enough data");
if(bytes.length != 78) throw new Error('not enough data');

@@ -126,3 +125,3 @@ this.version = u32(bytes.slice(0, 4));

} else {
throw new Error("Invalid key");
throw new Error('Invalid key');
}

@@ -148,3 +147,3 @@

default:
throw new Error("Unknown version");
throw new Error('Unknown version');
}

@@ -170,3 +169,3 @@

BIP32.prototype.extendedPublicKeyString = function(format) {
if (format === undefined || format === "base58") {
if (format === undefined || format === 'base58') {
var hash = coinUtil.sha256(coinUtil.sha256(this.extendedPublicKey));

@@ -176,6 +175,6 @@ var checksum = hash.slice(0, 4);

return base58.encode(data);
} else if (format === "hex") {
} else if (format === 'hex') {
return this.extendedPublicKey.toString('hex');;
} else {
throw new Error("bad format");
throw new Error('bad format');
}

@@ -208,3 +207,3 @@ }

BIP32.prototype.extendedPrivateKeyString = function(format) {
if (format === undefined || format === "base58") {
if (format === undefined || format === 'base58') {
var hash = coinUtil.sha256(coinUtil.sha256(this.extendedPrivateKey));

@@ -214,6 +213,6 @@ var checksum = hash.slice(0, 4);

return base58.encode(data);
} else if (format === "hex") {
} else if (format === 'hex') {
return this.extendedPrivateKey.toString('hex');
} else {
throw new Error("bad format");
throw new Error('bad format');
}

@@ -235,3 +234,3 @@ }

if (i == 0 ) {
if (c != 'm') throw new Error("invalid path");
if (c != 'm') throw new Error('invalid path');
continue;

@@ -267,3 +266,3 @@ }

if (usePrivate && (!this.hasPrivateKey || !isPrivate))
throw new Error("Cannot do private key derivation without private key");
throw new Error('Cannot do private key derivation without private key');

@@ -341,3 +340,3 @@ var ret = null;

if (f.length < size)
throw new Error("not enough data");
throw new Error('not enough data');
var n = 0;

@@ -344,0 +343,0 @@ for (var i = 0; i < size; i++) {

@@ -6,3 +6,3 @@ var imports = require('soop').imports();

var Script = imports.Script || require('./Script');
var Bignum = imports.Bignum || require('bignum');
var Bignum = imports.Bignum || require('./Bignum');
var Binary = imports.Binary || require('binary');

@@ -9,0 +9,0 @@ var Step = imports.Step || require('step');

var ECKey = require('../../browser/vendor-bundle.js').ECKey;
var SecureRandom = require('../SecureRandom');
var Curve = require('../Curve');
var bignum = require('bignum');
var bignum = require('../Bignum');

@@ -6,0 +6,0 @@ var Key = function() {

@@ -5,3 +5,3 @@ "use strict";

var Key = imports.Key || require('./Key');
var bignum = imports.bignum || require('bignum');
var bignum = imports.bignum || require('../Bignum');
var assert = require('assert');

@@ -8,0 +8,0 @@ var ECPointFp = require('../../browser/vendor-bundle.js').ECPointFp;

"use strict";
var imports = require('soop');
var bignum = imports.bignum || require('bignum');
var bignum = imports.bignum || require('./Bignum');
var Point = imports.Point || require('./Point');

@@ -5,0 +5,0 @@

@@ -5,3 +5,3 @@ var Key = require('./Key'),

buffertools = require('buffertools'),
bignum = require('bignum');
bignum = require('./Bignum');

@@ -8,0 +8,0 @@ /**

"use strict";
var imports = require('soop').imports();
var bignum = imports.bignum || require('bignum');
var bignum = imports.bignum || require('../Bignum');
var CPPKey = imports.CPPKey || require('bindings')('KeyModule').Key;

@@ -6,0 +6,0 @@ var assert = require('assert');

var imports = require('soop').imports();
var extend = imports.extend || require('extend');
var _ = imports._ || require('underscore');
var log = imports.log || require('../util/log');

@@ -15,3 +15,3 @@ var bitcoreDefaults = imports.config || require('../config');

// extend defaults with config
this.config = extend(true, config || {}, bitcoreDefaults);
this.config = _.extend(bitcoreDefaults, config || {});
this.active = false;

@@ -18,0 +18,0 @@ this.timer = null;

@@ -7,3 +7,3 @@ var imports = require('soop').imports();

var buffertools = imports.buffertools || require('buffertools');
var bignum = imports.bignum || require('bignum');
var bignum = imports.bignum || require('./Bignum');
var Util = imports.Util || require('../util');

@@ -708,3 +708,2 @@ var Script = require('./Script');

ikey = 0;
checkMultiSigStep.call(this);

@@ -747,2 +746,3 @@ function checkMultiSigStep() {

};
checkMultiSigStep.call(this);

@@ -749,0 +749,0 @@ // Note that for asynchronous opcodes we have to return here to prevent

@@ -8,3 +8,3 @@ var imports = require('soop').imports();

var util = imports.util || require('../util');
var bignum = imports.bignum || require('bignum');
var bignum = imports.bignum || require('./Bignum');
var Put = imports.Put || require('bufferput');

@@ -11,0 +11,0 @@ var Parser = imports.Parser || require('../util/BinaryParser');

/*
var tx = (new TransactionBuilder(opts))
.setUnspent(utxos)
.setOutputs(outs)
.sign(keys)
.build();
// Creates a bitcore Transaction object
//
//
// Synopsis
// --------
// ```
// var tx = (new TransactionBuilder(opts))
// .setUnspent(utxos)
// .setOutputs(outs)
// .sign(keys)
// .build();
//
//
// var builder = (new TransactionBuilder(opts))
// .setUnspent(spent)
// .setOutputs(outs);
//
// // Uncomplete tx (no signed or partially signed)
// var tx = builder.build();
//
// ..later..
//
// builder.sign(keys);
// while ( builder.isFullySigned() ) {
//
// ... get new keys ...
//
// builder.sign(keys);
// }
//
// var tx = builder.build();
// broadcast(tx.serialize());
//
// //Searialize it and pass it around...
// var string = JSON.serialize(builder.toObj());
// // then...
// var builder = TransactionBuilder.fromObj(JSON.parse(str);
// builder.sign(keys);
// // Also
// var builder2 = TransactionBuilder.fromObj(JSON.parse(str2);
// builder2.merge(builder); // Will merge signatures for p2sh mulsig txs.
//
//
// ```
//
//
//
var builder = (new TransactionBuilder(opts))
.setUnspent(spent)
.setOutputs(outs);
// Uncomplete tx (no signed or partially signed)
var tx = builder.build();
..later..
builder.sign(keys);
while ( builder.isFullySigned() ) {
... get new keys ...
builder.sign(keys);
}
var tx = builder.build();
broadcast(tx.serialize());
To get selected unspent outputs:
var selectedUnspent = builder.getSelectedUnspent();
@unspent
* unspent outputs array (UTXO), using the following format:
* [{
* address: "mqSjTad2TKbPcKQ3Jq4kgCkKatyN44UMgZ",
* hash: "2ac165fa7a3a2b535d106a0041c7568d03b531e58aeccdd3199d7289ab12cfc1",
* scriptPubKey: "76a9146ce4e1163eb18939b1440c42844d5f0261c0338288ac",
* vout: 1,
* amount: 0.01,
* confirmations: 3
* }, ...
* ]
* This is compatible con insight's utxo API.
* That amount is in BTCs (as returned in insight and bitcoind).
* amountSat (instead of amount) can be given to provide amount in satochis.
*
* @outs
* an array of [{
* address: xx,
* amount:0.001
* },...]
*
* @keys
* an array of strings representing private keys to sign the
* transaction in WIF private key format OR WalletKey objects
*
* @opts
* {
* remainderOut: null,
* fee: 0.001,
* lockTime: null,
* spendUnconfirmed: false,
* signhash: SIGHASH_ALL
* }
* Amounts are in BTC. instead of fee and amount; feeSat and amountSat can be given,
* repectively, to provide amounts in satoshis.
*
* If no remainderOut is given, and there are remainder coins, the
* first IN out will be used to return the coins. remainderOut has the form:
* remainderOut = { address: 1xxxxx}
* or
* remainderOut = { pubkeys: ['hex1','hex2',...} for multisig
*
*
*/
'use strict';

@@ -86,3 +57,3 @@

var util = imports.util || require('../util');
var bignum = imports.bignum || require('bignum');
var bignum = imports.bignum || require('./Bignum');
var buffertools = imports.buffertools || require('buffertools');

@@ -98,2 +69,31 @@ var networks = imports.networks || require('../networks');

// Methods
// -------
//
// TransactionBuilder
// ------------------
// Creates a TransactionBuilder instance
// `opts`
// ```
// {
// remainderOut: null,
// fee: 0.001,
// lockTime: null,
// spendUnconfirmed: false,
// signhash: SIGHASH_ALL
// }
// ```
// Amounts are in BTC. instead of fee and amount; feeSat and amountSat can be given,
// repectively, to provide amounts in satoshis.
//
// If no remainderOut is given, and there are remainder coins, the
// first IN out will be used to return the coins. remainderOut has the form:
// ```
// remainderOut = { address: 1xxxxx}
// ```
// or
// ```
// remainderOut = { pubkeys: ['hex1','hex2',...} for multisig
// ```
function TransactionBuilder(opts) {

@@ -184,4 +184,23 @@ opts = opts || {};

TransactionBuilder.prototype.setUnspent = function(utxos) {
this.utxos = utxos;
// setUnspent
// ----------
// Sets the `unspent` available for the transaction. Some (or all)
// of them to fullfil the transaction's outputs and fee.
// The expected format is:
// ```
// [{
// address: "mqSjTad2TKbPcKQ3Jq4kgCkKatyN44UMgZ",
// hash: "2ac165fa7a3a2b535d106a0041c7568d03b531e58aeccdd3199d7289ab12cfc1",
// scriptPubKey: "76a9146ce4e1163eb18939b1440c42844d5f0261c0338288ac",
// vout: 1,
// amount: 0.01,
// confirmations: 3
// }, ...
// ]
// ```
// This is compatible con insight's utxo API.
// That amount is in BTCs (as returned in insight and bitcoind).
// amountSat (instead of amount) can be given to provide amount in satochis.
TransactionBuilder.prototype.setUnspent = function(unspent) {
this.utxos = unspent;
return this;

@@ -215,2 +234,8 @@ };

// getSelectedUnspent
// ------------------
//
// Returns the selected unspent outputs, to be used in the transaction.
TransactionBuilder.prototype.getSelectedUnspent = function() {

@@ -319,3 +344,3 @@ return this.selectedUtxos;

// add remainder (without modifying outs[])
/* add remainder (without modifying outs[]) */
var remainderSat = this.valueInSat.sub(this.valueOutSat).sub(this.feeSat);

@@ -325,3 +350,3 @@ var l =txobj.outs.length;

//remove old remainder?
/*remove old remainder? */
if (l > remainderIndex) {

@@ -348,6 +373,6 @@ txobj.outs.pop();

//starting size estimation
/* starting size estimation */
var size = 500, maxSizeK, remainderIndex = txobj.outs.length;
do {
// based on https://en.bitcoin.it/wiki/Transaction_fees
/* based on https://en.bitcoin.it/wiki/Transaction_fees */
maxSizeK = parseInt(size / 1000) + 1;

@@ -371,2 +396,17 @@

// setOutputs
// ----------
// Sets the outputs for the transaction. Format is:
// ```
// an array of [{
// address: xx,
// amount:0.001
// },...]
// ```
//
// Note that only some of this outputs will be selected
// to create the transaction. The selected ones can be checked
// after calling `setOutputs`, with `.getSelectedUnspent`
//
TransactionBuilder.prototype.setOutputs = function(outs) {

@@ -405,3 +445,3 @@ var valueOutSat = bignum(0);

TransactionBuilder._mapKeys = function(keys) {
//prepare keys
/* prepare keys */
var walletKeyMap = {};

@@ -517,12 +557,12 @@ var l = keys.length;

// FOR TESTING
// var _dumpChunks = function (scriptSig, label) {
// console.log('## DUMP: ' + label + ' ##');
// for(var i=0; i<scriptSig.chunks.length; i++) {
// console.log('\tCHUNK ', i, Buffer.isBuffer(scriptSig.chunks[i])
// ?scriptSig.chunks[i].toString('hex'):scriptSig.chunks[i] );
// }
// };
/* FOR TESTING
var _dumpChunks = function (scriptSig, label) {
console.log('## DUMP: ' + label + ' ##');
for(var i=0; i<scriptSig.chunks.length; i++) {
console.log('\tCHUNK ', i, Buffer.isBuffer(scriptSig.chunks[i])
?scriptSig.chunks[i].toString('hex'):scriptSig.chunks[i] );
}
};
*/
TransactionBuilder.prototype._chunkSignedWithKey = function(scriptSig, txSigHash, publicKey) {

@@ -612,3 +652,2 @@ var ret;

for(var j=0; j<l && scriptSig.countSignatures() < nreq ; j++) {
//console.log('[TransactionBuilder.js] pubkey [j]',j, pubkeys[j].toString('hex')); //TODO
var wk = this._findWalletKey(walletKeyMap, {pubKeyBuf: pubkeys[j]});

@@ -623,4 +662,2 @@ if (!wk) continue;

}
if (scriptSig.countSignatures() === nreq) {
}

@@ -636,3 +673,2 @@ var ret = {

var fnToSign = {};
TransactionBuilder.prototype._scriptIsAppended = function(script, scriptToAddBuf) {

@@ -663,3 +699,3 @@ var len = script.chunks.length;

var scriptType = script.classify();
// pubKeyHash is needed for TX_PUBKEYHASH and TX_PUBKEY to retrieve the keys.
/* pubKeyHash is needed for TX_PUBKEYHASH and TX_PUBKEY to retrieve the keys. */
var pubKeyHash;

@@ -722,2 +758,16 @@ switch(scriptType) {

// sign
// ----
// Signs a transaction.
// `keys`: an array of strings representing private keys to sign the
// transaction in WIF private key format OR bitcore's `WalletKey` objects
//
// If multiple keys are given, each will be tested against the transaction's
// scriptPubKeys. Only the valid private keys will be used to sign.
// This method is fully compatible with *multisig* transactions.
//
// `.isFullySigned` can be queried to check is the transactions have all the needed
// signatures.
//
//
TransactionBuilder.prototype.sign = function(keys) {

@@ -746,3 +796,8 @@ this._checkTx();

// [ { address:scriptHex }]
// setHashToScriptMap
// ------------------
// Needed for setup Address to Script maps
// for p2sh transactions. See `.infoForP2sh`
// for generate the input for this call.
//
TransactionBuilder.prototype.setHashToScriptMap = function(hashToScriptMap) {

@@ -754,2 +809,8 @@ this.hashToScriptMap= hashToScriptMap;

// isFullySigned
// -------------
// Checks if the transaction have all the necesary signatures.
// Also, `.signaturesAdded` and `.inputsSigned` can be queried
// for more information about the transaction signature status.
//
TransactionBuilder.prototype.isFullySigned = function() {

@@ -764,3 +825,9 @@ return this.inputsSigned === this.tx.ins.length;

// toObj
// -----
// Returns a plain Javascript object that contains
// the full status of the TransactionBuilder instance,
// suitable for serialization, storage and transmition.
// See `.fromObj`
//
TransactionBuilder.prototype.toObj = function() {

@@ -779,3 +846,2 @@ var data = {

//opts :
signhash : this.signhash,

@@ -790,2 +856,7 @@ spendUnconfirmed : this.spendUnconfirmed,

// fromObj
// -------
// Returns a TransactionBuilder instance given
// a plain Javascript object created previously
// with `.toObj`. See `.toObj`.

@@ -973,2 +1044,7 @@ TransactionBuilder.fromObj = function(data) {

// merge
// -----
// Merge to TransactionBuilder objects, merging inputs signatures.
// This function supports multisig p2sh inputs.
TransactionBuilder.prototype.merge = function(b) {

@@ -975,0 +1051,0 @@ this._checkMergeability(b);

{
"name": "bitcore",
"description": "Bitcoin Library",
"version": "0.1.16",
"version": "0.1.17",
"author": {

@@ -57,3 +57,2 @@ "name": "Stephen Pair",

"soop": "=0.1.5",
"base58-native": "=0.1.3",
"bindings": "=1.1.1",

@@ -69,3 +68,2 @@ "bufferput": "git://github.com/bitpay/node-bufferput.git",

"commander": "=2.1.0",
"browserify-bignum": "git://github.com/maraoz/browserify-bignum.git",
"browserify-buffertools": "git://github.com/maraoz/browserify-buffertools.git",

@@ -76,4 +74,4 @@ "socks5-client": "~0.3.6",

"uglifyify": "=1.2.3",
"extend": "~1.2.1",
"async": "~0.2.10"
"async": "~0.2.10",
"underscore": "~1.6.0"
},

@@ -80,0 +78,0 @@ "devDependencies": {

@@ -62,3 +62,3 @@ Bitcore

For this example you need a running bitcoind instance with RPC enabled.
For this example you need a running bitcoind instance.

@@ -136,3 +136,3 @@ ```js

Check the list of all supported RPC call at [RpcClient.js](RpcClient.js)
Check the list of all supported RPC call at [RpcClient.js](lib/RpcClient.js)

@@ -139,0 +139,0 @@ ## Creating and sending a Transaction through P2P

@@ -8,11 +8,7 @@ 'use strict';

var AddressModule = bitcore.Address;
var Address;
var Address = bitcore.Address;
var Key = bitcore.Key;
describe('Address', function() {
it('should initialze the main object', function() {
should.exist(AddressModule);
});
it('should be able to create class', function() {
Address = AddressModule;
should.exist(Address);

@@ -88,3 +84,3 @@ });

describe('#fromPubKey', function() {
it('should make this pubkeyhash address from uncompressed this public key', function() {
it('should make pubkeyhash address from an uncompressed public key', function() {
var pubkey = new Buffer('04fa05ce8b25010cb6e17a30e0b66668bf083c40687547748ec330ee77adf53a42abd3d26148cbacfcf79c907ddefeb2c37f8bebc0a695ba79d634449d871de218', 'hex');

@@ -96,3 +92,14 @@ var hash = bitcore.util.sha256ripe160(pubkey);

});
describe('#fromKey', function() {
it('should make this pubkeyhash address from uncompressed this public key', function() {
var k = new Key();
k.private = new Buffer('43532455C88590A594D552F76DDB70EC1CFD7746F05C10CBB70B1EA9552EDF87', 'hex');
k.compressed = true;
k.regenerateSync();
var a = Address.fromKey(k);
a.toString().should.equal('1L8k7WpWHMNkqVPTaZhzFU5VaWyjZEK7mD');
});
});
describe('#fromPubKeys', function() {

@@ -99,0 +106,0 @@ it('should make this p2sh multisig address from these pubkeys', function() {

@@ -294,5 +294,17 @@ 'use strict';

});
});
describe('testnet', function() {
it('should initialize a new BIP32 correctly from a random BIP32', function() {
var b1 = new BIP32('testnet');
var b2 = new BIP32(b1.extendedPublicKeyString());
b2.extendedPublicKeyString().should.equal(b1.extendedPublicKeyString());
});
it('should generate valid ext pub key for testnet', function() {
var b = new BIP32('testnet');
b.extendedPublicKeyString().substring(0,4).should.equal('tpub');
});
});
});

@@ -7,3 +7,3 @@ 'use strict';

var buffertools = require('buffertools');
var bignum = require('bignum');
var bignum = bitcore.Bignum;

@@ -10,0 +10,0 @@ var should = chai.should();

@@ -11,3 +11,3 @@ var chai = chai || require('chai');

var Point = bitcore.Point;
var bignum = require('bignum');
var bignum = bitcore.Bignum;

@@ -14,0 +14,0 @@ describe('Key', function() {

@@ -12,4 +12,4 @@ 'use strict';

var bignum = bitcore.bignum;
var base58 = bitcore.base58;
var bignum = bitcore.Bignum;
var base58 = bitcore.Base58;
var base58Check = base58.base58Check;

@@ -85,3 +85,3 @@

it('should initialze the bignum object', function() {
should.exist(bitcore.bignum);
should.exist(bitcore.Bignum);
});

@@ -101,3 +101,3 @@ it('should create a bignum from string', function() {

it('should initialze the base58 object', function() {
should.exist(bitcore.base58);
should.exist(bitcore.Base58);
});

@@ -104,0 +104,0 @@ it('should obtain the same string in base58 roundtrip', function() {

@@ -33,2 +33,12 @@ 'use strict';

});
it('should extend default config with passed config', function() {
var pm = new PeerManager({
proxy: {
host: 'localhost',
port: 9050
}
});
should.exist(pm.config.network);
should.exist(pm.config.proxy);
});
});

@@ -35,0 +45,0 @@

@@ -7,3 +7,3 @@ 'use strict';

var buffertools = require('buffertools');
var bignum = require('bignum');
var bignum = bitcore.Bignum;

@@ -10,0 +10,0 @@ var should = chai.should();

var imports = require('soop').imports();
var base58 = imports.base58 || require('base58-native').base58Check;
var base58 = imports.base58 || require('../lib/Base58').base58Check;

@@ -4,0 +4,0 @@

var crypto = require('crypto');
var bignum = require('bignum');
var bignum = require('../lib/Bignum');
var Binary = require('binary');

@@ -4,0 +4,0 @@ var Put = require('bufferput');

var imports = require('soop').imports();
var base58 = imports.base58 || require('base58-native').base58Check;
var base58 = imports.base58 || require('../lib/Base58').base58Check;
var parent = imports.parent || require('./EncodedData');

@@ -4,0 +4,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc