Created
March 2, 2019 13:56
-
-
Save fkfk/7458f236d05ffbdd01d4883e9f45548a to your computer and use it in GitHub Desktop.
connect ElectrumX server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Socket = require('json-rpc-tls').Socket; | |
Socket.tlsSocket('electrum-mona.nope.work', 50002, { | |
rejectUnauthorized: false | |
}).then(async (socket) => { | |
socket.setEncoding('utf8') | |
socket.setKeepAlive(true, 0) | |
socket.setNoDelay(true) | |
const banner = await Socket.request(socket, 1, 'server.banner', []) | |
console.log(JSON.parse(banner)) | |
const peers = await Socket.request(socket, 1, 'server.peers.subscribe', []) | |
console.log(JSON.parse(peers).result) | |
Socket.close(socket) | |
}) | |
.catch((e) => { | |
console.log(e.error) | |
Socket.close(e.socket) | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "electrumx_watcher", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"json-rpc-tls": "^1.2.2" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ jsonrpc: '2.0', | |
result: 'You are connected to an ElectrumX 1.9.5 server.', | |
id: 1 } | |
[ [ '118.27.24.246', | |
'electrum-mona.nope.work', | |
[ 'v1.4.1', 's50002', 't50001' ] ], | |
[ '104.199.210.24', | |
'electrumx2.movsign.info', | |
[ 'v1.2', 's50002', 't50001' ] ], | |
[ '153.126.146.182', | |
'electrumx.tamami-foundation.org', | |
[ 'v1.4.1', 's50002', 't50001' ] ], | |
[ '51.15.98.23', | |
'electrumx2.monacoin.nl', | |
[ 'v1.4.1', 's50002', 't50001' ] ], | |
[ '51.15.43.235', | |
'electrumx3.monacoin.nl', | |
[ 'v1.4.1', 's50002', 't50001' ] ], | |
[ '52.199.222.97', | |
'electrum-mona.bitbank.cc', | |
[ 'v1.2', 's50002', 't50001' ] ], | |
[ '163.172.170.178', | |
'electrumx2.tamami-foundation.org', | |
[ 'v1.4.1', 's50002', 't50001' ] ] ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment