I'm trying to figure out how to connect my NodeJS app to a remote monero node. I need it to query the network.
Here's is the list of available JSON-RPC methods — Daemon RPC documentation
Here's the list of open nodes — https://moneroworld.com/
Here's what I do:
const rpc = require('json-rpc-client')
const host = 'node.moneroworld.com'
const port = '18089'
const client = new rpc({ host, port })
client.connect()
.then(() => {
console.log('Connected')
})
.catch(error => {
console.log(error)
})
Here's the error:
{ host: 'node.moneroworld.com', port: '18089' }
error:Error: getaddrinfo ENOTFOUND node.moneroworld.com node.moneroworld.com:18089
{ Error: getaddrinfo ENOTFOUND node.moneroworld.com node.moneroworld.com:18089
at errnoException (dns.js:28:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:73:26)
code: 'ENOTFOUND',
errno: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'node.moneroworld.com',
host: 'node.moneroworld.com',
port: '18089' }
When I use another host:
const host = 'node.xmrbackb.one'
const port = '18081'
I get:
{ host: 'node.xmrbackb.one', port: '18081' }
error:Error: connect ETIMEDOUT 116.93.119.79:18081
{ Error: connect ETIMEDOUT 116.93.119.79:18081
at Object.exports._errnoException (util.js:1034:11)
at exports._exceptionWithHostPort (util.js:1057:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1096:14)
code: 'ETIMEDOUT',
errno: 'ETIMEDOUT',
syscall: 'connect',
address: '116.93.119.79',
port: 18081 }
I can't event connect to a node. What am I missing?