GithubHelp home page GithubHelp logo

bitcore-explorers's Introduction

bitcore-explorers's People

Contributors

braydonf avatar eordano avatar isocolsky avatar maraoz avatar matiu avatar yemel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bitcore-explorers's Issues

can't broadcast serialized transaction

the following code results in an error:

'use strict';

var bitcore = require('bitcore');
var explorers = require('bitcore-explorers');
var insight = new explorers.Insight();

var Transaction = bitcore.Transaction;

var tx = new Transaction('0100000001c54cd2b468b0a0e24f573ee10bedfd7500c7079bf98c1ec7d56b330147d6f188000000006b48304502210091126306c144d97b7c811f0d7db535ae8ce709739b87ed2afda23418429adcb602202fe57542741477f02d4d42d3050dc71975840dff74c20ebbfcc6ca1773a044fd012102b9740162829af19408920ad4111298b98795b911d37514d975ac1912578545fcffffffff02074c0f00000000001976a9145ffd525ef01e229497e56b189fdd2a42bd36ba6688ace96de605000000001976a9145ffd525ef01e229497e56b189fdd2a42bd36ba6688ac00000000');
console.log(tx);
insight.broadcast(tx, function(err, txid) {
  if (err) {
    throw err;
  }
  console.log(txid);
});

and...

$ node broadcast.js 
<Transaction: 0100000001c54cd2b468b0a0e24f573ee10bedfd7500c7079bf98c1ec7d56b330147d6f188000000006b48304502210091126306c144d97b7c811f0d7db535ae8ce709739b87ed2afda23418429adcb602202fe57542741477f02d4d42d3050dc71975840dff74c20ebbfcc6ca1773a044fd012102b9740162829af19408920ad4111298b98795b911d37514d975ac1912578545fcffffffff02074c0f00000000001976a9145ffd525ef01e229497e56b189fdd2a42bd36ba6688ace96de605000000001976a9145ffd525ef01e229497e56b189fdd2a42bd36ba6688ac00000000>

/home/maraoz/git/segments/node_modules/bitcore/lib/transaction/transaction.js:723
        throw new errors.Transaction.Input.MissingPreviousOutput();
              ^
No previous output information.

Should work for an already serialized transaction

TypeError: Address has mismatched network type.

Running insight to getUnspentUtxos for a testnet address shows the following error:
throw new TypeError('Address has mismatched network type.'); ^TypeError: Address has mismatched network type.

Code:
var Insight = require('bitcore-explorers').Insight; var insight = new Insight('testnet'); return insight.getUnspentUtxos(address, function (err, utxos) { if (err) { console.err(err) } console.log(utxos); });

Code for testnet address:
let privateKey = new bitcore.PrivateKey(), hexa = privateKey.toString(), publicKey = new bitcore.PublicKey(privateKey); address = new bitcore.Address(publicKey, Networks.testnet);

Cannot connect to livenet after Months of smooth connectivity

My app has a smooth connection to Bitpay network for Months now.
Today i started having error "525 Origin SSL Handshake Error". This a a strange error and this only applies to live.
I need urgent help please.

