Hi.
I can successfully request utxos in mainnet with:
bitcoin-cli -rpcport=8332 -rpcuser=xxxx -rpcpassword=xxxx scantxoutset start '["addr(bc1qnffp2jccqnwjwymkheqkkkrgdhslxyg3wpu0rq)"]'
But
const Client = require('bitcoin-core')
let btcNode = new Client( { host, username, password, port, timeout: 30000 } )
const address = { _id: 'bc1qnffp2jccqnwjwymkheqkkkrgdhslxyg3wpu0rq', ...}
const utxos = await btcNode.command('scantxoutset', 'start', [`addr(${address._id})`])
fails in mainnet (ok in testnet) with
OperationalError: ESOCKETTIMEDOUT
at ClientRequest.<anonymous> (/graphql/node_modules/request/request.js:816:19)
at Object.onceWrapper (events.js:421:28)
at ClientRequest.emit (events.js:315:20)
at ClientRequest.EventEmitter.emit (domain.js:485:12)
at Socket.emitRequestTimeout (_http_client.js:717:9)
at Object.onceWrapper (events.js:421:28)
at Socket.emit (events.js:327:22)
at Socket.EventEmitter.emit (domain.js:485:12)
at Socket._onTimeout (net.js:481:8)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7) {
cause: Error: ESOCKETTIMEDOUT
at ClientRequest.<anonymous> (/graphql/node_modules/request/request.js:816:19)
at Object.onceWrapper (events.js:421:28)
at ClientRequest.emit (events.js:315:20)
at ClientRequest.EventEmitter.emit (domain.js:485:12)
at Socket.emitRequestTimeout (_http_client.js:717:9)
at Object.onceWrapper (events.js:421:28)
at Socket.emit (events.js:327:22)
at Socket.EventEmitter.emit (domain.js:485:12)
at Socket._onTimeout (net.js:481:8)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7) {
code: 'ESOCKETTIMEDOUT',
connect: false
},
isOperational: true,
code: 'ESOCKETTIMEDOUT',
connect: false
}
Other commands like btcNode.sendRawTransaction estimateSmartFee getBlockByHash works ok.
Thanks.
update: in the server I opened a single btcNode connection that I reuse all the time.