network-bitcoin-1.7.0: An interface to bitcoind.

Safe HaskellNone
LanguageHaskell98

Network.Bitcoin.Net

Description

An interface to bitcoind's available network-related RPC calls. The implementation of these functions can be found at https://github.com/bitcoin/bitcoin/blob/master/src/rpcnet.cpp.

If any APIs are missing, patches are always welcome. If you look at the source of this module, you'll see that the interface code is trivial.

Synopsis

Documentation

type Client = ByteString -> IO ByteString Source

Client describes authentication credentials and host info for making API requests to the Bitcoin daemon.

getClient :: String -> ByteString -> ByteString -> IO Client Source

getClient takes a url, rpc username, and rpc password and returns a Client that can be used to make API calls. Each Client encloses a Manager (from http-client) that re-uses connections for requests, so long as the same Client is is used for each call.

getConnectionCount :: Client -> IO Integer Source

Returns the number of connections to other nodes.

data PeerInfo Source

Information about a peer node of the Bitcoin network.

The documentation for this data structure is incomplete, as I honestly don't know what some of these fields are for. Patches are welcome!

Constructors

PeerInfo 

Fields

addressName :: Text

The IP:port of this peer, as a string.

services :: Text
 
lastSend :: Integer

Relative to the first time we conected with this peer (and in milliseconds), the last time we sent this peer any data.

lastRecv :: Integer

Relative to the first time we connected with this peer (and in milliseconds), the last time we sent this peer any data.

bytesSent :: Integer
 
bytesRecv :: Integer
 
connectionTime :: Integer

How long have we been connected to this peer (in milliseconds).

peerVersion :: Integer

The version of the Bitcion client the peer is running.

peerSubversion :: Text

The sub-version of the Bitcoin client the peer is running.

inbound :: Bool
 
startingHeight :: Integer
 
banScore :: Integer

How many times has this peer behaved badly?

getPeerInfo :: Client -> IO [PeerInfo] Source

Returns data about all connected peer nodes.