<ref *2> IncomingMessage {
_readableState: ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: [],
flowing: true,
ended: true,
endEmitted: true,
reading: false,
sync: true,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
errorEmitted: false,
emitClose: true,
autoDestroy: false,
destroyed: false,
errored: false,
closed: false,
closeEmitted: false,
defaultEncoding: 'utf8',
awaitDrainWriters: null,
multiAwaitDrain: false,
readingMore: true,
decoder: null,
encoding: null,
[Symbol(kPaused)]: false
},
_events: [Object: null prototype] {
end: [ [Function: responseOnEnd], [Function (anonymous)] ],
close: [ [Function (anonymous)], [Function (anonymous)] ],
data: [Function (anonymous)],
error: [Function (anonymous)]
},
_eventsCount: 4,
_maxListeners: undefined,
socket: <ref *1> TLSSocket {
_tlsOptions: {
allowHalfOpen: undefined,
pipe: false,
secureContext: [SecureContext],
isServer: false,
requestCert: true,
rejectUnauthorized: true,
session: <Buffer 30 82 06 22 02 01 01 02 02 03 03 04 02 c0 2b 04 20 20 a8 cb 27 c6 b3 88 73 db 35 ce 44 59 c5 e8 6d ff 0e e1 e5 5c 28 4f 3d 63 79 22 87 99 23 6f 59 04 ... 1524 more bytes>,
ALPNProtocols: undefined,
requestOCSP: undefined,
enableTrace: undefined,
pskCallback: undefined,
highWaterMark: undefined
},
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
secureConnecting: false,
_SNICallback: null,
servername: 'insight.bitpay.com',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype] {
close: [Array],
end: [Function: onReadableStreamEnd],
newListener: [Function: keylogNewListener],
secure: [Function: onConnectSecure],
session: [Function (anonymous)],
free: [Function: onFree],
timeout: [Function: onTimeout],
agentRemove: [Function: onRemove],
error: [Function: socketErrorListener],
finish: [Function]
},
_eventsCount: 10,
connecting: false,
_hadError: false,
_parent: null,
_host: 'insight.bitpay.com',
_readableState: ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: [],
flowing: true,
ended: false,
endEmitted: false,
reading: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
errorEmitted: false,
emitClose: false,
autoDestroy: false,
destroyed: false,
errored: false,
closed: false,
closeEmitted: false,
defaultEncoding: 'utf8',
awaitDrainWriters: null,
multiAwaitDrain: false,
readingMore: false,
decoder: null,
encoding: null,
[Symbol(kPaused)]: false
},
_maxListeners: undefined,
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: true,
needDrain: false,
ending: true,
ended: true,
finished: false,
destroyed: false,
decodeStrings: false,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
afterWriteTickInfo: null,
buffered: [],
bufferedIndex: 0,
allBuffers: true,
allNoop: true,
pendingcb: 1,
prefinished: false,
errorEmitted: false,
emitClose: false,
autoDestroy: false,
errored: false,
closed: false,
writable: true
},
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: TLSWrap {
_parent: [TCP],
_parentWrap: undefined,
_secureContext: [SecureContext],
reading: true,
onkeylog: [Function: onkeylog],
onhandshakestart: [Function: noop],
onhandshakedone: [Function (anonymous)],
onocspresponse: [Function: onocspresponse],
onnewsession: [Function: onnewsessionclient],
onerror: [Function: onerror],
[Symbol(owner_symbol)]: [Circular *1]
},
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: ClientRequest {
_events: [Object: null prototype],
_eventsCount: 5,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [Circular *1],
_header: 'POST /api/addrs/utxo HTTP/1.1\r\n' +
'host: insight.bitpay.com\r\n' +
'accept: application/json\r\n' +
'content-type: application/json\r\n' +
'content-length: 46\r\n' +
'Connection: close\r\n' +
'\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: noopPendingOutput],
agent: [Agent],
socketPath: undefined,
method: 'POST',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: '/api/addrs/utxo',
_ended: true,
res: [Circular *2],
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: 'insight.bitpay.com',
protocol: 'https:',
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype]
},
[Symbol(res)]: TLSWrap {
_parent: [TCP],
_parentWrap: undefined,
_secureContext: [SecureContext],
reading: true,
onkeylog: [Function: onkeylog],
onhandshakestart: [Function: noop],
onhandshakedone: [Function (anonymous)],
onocspresponse: [Function: onocspresponse],
onnewsession: [Function: onnewsessionclient],
onerror: [Function: onerror],
[Symbol(owner_symbol)]: [Circular *1]
},
[Symbol(verified)]: true,
[Symbol(pendingSession)]: null,
[Symbol(async_id_symbol)]: 545,
[Symbol(kHandle)]: TLSWrap {
_parent: [TCP],
_parentWrap: undefined,
_secureContext: [SecureContext],
reading: true,
onkeylog: [Function: onkeylog],
onhandshakestart: [Function: noop],
onhandshakedone: [Function (anonymous)],
onocspresponse: [Function: onocspresponse],
onnewsession: [Function: onnewsessionclient],
onerror: [Function: onerror],
[Symbol(owner_symbol)]: [Circular *1]
},
[Symbol(kSetNoDelay)]: false,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0,
[Symbol(connect-options)]: {
rejectUnauthorized: true,
ciphers: 'TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA256:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!SRP:!CAMELLIA',
checkServerIdentity: [Function: checkServerIdentity],
minDHSize: 1024,
session: <Buffer 30 82 06 22 02 01 01 02 02 03 03 04 02 c0 2b 04 20 20 a8 cb 27 c6 b3 88 73 db 35 ce 44 59 c5 e8 6d ff 0e e1 e5 5c 28 4f 3d 63 79 22 87 99 23 6f 59 04 ... 1524 more bytes>,
_events: [Object: null prototype],
_eventsCount: 3,
_maxListeners: undefined,
method: 'POST',
callback: [Function (anonymous)],
readable: true,
writable: true,
explicitMethod: true,
_qs: [Querystring],
_auth: [Auth],
_oauth: [OAuth],
_multipart: [Multipart],
_redirect: [Redirect],
_tunnel: [Tunnel],
headers: [Object],
setHeader: [Function (anonymous)],
hasHeader: [Function (anonymous)],
getHeader: [Function (anonymous)],
removeHeader: [Function (anonymous)],
localAddress: undefined,
pool: {},
dests: [],
__isRequestRequest: true,
_callback: [Function (anonymous)],
uri: [Url],
proxy: null,
tunnel: true,
setHost: true,
originalCookieHeader: undefined,
_disableCookies: true,
_jar: undefined,
port: 443,
host: 'insight.bitpay.com',
path: null,
_json: true,
body: '{"addrs":"155ahEGEPxx7pGcRrKehgMu27ukHtGx585"}',
httpModule: [Object],
agentClass: [Function: Agent],
agent: [Agent],
_started: true,
href: 'https://insight.bitpay.com/api/addrs/utxo',
_defaultAgent: [Agent],
servername: 'insight.bitpay.com',
_agentKey: 'insight.bitpay.com:443::::::::::::::::::',
encoding: null,
singleUse: true
}
},
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
headers: {
date: 'Wed, 30 Sep 2020 11:44:12 GMT',
'content-type': 'text/html',
'content-length': '207',
connection: 'close',
'set-cookie': [
'__cfduid=db6a1a5959e58a2cd565b24be0dc443df1601466252; expires=Fri, 30-Oct-20 11:44:12 GMT; path=/; domain=.bitpay.com; HttpOnly; SameSite=Lax'
],
'cache-control': 'no-store, no-cache',
'cf-request-id': '05806cd3210000c4f85fb54200000001',
'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
server: 'cloudflare',
'cf-ray': '5dadb0cb6dd7c4f8-LOS'
},
rawHeaders: [
'Date',
'Wed, 30 Sep 2020 11:44:12 GMT',
'Content-Type',
'text/html',
'Content-Length',
'207',
'Connection',
'close',
'Set-Cookie',
'__cfduid=db6a1a5959e58a2cd565b24be0dc443df1601466252; expires=Fri, 30-Oct-20 11:44:12 GMT; path=/; domain=.bitpay.com; HttpOnly; SameSite=Lax',
'Cache-Control',
'no-store, no-cache',
'cf-request-id',
'05806cd3210000c4f85fb54200000001',
'Expect-CT',
'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
'Server',
'cloudflare',
'CF-RAY',
'5dadb0cb6dd7c4f8-LOS'
],
trailers: {},
rawTrailers: [],
aborted: false,
upgrade: false,
url: '',
method: null,
statusCode: 525,
statusMessage: 'Origin SSL Handshake Error',
client: <ref *1> TLSSocket {
_tlsOptions: {
allowHalfOpen: undefined,
pipe: false,
secureContext: [SecureContext],
isServer: false,
requestCert: true,
rejectUnauthorized: true,
session: <Buffer 30 82 06 22 02 01 01 02 02 03 03 04 02 c0 2b 04 20 20 a8 cb 27 c6 b3 88 73 db 35 ce 44 59 c5 e8 6d ff 0e e1 e5 5c 28 4f 3d 63 79 22 87 99 23 6f 59 04 ... 1524 more bytes>,
ALPNProtocols: undefined,
requestOCSP: undefined,
enableTrace: undefined,
pskCallback: undefined,
highWaterMark: undefined
},
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
secureConnecting: false,
_SNICallback: null,
servername: 'insight.bitpay.com',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype] {
close: [Array],
end: [Function: onReadableStreamEnd],
newListener: [Function: keylogNewListener],
secure: [Function: onConnectSecure],
session: [Function (anonymous)],
free: [Function: onFree],
timeout: [Function: onTimeout],
agentRemove: [Function: onRemove],
error: [Function: socketErrorListener],
finish: [Function]
},
_eventsCount: 10,
connecting: false,
_hadError: false,
_parent: null,
_host: 'insight.bitpay.com',
_readableState: ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: [],
flowing: true,
ended: false,
endEmitted: false,
reading: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
errorEmitted: false,
emitClose: false,
autoDestroy: false,
destroyed: false,
errored: false,
closed: false,
closeEmitted: false,
defaultEncoding: 'utf8',
awaitDrainWriters: null,
multiAwaitDrain: false,
readingMore: false,
decoder: null,
encoding: null,
[Symbol(kPaused)]: false
},
_maxListeners: undefined,
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: true,
needDrain: false,
ending: true,
ended: true,
finished: false,
destroyed: false,
decodeStrings: false,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
afterWriteTickInfo: null,
buffered: [],
bufferedIndex: 0,
allBuffers: true,
allNoop: true,
pendingcb: 1,
prefinished: false,
errorEmitted: false,
emitClose: false,
autoDestroy: false,
errored: false,
closed: false,
writable: true
},
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: TLSWrap {
_parent: [TCP],
_parentWrap: undefined,
_secureContext: [SecureContext],
reading: true,
onkeylog: [Function: onkeylog],
onhandshakestart: [Function: noop],
onhandshakedone: [Function (anonymous)],
onocspresponse: [Function: onocspresponse],
onnewsession: [Function: onnewsessionclient],
onerror: [Function: onerror],
[Symbol(owner_symbol)]: [Circular *1]
},
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: ClientRequest {
_events: [Object: null prototype],
_eventsCount: 5,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [Circular *1],
_header: 'POST /api/addrs/utxo HTTP/1.1\r\n' +
'host: insight.bitpay.com\r\n' +
'accept: application/json\r\n' +
'content-type: application/json\r\n' +
'content-length: 46\r\n' +
'Connection: close\r\n' +
'\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: noopPendingOutput],
agent: [Agent],
socketPath: undefined,
method: 'POST',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: '/api/addrs/utxo',
_ended: true,
res: [Circular *2],
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: 'insight.bitpay.com',
protocol: 'https:',
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype]
},
[Symbol(res)]: TLSWrap {
_parent: [TCP],
_parentWrap: undefined,
_secureContext: [SecureContext],
reading: true,
onkeylog: [Function: onkeylog],
onhandshakestart: [Function: noop],
onhandshakedone: [Function (anonymous)],
onocspresponse: [Function: onocspresponse],
onnewsession: [Function: onnewsessionclient],
onerror: [Function: onerror],
[Symbol(owner_symbol)]: [Circular *1]
},
[Symbol(verified)]: true,
[Symbol(pendingSession)]: null,
[Symbol(async_id_symbol)]: 545,
[Symbol(kHandle)]: TLSWrap {
_parent: [TCP],
_parentWrap: undefined,
_secureContext: [SecureContext],
reading: true,
onkeylog: [Function: onkeylog],
onhandshakestart: [Function: noop],
onhandshakedone: [Function (anonymous)],
onocspresponse: [Function: onocspresponse],
onnewsession: [Function: onnewsessionclient],
onerror: [Function: onerror],
[Symbol(owner_symbol)]: [Circular *1]
},
[Symbol(kSetNoDelay)]: false,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0,
[Symbol(connect-options)]: {
rejectUnauthorized: true,
ciphers: 'TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA256:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!SRP:!CAMELLIA',
checkServerIdentity: [Function: checkServerIdentity],
minDHSize: 1024,
session: <Buffer 30 82 06 22 02 01 01 02 02 03 03 04 02 c0 2b 04 20 20 a8 cb 27 c6 b3 88 73 db 35 ce 44 59 c5 e8 6d ff 0e e1 e5 5c 28 4f 3d 63 79 22 87 99 23 6f 59 04 ... 1524 more bytes>,
_events: [Object: null prototype],
_eventsCount: 3,
_maxListeners: undefined,
method: 'POST',
callback: [Function (anonymous)],
readable: true,
writable: true,
explicitMethod: true,
_qs: [Querystring],
_auth: [Auth],
_oauth: [OAuth],
_multipart: [Multipart],
_redirect: [Redirect],
_tunnel: [Tunnel],
headers: [Object],
setHeader: [Function (anonymous)],
hasHeader: [Function (anonymous)],
getHeader: [Function (anonymous)],
removeHeader: [Function (anonymous)],
localAddress: undefined,
pool: {},
dests: [],
__isRequestRequest: true,
_callback: [Function (anonymous)],
uri: [Url],
proxy: null,
tunnel: true,
setHost: true,
originalCookieHeader: undefined,
_disableCookies: true,
_jar: undefined,
port: 443,
host: 'insight.bitpay.com',
path: null,
_json: true,
body: '{"addrs":"155ahEGEPxx7pGcRrKehgMu27ukHtGx585"}',
httpModule: [Object],
agentClass: [Function: Agent],
agent: [Agent],
_started: true,
href: 'https://insight.bitpay.com/api/addrs/utxo',
_defaultAgent: [Agent],
servername: 'insight.bitpay.com',
_agentKey: 'insight.bitpay.com:443::::::::::::::::::',
encoding: null,
singleUse: true
}
},
_consuming: false,
_dumped: false,
req: <ref *3> ClientRequest {
_events: [Object: null prototype] {
socket: [Function (anonymous)],
response: [Function: bound ],
error: [Function: bound ],
drain: [Function (anonymous)],
prefinish: [Function: requestOnPrefinish]
},
_eventsCount: 5,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: <ref *1> TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
secureConnecting: false,
_SNICallback: null,
servername: 'insight.bitpay.com',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype],
_eventsCount: 10,
connecting: false,
_hadError: false,
_parent: null,
_host: 'insight.bitpay.com',
_readableState: [ReadableState],
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: [TLSWrap],
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [Circular *3],
[Symbol(res)]: [TLSWrap],
[Symbol(verified)]: true,
[Symbol(pendingSession)]: null,
[Symbol(async_id_symbol)]: 545,
[Symbol(kHandle)]: [TLSWrap],
[Symbol(kSetNoDelay)]: false,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0,
[Symbol(connect-options)]: [Object]
},
_header: 'POST /api/addrs/utxo HTTP/1.1\r\n' +
'host: insight.bitpay.com\r\n' +
'accept: application/json\r\n' +
'content-type: application/json\r\n' +
'content-length: 46\r\n' +
'Connection: close\r\n' +
'\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: noopPendingOutput],
agent: Agent {
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: [Object],
requests: {},
sockets: [Object],
freeSockets: {},
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
scheduling: 'fifo',
maxTotalSockets: Infinity,
totalSocketCount: 1,
maxCachedSessions: 100,
_sessionCache: [Object],
[Symbol(kCapture)]: false
},
socketPath: undefined,
method: 'POST',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: '/api/addrs/utxo',
_ended: true,
res: [Circular *2],
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: 'insight.bitpay.com',
protocol: 'https:',
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype] {
host: [Array],
accept: [Array],
'content-type': [Array],
'content-length': [Array]
}
},
request: <ref *4> Request {
_events: [Object: null prototype] {
error: [Function: bound ],
complete: [Function: bound ],
pipe: [Function (anonymous)],
data: [Function (anonymous)],
end: [Function (anonymous)]
},
_eventsCount: 5,
_maxListeners: undefined,
method: 'POST',
callback: [Function (anonymous)],
readable: true,
writable: true,
explicitMethod: true,
_qs: Querystring {
request: [Circular *4],
lib: [Object],
useQuerystring: undefined,
parseOptions: {},
stringifyOptions: {}
},
_auth: Auth {
request: [Circular *4],
hasAuth: false,
sentAuth: false,
bearerToken: null,
user: null,
pass: null
},
_oauth: OAuth { request: [Circular *4], params: null },
_multipart: Multipart {
request: [Circular *4],
boundary: 'd037b325-eb6d-4090-b5e3-e66c985ba3b6',
chunked: false,
body: null
},
_redirect: Redirect {
request: [Circular *4],
followRedirect: true,
followRedirects: true,
followAllRedirects: false,
followOriginalHttpMethod: false,
allowRedirect: [Function (anonymous)],
maxRedirects: 10,
redirects: [],
redirectsFollowed: 0,
removeRefererHeader: false
},
_tunnel: Tunnel {
request: [Circular *4],
proxyHeaderWhiteList: [Array],
proxyHeaderExclusiveList: []
},
headers: {
accept: 'application/json',
'content-type': 'application/json',
'content-length': 46
},
setHeader: [Function (anonymous)],
hasHeader: [Function (anonymous)],
getHeader: [Function (anonymous)],
removeHeader: [Function (anonymous)],
localAddress: undefined,
pool: {},
dests: [],
__isRequestRequest: true,
_callback: [Function (anonymous)],
uri: Url {
protocol: 'https:',
slashes: true,
auth: null,
host: 'insight.bitpay.com',
port: 443,
hostname: 'insight.bitpay.com',
hash: null,
search: null,
query: null,
pathname: '/api/addrs/utxo',
path: '/api/addrs/utxo',
href: 'https://insight.bitpay.com/api/addrs/utxo'
},
proxy: null,
tunnel: true,
setHost: true,
originalCookieHeader: undefined,
_disableCookies: true,
_jar: undefined,
port: 443,
host: 'insight.bitpay.com',
path: '/api/addrs/utxo',
_json: true,
body: '{"addrs":"155ahEGEPxx7pGcRrKehgMu27ukHtGx585"}',
httpModule: {
Agent: [Function: Agent],
globalAgent: [Agent],
Server: [Function: Server],
createServer: [Function: createServer],
get: [Function: get],
request: [Function: request]
},
agentClass: [Function: Agent],
agent: Agent {
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: [Object],
requests: {},
sockets: [Object],
freeSockets: {},
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
scheduling: 'fifo',
maxTotalSockets: Infinity,
totalSocketCount: 1,
maxCachedSessions: 100,
_sessionCache: [Object],
[Symbol(kCapture)]: false
},
_started: true,
href: 'https://insight.bitpay.com/api/addrs/utxo',
req: <ref *3> ClientRequest {
_events: [Object: null prototype],
_eventsCount: 5,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [TLSSocket],
_header: 'POST /api/addrs/utxo HTTP/1.1\r\n' +
'host: insight.bitpay.com\r\n' +
'accept: application/json\r\n' +
'content-type: application/json\r\n' +
'content-length: 46\r\n' +
'Connection: close\r\n' +
'\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: noopPendingOutput],
agent: [Agent],
socketPath: undefined,
method: 'POST',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: '/api/addrs/utxo',
_ended: true,
res: [Circular *2],
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: 'insight.bitpay.com',
protocol: 'https:',
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype]
},
ntick: true,
response: [Circular *2],
originalHost: 'insight.bitpay.com',
originalHostHeaderName: 'host',
responseContent: [Circular *2],
_destdata: true,
_ended: true,
_callbackCalled: true,
[Symbol(kCapture)]: false
},
toJSON: [Function: responseToJSON],
caseless: Caseless {
dict: {
date: 'Wed, 30 Sep 2020 11:44:12 GMT',
'content-type': 'text/html',
'content-length': '207',
connection: 'close',
'set-cookie': [Array],
'cache-control': 'no-store, no-cache',
'cf-request-id': '05806cd3210000c4f85fb54200000001',
'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
server: 'cloudflare',
'cf-ray': '5dadb0cb6dd7c4f8-LOS'
}
},
body: '\r\n' +
'<title>525 Origin SSL Handshake Error</title>\r\n' +
'\r\n' +
'

