You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
600 B
26 lines
600 B
|
|
// Replace path '..' to 'bitcore' if you are using this example
|
|
// in a different project
|
|
var networks = require('../networks');
|
|
var Peer = require('../Peer').class();
|
|
var PeerManager = require('../PeerManager').createClass({
|
|
network: networks.testnet
|
|
});
|
|
|
|
|
|
var handleBlock = function(b) {
|
|
console.log('block received:', b);
|
|
};
|
|
|
|
var handleTx = function(b) {
|
|
console.log('block tx:', b);
|
|
};
|
|
|
|
var peerman = new PeerManager();
|
|
peerman.addPeer( new Peer('127.0.0.1',18333) );
|
|
peerman.on('connect', function(conn) {
|
|
conn.on('block', handleBlock);
|
|
conn.on('tx', handleTx);
|
|
});
|
|
peerman.start();
|
|
|
|
|