github.com/lbryio/lbcd@v0.22.119/peer/README.md (about) 1 peer 2 ==== 3 4 [![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org) 5 6 Package peer provides a common base for creating and managing bitcoin network 7 peers. 8 9 ## Overview 10 11 This package builds upon the wire package, which provides the fundamental 12 primitives necessary to speak the bitcoin wire protocol, in order to simplify 13 the process of creating fully functional peers. In essence, it provides a 14 common base for creating concurrent safe fully validating nodes, Simplified 15 Payment Verification (SPV) nodes, proxies, etc. 16 17 A quick overview of the major features peer provides are as follows: 18 19 - Provides a basic concurrent safe bitcoin peer for handling bitcoin 20 communications via the peer-to-peer protocol 21 - Full duplex reading and writing of bitcoin protocol messages 22 - Automatic handling of the initial handshake process including protocol 23 version negotiation 24 - Asynchronous message queueing of outbound messages with optional channel for 25 notification when the message is actually sent 26 - Flexible peer configuration 27 - Caller is responsible for creating outgoing connections and listening for 28 incoming connections so they have flexibility to establish connections as 29 they see fit (proxies, etc) 30 - User agent name and version 31 - Bitcoin network 32 - Service support signalling (full nodes, bloom filters, etc) 33 - Maximum supported protocol version 34 - Ability to register callbacks for handling bitcoin protocol messages 35 - Inventory message batching and send trickling with known inventory detection 36 and avoidance 37 - Automatic periodic keep-alive pinging and pong responses 38 - Random nonce generation and self connection detection 39 - Proper handling of bloom filter related commands when the caller does not 40 specify the related flag to signal support 41 - Disconnects the peer when the protocol version is high enough 42 - Does not invoke the related callbacks for older protocol versions 43 - Snapshottable peer statistics such as the total number of bytes read and 44 written, the remote address, user agent, and negotiated protocol version 45 - Helper functions pushing addresses, getblocks, getheaders, and reject 46 messages 47 - These could all be sent manually via the standard message output function, 48 but the helpers provide additional nice functionality such as duplicate 49 filtering and address randomization 50 - Ability to wait for shutdown/disconnect 51 - Comprehensive test coverage 52