• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..13-May-2020-

README.mdH A D13-May-20203.3 KiB7460

doc.goH A D13-May-20207.1 KiB1511

example_test.goH A D13-May-20203.3 KiB11372

export_test.goH A D13-May-2020620 194

log.goH A D13-May-20206.2 KiB228137

mruinvmap.goH A D13-May-20203.4 KiB12874

mruinvmap_test.goH A D13-May-20205.3 KiB171109

mrunoncemap.goH A D13-May-20203.3 KiB12673

mrunoncemap_test.goH A D13-May-20204.5 KiB15396

peer.goH A D13-May-202067.8 KiB2,2811,319

peer_test.goH A D13-May-202023.3 KiB924789

README.md

1peer
2====
3
4[![Build Status](http://img.shields.io/travis/btcsuite/btcd.svg)](https://travis-ci.org/btcsuite/btcd)
5[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
6[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/btcsuite/btcd/peer)
7
8Package peer provides a common base for creating and managing bitcoin network
9peers.
10
11This package has intentionally been designed so it can be used as a standalone
12package for any projects needing a full featured bitcoin peer base to build on.
13
14## Overview
15
16This package builds upon the wire package, which provides the fundamental
17primitives necessary to speak the bitcoin wire protocol, in order to simplify
18the process of creating fully functional peers.  In essence, it provides a
19common base for creating concurrent safe fully validating nodes, Simplified
20Payment Verification (SPV) nodes, proxies, etc.
21
22A quick overview of the major features peer provides are as follows:
23
24 - Provides a basic concurrent safe bitcoin peer for handling bitcoin
25   communications via the peer-to-peer protocol
26 - Full duplex reading and writing of bitcoin protocol messages
27 - Automatic handling of the initial handshake process including protocol
28   version negotiation
29 - Asynchronous message queueing of outbound messages with optional channel for
30   notification when the message is actually sent
31 - Flexible peer configuration
32   - Caller is responsible for creating outgoing connections and listening for
33     incoming connections so they have flexibility to establish connections as
34     they see fit (proxies, etc)
35   - User agent name and version
36   - Bitcoin network
37   - Service support signalling (full nodes, bloom filters, etc)
38   - Maximum supported protocol version
39   - Ability to register callbacks for handling bitcoin protocol messages
40 - Inventory message batching and send trickling with known inventory detection
41   and avoidance
42 - Automatic periodic keep-alive pinging and pong responses
43 - Random nonce generation and self connection detection
44 - Proper handling of bloom filter related commands when the caller does not
45   specify the related flag to signal support
46   - Disconnects the peer when the protocol version is high enough
47   - Does not invoke the related callbacks for older protocol versions
48 - Snapshottable peer statistics such as the total number of bytes read and
49   written, the remote address, user agent, and negotiated protocol version
50 - Helper functions pushing addresses, getblocks, getheaders, and reject
51   messages
52   - These could all be sent manually via the standard message output function,
53     but the helpers provide additional nice functionality such as duplicate
54     filtering and address randomization
55 - Ability to wait for shutdown/disconnect
56 - Comprehensive test coverage
57
58## Installation and Updating
59
60```bash
61$ go get -u github.com/btcsuite/btcd/peer
62```
63
64## Examples
65
66* [New Outbound Peer Example](https://godoc.org/github.com/btcsuite/btcd/peer#example-package--NewOutboundPeer)
67  Demonstrates the basic process for initializing and creating an outbound peer.
68  Peers negotiate by exchanging version and verack messages.  For demonstration,
69  a simple handler for the version message is attached to the peer.
70
71## License
72
73Package peer is licensed under the [copyfree](http://copyfree.org) ISC License.
74