525 Origin SSL Handshake Error

\r\n' +
'
cloudflare-nginx\r\n' +
'\r\n' +
'\r\n',
[Symbol(kCapture)]: false
}

Unable to install alongside recent versions of bitcore-lib

It appears that bitcore-explorers is using an older version of bitcore-lib and isn't able to function nicely in projects using the most recent version of bitcore-lib. If your project uses the latest version bitcore-lib and bitcore-explorers as a dependency you will get the following error.

Error: More than one instance of bitcore-lib found. Please make sure to require bitcore-lib and check that submodules do not also include their own bitcore-lib dependency.

It appears that npm is installing an older version of bitcore-lib under ./node_modules/bitcore-explorers/node_modules based on the dependencies for bitcore-explorers. A temporary solution is to just delete that folder but if you do anything using npm it will reinstall it.

Geeting error from the insight.getUnspentUtxos() after setting the right configs

IncomingMessage {
_readableState: ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: null,
pipesCount: 0,
flowing: true,
ended: true,
endEmitted: true,
reading: false,
sync: true,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
paused: false,
emitClose: true,
autoDestroy: false,
destroyed: false,
defaultEncoding: 'utf8',
awaitDrain: 0,
readingMore: true,
decoder: null,
encoding: null
},
readable: false,
_events: [Object: null prototype] {
end: [ [Function: responseOnEnd], [Function] ],
close: [ [Function], [Function] ],
data: [Function],
error: [Function]
},
_eventsCount: 4,
_maxListeners: undefined,
socket: TLSSocket {
_tlsOptions: {
allowHalfOpen: undefined,
pipe: false,
secureContext: [SecureContext],
isServer: false,
requestCert: true,
rejectUnauthorized: true,
session: undefined,
ALPNProtocols: undefined,
requestOCSP: undefined,
enableTrace: undefined
},
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
_SNICallback: null,
servername: 'test-insight.bitpay.com',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype] {
close: [Array],
end: [Function: onReadableStreamEnd],
newListener: [Function: keylogNewListener],
secure: [Function: onConnectSecure],
session: [Function],
free: [Function: onFree],
agentRemove: [Function: onRemove],
error: [Function: socketErrorListener],
finish: [Function]
},
_eventsCount: 9,
connecting: false,
_hadError: false,
_parent: null,
_host: 'test-insight.bitpay.com',
_readableState: ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: null,
pipesCount: 0,
flowing: true,
ended: false,
endEmitted: false,
reading: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
paused: false,
emitClose: false,
autoDestroy: false,
destroyed: false,
defaultEncoding: 'utf8',
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null
},
readable: true,
_maxListeners: undefined,
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: true,
needDrain: false,
ending: true,
ended: true,
finished: false,
destroyed: false,
decodeStrings: false,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 1,
prefinished: false,
errorEmitted: false,
emitClose: false,
autoDestroy: false,
bufferedRequestCount: 0,
corkedRequestsFree: [Object]
},
writable: false,
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: TLSWrap {
_parent: [TCP],
_parentWrap: undefined,
_secureContext: [SecureContext],
reading: true,
onhandshakestart: [Function: noop],
onhandshakedone: [Function],
onocspresponse: [Function: onocspresponse],
onnewsession: [Function: onnewsessionclient],
onkeylog: [Function: onkeylogclient],
onerror: [Function: onerror],
[Symbol(owner)]: [Circular]
},
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: ClientRequest {
_events: [Object: null prototype],
_eventsCount: 5,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [Circular],
connection: [Circular],
_header: 'POST /api/addrs/utxo HTTP/1.1\r\n' +
'host: test-insight.bitpay.com\r\n' +
'accept: application/json\r\n' +
'content-type: application/json\r\n' +
'content-length: 46\r\n' +
'Connection: close\r\n' +
'\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: [Agent],
socketPath: undefined,
method: 'POST',
path: '/api/addrs/utxo',
_ended: true,
res: [Circular],
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
[Symbol(kNeedDrain)]: false,
[Symbol(isCorked)]: false,
[Symbol(kOutHeaders)]: [Object: null prototype]
},
[Symbol(res)]: TLSWrap {
_parent: [TCP],
_parentWrap: undefined,
_secureContext: [SecureContext],
reading: true,
onhandshakestart: [Function: noop],
onhandshakedone: [Function],
onocspresponse: [Function: onocspresponse],
onnewsession: [Function: onnewsessionclient],
onkeylog: [Function: onkeylogclient],
onerror: [Function: onerror],
[Symbol(owner)]: [Circular]
},
[Symbol(asyncId)]: 8,
[Symbol(kHandle)]: TLSWrap {
_parent: [TCP],
_parentWrap: undefined,
_secureContext: [SecureContext],
reading: true,
onhandshakestart: [Function: noop],
onhandshakedone: [Function],
onocspresponse: [Function: onocspresponse],
onnewsession: [Function: onnewsessionclient],
onkeylog: [Function: onkeylogclient],
onerror: [Function: onerror],
[Symbol(owner)]: [Circular]
},
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0,
[Symbol(connect-options)]: {
rejectUnauthorized: true,
ciphers: 'TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RS
A-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA256:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!SRP:!CA
MELLIA',
checkServerIdentity: [Function: checkServerIdentity],
minDHSize: 1024,
_events: [Object: null prototype],
_eventsCount: 3,
_maxListeners: undefined,
method: 'POST',
callback: [Function],
readable: true,
writable: true,
explicitMethod: true,
_qs: [Querystring],
_auth: [Auth],
_oauth: [OAuth],
_multipart: [Multipart],
_redirect: [Redirect],
_tunnel: [Tunnel],
headers: [Object],
setHeader: [Function],
hasHeader: [Function],
getHeader: [Function],
removeHeader: [Function],
localAddress: undefined,
pool: {},
dests: [],
__isRequestRequest: true,
_callback: [Function],
uri: [Url],
proxy: null,
tunnel: true,
setHost: true,
originalCookieHeader: undefined,
_disableCookies: true,
_jar: undefined,
port: 443,
host: 'test-insight.bitpay.com',
path: null,
_json: true,
body: '{"addrs":"mzHJycXww84xDMGWczGDE8E5dnG9ogkjK5"}',
httpModule: [Object],
agentClass: [Function: Agent],
agent: [Agent],
_started: true,
href: 'https://test-insight.bitpay.com/api/addrs/utxo',
_defaultAgent: [Agent],
servername: 'test-insight.bitpay.com',
_agentKey: 'test-insight.bitpay.com:443::::::::::::::::::',
encoding: null,
singleUse: true
}
},
connection: TLSSocket {
_tlsOptions: {
allowHalfOpen: undefined,
pipe: false,
secureContext: [SecureContext],
isServer: false,
requestCert: true,
rejectUnauthorized: true,
session: undefined,
ALPNProtocols: undefined,
requestOCSP: undefined,
enableTrace: undefined
},
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
_SNICallback: null,
servername: 'test-insight.bitpay.com',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype] {
close: [Array],
end: [Function: onReadableStreamEnd],
newListener: [Function: keylogNewListener],
secure: [Function: onConnectSecure],
session: [Function],
free: [Function: onFree],
agentRemove: [Function: onRemove],
error: [Function: socketErrorListener],
finish: [Function]
},
_eventsCount: 9,
connecting: false,
_hadError: false,
_parent: null,
_host: 'test-insight.bitpay.com',
_readableState: ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: null,
pipesCount: 0,
flowing: true,
ended: false,
endEmitted: false,
reading: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
paused: false,
emitClose: false,
autoDestroy: false,
destroyed: false,
defaultEncoding: 'utf8',
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null
},
readable: true,
_maxListeners: undefined,
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: true,
needDrain: false,
ending: true,
ended: true,
finished: false,
destroyed: false,
decodeStrings: false,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 1,
prefinished: false,
errorEmitted: false,
emitClose: false,
autoDestroy: false,
bufferedRequestCount: 0,
corkedRequestsFree: [Object]
},
writable: false,
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: TLSWrap {
_parent: [TCP],
_parentWrap: undefined,
_secureContext: [SecureContext],
reading: true,
onhandshakestart: [Function: noop],
onhandshakedone: [Function],
onocspresponse: [Function: onocspresponse],
onnewsession: [Function: onnewsessionclient],
onkeylog: [Function: onkeylogclient],
onerror: [Function: onerror],
[Symbol(owner)]: [Circular]
},
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: ClientRequest {
_events: [Object: null prototype],
_eventsCount: 5,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [Circular],
connection: [Circular],
_header: 'POST /api/addrs/utxo HTTP/1.1\r\n' +
'host: test-insight.bitpay.com\r\n' +
'accept: application/json\r\n' +
'content-type: application/json\r\n' +
'content-length: 46\r\n' +
'Connection: close\r\n' +
'\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: [Agent],
socketPath: undefined,
method: 'POST',
path: '/api/addrs/utxo',
_ended: true,
res: [Circular],
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
[Symbol(kNeedDrain)]: false,
[Symbol(isCorked)]: false,
[Symbol(kOutHeaders)]: [Object: null prototype]
},
[Symbol(res)]: TLSWrap {
_parent: [TCP],
_parentWrap: undefined,
_secureContext: [SecureContext],
reading: true,
onhandshakestart: [Function: noop],
onhandshakedone: [Function],
onocspresponse: [Function: onocspresponse],
onnewsession: [Function: onnewsessionclient],
onkeylog: [Function: onkeylogclient],
onerror: [Function: onerror],
[Symbol(owner)]: [Circular]
},
[Symbol(asyncId)]: 8,
[Symbol(kHandle)]: TLSWrap {
_parent: [TCP],
_parentWrap: undefined,
_secureContext: [SecureContext],
reading: true,
onhandshakestart: [Function: noop],
onhandshakedone: [Function],
onocspresponse: [Function: onocspresponse],
onnewsession: [Function: onnewsessionclient],
onkeylog: [Function: onkeylogclient],
onerror: [Function: onerror],
[Symbol(owner)]: [Circular]
},
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0,
[Symbol(connect-options)]: {
rejectUnauthorized: true,
ciphers: 'TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RS
A-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA256:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!SRP:!CA
MELLIA',
checkServerIdentity: [Function: checkServerIdentity],
minDHSize: 1024,
_events: [Object: null prototype],
_eventsCount: 3,
_maxListeners: undefined,
method: 'POST',
callback: [Function],
readable: true,
writable: true,
explicitMethod: true,
_qs: [Querystring],
_auth: [Auth],
_oauth: [OAuth],
_multipart: [Multipart],
_redirect: [Redirect],
_tunnel: [Tunnel],
headers: [Object],
setHeader: [Function],
hasHeader: [Function],
getHeader: [Function],
removeHeader: [Function],
localAddress: undefined,
pool: {},
dests: [],
__isRequestRequest: true,
_callback: [Function],
uri: [Url],
proxy: null,
tunnel: true,
setHost: true,
originalCookieHeader: undefined,
_disableCookies: true,
_jar: undefined,
port: 443,
host: 'test-insight.bitpay.com',
path: null,
_json: true,
body: '{"addrs":"mzHJycXww84xDMGWczGDE8E5dnG9ogkjK5"}',
httpModule: [Object],
agentClass: [Function: Agent],
agent: [Agent],
_started: true,
href: 'https://test-insight.bitpay.com/api/addrs/utxo',
_defaultAgent: [Agent],
servername: 'test-insight.bitpay.com',
_agentKey: 'test-insight.bitpay.com:443::::::::::::::::::',
encoding: null,
singleUse: true
}
},
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
headers: {
date: 'Fri, 15 May 2020 01:55:00 GMT',
'content-type': 'text/plain; charset=UTF-8',
'content-length': '16',
connection: 'close',
'x-frame-options': 'SAMEORIGIN',
'cache-control': 'private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0',
expires: 'Thu, 01 Jan 1970 00:00:01 GMT',
'set-cookie': [
'__cfduid=dc67e77ba36d84d37fbba120a1d20ddc91589507700; expires=Sun, 14-Jun-20 01:55:00 GMT; path=/; domain=.bitpay.com; HttpOnly; SameSite=Lax'
],
'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
server: 'cloudflare',
'cf-ray': '59393bf7dfdfc68b-MAD',
'cf-request-id': '02b7a3cee70000c68b46168200000001'
},
rawHeaders: [
'Date',
'Fri, 15 May 2020 01:55:00 GMT',
'Content-Type',
'text/plain; charset=UTF-8',
'Content-Length',
'16',
'Connection',
'close',
'X-Frame-Options',
'SAMEORIGIN',
'Cache-Control',
'private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0',
'Expires',
'Thu, 01 Jan 1970 00:00:01 GMT',
'Set-Cookie',
'__cfduid=dc67e77ba36d84d37fbba120a1d20ddc91589507700; expires=Sun, 14-Jun-20 01:55:00 GMT; path=/; domain=.bitpay.com; HttpOnly; SameSite=Lax',
'Expect-CT',
'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
'Server',
'cloudflare',
'CF-RAY',
'59393bf7dfdfc68b-MAD',
'cf-request-id',
'02b7a3cee70000c68b46168200000001'
],
trailers: {},
rawTrailers: [],
aborted: false,
upgrade: false,
url: '',
method: null,
statusCode: 403,
statusMessage: 'Forbidden',
client: TLSSocket {
_tlsOptions: {
allowHalfOpen: undefined,
pipe: false,
secureContext: [SecureContext],
isServer: false,
requestCert: true,
rejectUnauthorized: true,
session: undefined,
ALPNProtocols: undefined,
requestOCSP: undefined,
enableTrace: undefined
},
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
_SNICallback: null,
servername: 'test-insight.bitpay.com',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype] {
close: [Array],
end: [Function: onReadableStreamEnd],
newListener: [Function: keylogNewListener],
secure: [Function: onConnectSecure],
session: [Function],
free: [Function: onFree],
agentRemove: [Function: onRemove],
error: [Function: socketErrorListener],
finish: [Function]
},
_eventsCount: 9,
connecting: false,
_hadError: false,
_parent: null,
_host: 'test-insight.bitpay.com',
_readableState: ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: null,
pipesCount: 0,
flowing: true,
ended: false,
endEmitted: false,
reading: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
paused: false,
emitClose: false,
autoDestroy: false,
destroyed: false,
defaultEncoding: 'utf8',
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null
},
readable: true,
_maxListeners: undefined,
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: true,
needDrain: false,
ending: true,
ended: true,
finished: false,
destroyed: false,
decodeStrings: false,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 1,
prefinished: false,
errorEmitted: false,
emitClose: false,
autoDestroy: false,
bufferedRequestCount: 0,
corkedRequestsFree: [Object]
},
writable: false,
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: TLSWrap {
_parent: [TCP],
_parentWrap: undefined,
_secureContext: [SecureContext],
reading: true,
onhandshakestart: [Function: noop],
onhandshakedone: [Function],
onocspresponse: [Function: onocspresponse],
onnewsession: [Function: onnewsessionclient],
onkeylog: [Function: onkeylogclient],
onerror: [Function: onerror],
[Symbol(owner)]: [Circular]
},
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: ClientRequest {
_events: [Object: null prototype],
_eventsCount: 5,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [Circular],
connection: [Circular],
_header: 'POST /api/addrs/utxo HTTP/1.1\r\n' +
'host: test-insight.bitpay.com\r\n' +
'accept: application/json\r\n' +
'content-type: application/json\r\n' +
'content-length: 46\r\n' +
'Connection: close\r\n' +
'\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: [Agent],
socketPath: undefined,
method: 'POST',
path: '/api/addrs/utxo',
_ended: true,
res: [Circular],
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
[Symbol(kNeedDrain)]: false,
[Symbol(isCorked)]: false,
[Symbol(kOutHeaders)]: [Object: null prototype]
},
[Symbol(res)]: TLSWrap {
_parent: [TCP],
_parentWrap: undefined,
_secureContext: [SecureContext],
reading: true,
onhandshakestart: [Function: noop],
onhandshakedone: [Function],
onocspresponse: [Function: onocspresponse],
onnewsession: [Function: onnewsessionclient],
onkeylog: [Function: onkeylogclient],
onerror: [Function: onerror],
[Symbol(owner)]: [Circular]
},
[Symbol(asyncId)]: 8,
[Symbol(kHandle)]: TLSWrap {
_parent: [TCP],
_parentWrap: undefined,
_secureContext: [SecureContext],
reading: true,
onhandshakestart: [Function: noop],
onhandshakedone: [Function],
onocspresponse: [Function: onocspresponse],
onnewsession: [Function: onnewsessionclient],
onkeylog: [Function: onkeylogclient],
onerror: [Function: onerror],
[Symbol(owner)]: [Circular]
},
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0,
[Symbol(connect-options)]: {
rejectUnauthorized: true,
ciphers: 'TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RS
A-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA256:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!SRP:!CA
MELLIA',
checkServerIdentity: [Function: checkServerIdentity],
minDHSize: 1024,
_events: [Object: null prototype],
_eventsCount: 3,
_maxListeners: undefined,
method: 'POST',
callback: [Function],
readable: true,
writable: true,
explicitMethod: true,
_qs: [Querystring],
_auth: [Auth],
_oauth: [OAuth],
_multipart: [Multipart],
_redirect: [Redirect],
_tunnel: [Tunnel],
headers: [Object],
setHeader: [Function],
hasHeader: [Function],
getHeader: [Function],
removeHeader: [Function],
localAddress: undefined,
pool: {},
dests: [],
__isRequestRequest: true,
_callback: [Function],
uri: [Url],
proxy: null,
tunnel: true,
setHost: true,
originalCookieHeader: undefined,
_disableCookies: true,
_jar: undefined,
port: 443,
host: 'test-insight.bitpay.com',
path: null,
_json: true,
body: '{"addrs":"mzHJycXww84xDMGWczGDE8E5dnG9ogkjK5"}',
httpModule: [Object],
agentClass: [Function: Agent],
agent: [Agent],
_started: true,
href: 'https://test-insight.bitpay.com/api/addrs/utxo',
_defaultAgent: [Agent],
servername: 'test-insight.bitpay.com',
_agentKey: 'test-insight.bitpay.com:443::::::::::::::::::',
encoding: null,
singleUse: true
}
},
_consuming: false,
_dumped: false,
req: ClientRequest {
_events: [Object: null prototype] {
socket: [Function],
response: [Function: bound ],
error: [Function: bound ],
drain: [Function],
prefinish: [Function: requestOnPrefinish]
},
_eventsCount: 5,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
_SNICallback: null,
servername: 'test-insight.bitpay.com',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype],
_eventsCount: 9,
connecting: false,
_hadError: false,
_parent: null,
_host: 'test-insight.bitpay.com',
_readableState: [ReadableState],
readable: true,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: [TLSWrap],
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [Circular],
[Symbol(res)]: [TLSWrap],
[Symbol(asyncId)]: 8,
[Symbol(kHandle)]: [TLSWrap],
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0,
[Symbol(connect-options)]: [Object]
},
connection: TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
_SNICallback: null,
servername: 'test-insight.bitpay.com',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype],
_eventsCount: 9,
connecting: false,
_hadError: false,
_parent: null,
_host: 'test-insight.bitpay.com',
_readableState: [ReadableState],
readable: true,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: [TLSWrap],
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [Circular],
[Symbol(res)]: [TLSWrap],
[Symbol(asyncId)]: 8,
[Symbol(kHandle)]: [TLSWrap],
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0,
[Symbol(connect-options)]: [Object]
},
_header: 'POST /api/addrs/utxo HTTP/1.1\r\n' +
'host: test-insight.bitpay.com\r\n' +
'accept: application/json\r\n' +
'content-type: application/json\r\n' +
'content-length: 46\r\n' +
'Connection: close\r\n' +
'\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: Agent {
_events: [Object: null prototype],
_eventsCount: 1,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: [Object],
requests: {},
sockets: [Object],
freeSockets: {},
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
maxCachedSessions: 100,
_sessionCache: [Object]
},
socketPath: undefined,
method: 'POST',
path: '/api/addrs/utxo',
_ended: true,
res: [Circular],
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
[Symbol(kNeedDrain)]: false,
[Symbol(isCorked)]: false,
[Symbol(kOutHeaders)]: [Object: null prototype] {
host: [Array],
accept: [Array],
'content-type': [Array],
'content-length': [Array]
}
},
request: Request {
_events: [Object: null prototype] {
error: [Function: bound ],
complete: [Function: bound ],
pipe: [Function],
data: [Function],
end: [Function]
},
_eventsCount: 5,
_maxListeners: undefined,
method: 'POST',
callback: [Function],
readable: true,
writable: true,
explicitMethod: true,
_qs: Querystring {
request: [Circular],
lib: [Object],
useQuerystring: undefined,
parseOptions: {},
stringifyOptions: {}
},
_auth: Auth {
request: [Circular],
hasAuth: false,
sentAuth: false,
bearerToken: null,
user: null,
pass: null
},
_oauth: OAuth { request: [Circular], params: null },
_multipart: Multipart {
request: [Circular],
boundary: 'b43a944e-03ad-4c45-b185-3eded7e8f87e',
chunked: false,
body: null
},
_redirect: Redirect {
request: [Circular],
followRedirect: true,
followRedirects: true,
followAllRedirects: false,
followOriginalHttpMethod: false,
allowRedirect: [Function],
maxRedirects: 10,
redirects: [],
redirectsFollowed: 0,
removeRefererHeader: false
},
_tunnel: Tunnel {
request: [Circular],
proxyHeaderWhiteList: [Array],
proxyHeaderExclusiveList: []
},
headers: {
accept: 'application/json',
'content-type': 'application/json',
'content-length': 46
},
setHeader: [Function],
hasHeader: [Function],
getHeader: [Function],
removeHeader: [Function],
localAddress: undefined,
pool: {},
dests: [],
__isRequestRequest: true,
_callback: [Function],
uri: Url {
protocol: 'https:',
slashes: true,
auth: null,
host: 'test-insight.bitpay.com',
port: 443,
hostname: 'test-insight.bitpay.com',
hash: null,
search: null,
query: null,
pathname: '/api/addrs/utxo',
path: '/api/addrs/utxo',
href: 'https://test-insight.bitpay.com/api/addrs/utxo'
},
proxy: null,
tunnel: true,
setHost: true,
originalCookieHeader: undefined,
_disableCookies: true,
_jar: undefined,
port: 443,
host: 'test-insight.bitpay.com',
path: '/api/addrs/utxo',
_json: true,
body: '{"addrs":"mzHJycXww84xDMGWczGDE8E5dnG9ogkjK5"}',
httpModule: {
Agent: [Function: Agent],
globalAgent: [Agent],
Server: [Function: Server],
createServer: [Function: createServer],
get: [Function: get],
request: [Function: request]
},
agentClass: [Function: Agent],
agent: Agent {
_events: [Object: null prototype],
_eventsCount: 1,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: [Object],
requests: {},
sockets: [Object],
freeSockets: {},
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
maxCachedSessions: 100,
_sessionCache: [Object]
},
_started: true,
href: 'https://test-insight.bitpay.com/api/addrs/utxo',
req: ClientRequest {
_events: [Object: null prototype],
_eventsCount: 5,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [TLSSocket],
connection: [TLSSocket],
_header: 'POST /api/addrs/utxo HTTP/1.1\r\n' +
'host: test-insight.bitpay.com\r\n' +
'accept: application/json\r\n' +
'content-type: application/json\r\n' +
'content-length: 46\r\n' +
'Connection: close\r\n' +
'\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: [Agent],
socketPath: undefined,
method: 'POST',
path: '/api/addrs/utxo',
_ended: true,
res: [Circular],
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
[Symbol(kNeedDrain)]: false,
[Symbol(isCorked)]: false,
[Symbol(kOutHeaders)]: [Object: null prototype]
},
ntick: true,
response: [Circular],
originalHost: 'test-insight.bitpay.com',
originalHostHeaderName: 'host',
responseContent: [Circular],
_destdata: true,
_ended: true,
_callbackCalled: true
},
toJSON: [Function: responseToJSON],
caseless: Caseless {
dict: {
date: 'Fri, 15 May 2020 01:55:00 GMT',
'content-type': 'text/plain; charset=UTF-8',
'content-length': '16',
connection: 'close',
'x-frame-options': 'SAMEORIGIN',
'cache-control': 'private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0',
expires: 'Thu, 01 Jan 1970 00:00:01 GMT',
'set-cookie': [Array],
'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
server: 'cloudflare',
'cf-ray': '59393bf7dfdfc68b-MAD',
'cf-request-id': '02b7a3cee70000c68b46168200000001'
}
},
body: 'error code: 1009'
}

