flocore-p2p/docs/index.md
2015-03-17 22:03:55 -04:00

1.1 KiB

title description
Peer-to-Peer Networking Peer-to-Peer Networking Capabilities for Bitcore

Peer-to-Peer

Description

The bitcore-p2p module provides peer-to-peer networking capabilites for Bitcore, and includes Peer and Pool classes. A Message class is also exposed, in addition to several types of messages. Pool will maintain connection to several peers, Peers represents a node in the bitcoin network, and Message represents data sent to and from a Peer. For detailed technical information about the bitcoin protocol, please visit the Protocol Specification on the Bitcoin Wiki.

Installation

Peer-to-peer is implemented as a seperate module.

For node projects:

npm install bitcore-p2p --save

Quick Start

var Peer = require('bitcore-p2p').Peer;
var peer = new Peer({host: '5.9.85.34'});

// handle events
peer.on('inv', function(message) {
  // message.inventory[]
});

peer.connect();