network-bitcoin-1.9.1: An interface to bitcoind.

Safe HaskellNone
LanguageHaskell98

Network.Bitcoin.BlockChain

Description

An interface to bitcoind's available block-chain-related RPC calls. The implementation of these functions can be found at https://github.com/bitcoin/bitcoin/blob/master/src/rpcblockchain.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.

type TransactionID = HexString Source #

A hexadecimal string representation of a 256-bit unsigned integer.

This integer is a unique transaction identifier.

type BTC = Fixed Satoshi Source #

The type of bitcoin money, represented with a fixed-point number.

getBlockCount :: Client -> IO BlockHeight Source #

Returns the number of blocks in the longest block chain.

getDifficulty :: Client -> IO Integer Source #

Returns the proof-of-work difficulty as a multiple of the minimum difficulty.

setTransactionFee :: Client -> BTC -> IO () Source #

Sets the transaction fee will will pay to the network. Values of 0 are rejected.

getRawMemoryPool :: Client -> IO (Vector TransactionID) Source #

Returns all transaction identifiers in the memory pool.

type BlockHash = HexString Source #

The hash of a given block.

getBlockHash Source #

Arguments

:: Client 
-> BlockHeight

Block index.

-> IO BlockHash 

Returns the hash of the block in best-block-chain at the given index.

data Block Source #

Information about a given block in the block chain.

Constructors

Block 

Fields

Instances
Eq Block Source # 
Instance details

Defined in Network.Bitcoin.BlockChain

Methods

(==) :: Block -> Block -> Bool #

(/=) :: Block -> Block -> Bool #

Ord Block Source # 
Instance details

Defined in Network.Bitcoin.BlockChain

Methods

compare :: Block -> Block -> Ordering #

(<) :: Block -> Block -> Bool #

(<=) :: Block -> Block -> Bool #

(>) :: Block -> Block -> Bool #

(>=) :: Block -> Block -> Bool #

max :: Block -> Block -> Block #

min :: Block -> Block -> Block #

Read Block Source # 
Instance details

Defined in Network.Bitcoin.BlockChain

Show Block Source # 
Instance details

Defined in Network.Bitcoin.BlockChain

Methods

showsPrec :: Int -> Block -> ShowS #

show :: Block -> String #

showList :: [Block] -> ShowS #

FromJSON Block Source # 
Instance details

Defined in Network.Bitcoin.BlockChain

getBlock :: Client -> BlockHash -> IO Block Source #

Returns details of a block with given block-hash.

data OutputSetInfo Source #

Information on the unspent transaction in the output set.

Constructors

OutputSetInfo 

Fields

getOutputSetInfo :: Client -> IO OutputSetInfo Source #

Returns statistics about the unspent transaction output set.

data OutputInfo Source #

Details about an unspent transaction output.

Constructors

OutputInfo 

Fields

getOutputInfo Source #

Arguments

:: Client 
-> TransactionID 
-> Integer

The index we're looking at.

-> IO (Maybe OutputInfo) 

Returns details about an unspent transaction output.