Hi.
I can successfully request utxos in mainnet with:
bitcoin-cli -rpcport=8332 -rpcuser=xxxx -rpcpassword=xxxx scantxoutset start '["addr(bc1qnffp2jccqnwjwymkheqkkkrgdhslxyg3wpu0rq)"]'
But
0const Client = require('bitcoin-core')
1let btcNode = new Client( { host, username, password, port, timeout: 30000 } )
2const address = { _id: 'bc1qnffp2jccqnwjwymkheqkkkrgdhslxyg3wpu0rq', ...}
3const utxos = await btcNode.command('scantxoutset', 'start', [`addr(${address._id})`])
fails in mainnet (ok in testnet) with
0OperationalError: ESOCKETTIMEDOUT
1 at ClientRequest.<anonymous> (/graphql/node_modules/request/request.js:816:19)
2 at Object.onceWrapper (events.js:421:28)
3 at ClientRequest.emit (events.js:315:20)
4 at ClientRequest.EventEmitter.emit (domain.js:485:12)
5 at Socket.emitRequestTimeout (_http_client.js:717:9)
6 at Object.onceWrapper (events.js:421:28)
7 at Socket.emit (events.js:327:22)
8 at Socket.EventEmitter.emit (domain.js:485:12)
9 at Socket._onTimeout (net.js:481:8)
10 at listOnTimeout (internal/timers.js:549:17)
11 at processTimers (internal/timers.js:492:7) {
12 cause: Error: ESOCKETTIMEDOUT
13 at ClientRequest.<anonymous> (/graphql/node_modules/request/request.js:816:19)
14 at Object.onceWrapper (events.js:421:28)
15 at ClientRequest.emit (events.js:315:20)
16 at ClientRequest.EventEmitter.emit (domain.js:485:12)
17 at Socket.emitRequestTimeout (_http_client.js:717:9)
18 at Object.onceWrapper (events.js:421:28)
19 at Socket.emit (events.js:327:22)
20 at Socket.EventEmitter.emit (domain.js:485:12)
21 at Socket._onTimeout (net.js:481:8)
22 at listOnTimeout (internal/timers.js:549:17)
23 at processTimers (internal/timers.js:492:7) {
24 code: 'ESOCKETTIMEDOUT',
25 connect: false
26 },
27 isOperational: true,
28 code: 'ESOCKETTIMEDOUT',
29 connect: false
30}
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.