bitcore-explorers is broken

Running from fresh npm gives me this error:

/node_modules/bitcore-explorers/node_modules/bitcore/index.js:12
    throw new Error(message);
    ^

Error: More than one instance of bitcore found with versions: v0.12.15 and v0.13.10. 
Please make sure to require bitcore and check that submodules do not also include 
their own bitcore dependency.

I think it has to do with the bitcore name change to bitcore-lib
EDIT: It looks like the npm package isn't up to date. Master is 1.0.1 and npm is still at 0.11.0

explorer api url not compatible with latest installation of insight-api

Hi there,

I installed the insight api on our own node as per your instructions here:
https://github.com/bitpay/insight-api/tree/v0.3.0
The api and insight are both up and running on our nodes, so all good there, but when I try and get address info or unspents like so:
var testExplorer = new Insight(testConfig.testServer1.url, Networks.testnet);
testExplorer.getUnspentUtxos(testConfig.address2.address, function(e, utxos) { ...

I got 404 errors, this is because the url part on the requests is simply /api/[rest of query] - as can be seen here: https://github.com/bitpay/bitcore-explorers/blob/master/lib/insight.js#L64

the path is actually /insight-api/[rest of query] - this is the insight-api default, on fixing this my unit tests all passed.

Is this an issue - or have I set insight-api up incorrectly?

getUnspentUtxos is returning no result..

i have 2 utxos on my address with $20 and $25 amounts, then i spent $30 using that address and it uses the 2 utxos, transaction goes well(but still unconfirmed) but when i get the utxos using the bitcore-explorers getUnspentUtxos( ) it returns no result.. i also use the bitcore playground to get the uxtos of my address it returns none also... but when the transaction was CONFIRMED.. the amount that should be remaining on my address was there now, and the bitcore-explorers getUnspentUtxos( ) is returning result..

but then i tried it on single utxo with $50 amount and spend $10 and get the utxo after the transaction using bitcore-explorers getUnspentUtxos( ) and it returns result..

so the issue is, if an address has multiple utxos and if all utxos of the address was used in transaction, the supposed to be change output( change utxo ) is not being returned by getUnspentUtxos( ) until the transaction is CONFIRMED..

but this issue is not occuring when the address has single(1) utxo and was use in transaction.

also this issue is not occuring if there's a utxo that was not used in transaction..
like address have 3 utxos and only 2 was used..

any idea what cause this?

Thank you.

Convey information about network confirmations when calling getUnspentUtxos

When querying for unspent transactions, one key information to be presented is how old it is. The getUnspentUtxos method from the Insight class returns an array of UnspentOutput objects.

The problem with this approach is that the important time information is capped from the raw HTTP response. Since the UnspentOutput object only have immutable fields the "timestamp" and "confirmation" attributes from the original response are left out when doing this:

unspent = _.map(unspent, UnspentOutput);

I see two ways to improve this method. We either add the "timestamp" and "confirmation" attributes to the UnspentOutput, or the getUnspentUtxos gets a new optional boolean parameter that when set to true will return the raw HTTP response. The former method will return a more complete version of the UsnpentOutput object. I don't see how this could break existing code. The latter will allow the caller to access these information without having to touch the UnspentOutput definition.

This would work like this:

Insight.prototype.getUnspentUtxos = function(addresses, raw, callback) {
  if(typeof(raw) == 'function'){
    callaback = raw
  }
  ...
  if(!raw || typeof(raw) == 'function')
    unspent = _.map(unspent, UnspentOutput);
}

This way we don't break anything that already uses this format of the API passing the callback as the second argument. And also provide a way to return the raw response if needed.

I'll be happy to submit a pull request with either modifications. But would like some opinions first.

Best regards
Nelson

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.