bitpay / bitcore-p2p

Interface to the bitcoin P2P network for bitcore
MIT License
79 stars 275 forks source link

Error "connect ETIMEDOUT 5.9.85.34:8333" #95

Closed HungNguyen007 closed 6 years ago

HungNguyen007 commented 7 years ago

Hello,

I got error "connect ETIMEDOUT 5.9.85.34:8333" during running the following snippet with NodeJS

var Peer = require('bitcore-p2p').Peer;

var peer = new Peer({host: '5.9.85.34'});

peer.on('ready', function() {
  // peer info
  console.log(peer.version, peer.subversion, peer.bestHeight);
});

peer.on('disconnect', function() {
  console.log('connection closed');
});

peer.connect();

My steps:

  1. Copy the above snippet to MyTest.js
  2. Run node myTest.js
  3. Console prompt return "connect ETIMEDOUT 5.9.85.34:8333"

Could you please show me how make my snippet working? I don't run any Bitcoin full node on my local PC.

Thank you.

HungNguyen007 commented 6 years ago

The problem come from IP address 5.9.85.34 is not in the peer list of Mainnet and testnet. I have used dig seed.bitcoin.sipa.be any to achieve IP addresses of full Node or dig A seed.tbtc.petertodd.org to get IP address of testnet.

Ex: Using var peer = new Peer({host: 51.15.9.224'});