I have a devnet and a few nodes I'm running on my local machine. However, whenever I try to run "node dashConnectDevnet.js", I get the error, even though devnet is running.
the error
node1.conf
node2.conf
dashConnectDevnet.js:
the error
(node:101695) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Something went wrong:
ResponseError: request to http://127.0.0.1:20000/ failed, reason: socket hang up
at JsonRpcTransport.createJsonTransportError (/home/antun_daily/node_modules/@dashevo/dapi-client/lib/transport/JsonRpcTransport/createJsonTransportError.js:50:12)
at JsonRpcTransport.request (/home/antun_daily/node_modules/@dashevo/dapi-client/lib/transport/JsonRpcTransport/JsonRpcTransport.js:93:34)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async connect (/home/antun_daily/Faks/Zavrsni/DashConfDocs/dashConnectDevnet.js:10:10) {
code: 'ECONNRESET',
data: {},
dapiAddress: DAPIAddress {
protocol: 'http',
host: '127.0.0.1',
port: 20000,
proRegTxHash: undefined,
allowSelfSignedCertificate: false,
banCount: 0,
banStartTime: undefined
}
}
node1.conf
devnet=dashblog
[devnet]
port=20000
rpcport=20001
listen=1
bind=127.0.0.1
rpcuser=user1
rpcpassword=mypassword
sporkaddr=yZDB9spysPHJcRRUiWCja1XLYen6vmG1h5
sporkkey=cN6ovAu2nmabH8mVRH8RJFU13HNPhDhYsfGdFJxaSFnqpKTiNyNS
datadir=/home/antun_daily/Faks/Zavrsni/DashConfDocs/node1
highsubsidyblocks=500
highsubsidyfactor=10
node2.conf
devnet=dashblog
[devnet]
port=20002
rpcport=20003
listen=1
bind=127.0.0.1
addnode=127.0.0.1:20000
rpcuser=user2
rpcpassword=mypassword
sporkaddr=yZDB9spysPHJcRRUiWCja1XLYen6vmG1h5
sporkkey=cN6ovAu2nmabH8mVRH8RJFU13HNPhDhYsfGdFJxaSFnqpKTiNyNS
datadir=/home/antun_daily/Faks/Zavrsni/DashConfDocs/node2
highsubsidyblocks=500
highsubsidyfactor=10
dashConnectDevnet.js:
const Dash = require('dash');
const client = new Dash.Client({
dapiAddresses: [
{ host: '127.0.0.1', port: 20000, protocol: 'http' },
{ host: '127.0.0.1', port: 20002, protocol: 'http' },
],
});
async function connect() {
return await client.getDAPIClient().core.getBestBlockHash();
}
connect()
.then((d) => console.log('Connected. Best block hash:\n', d))
.catch((e) => console.error('Something went wrong:\n', e))
.finally(() => client.disconnect());