bitcoin-hs-0.0.1: Partial implementation of the Bitcoin protocol (as of 2013)

Safe HaskellNone
LanguageHaskell98

Bitcoin.BlockChain.Chain

Contents

Description

In-memory cache for blockchain metadata

Synopsis

blockchain

data Chain Source #

The block-chain as an (inverted) tree.

Note: The Ord instance compares the block hash (it defined only for internal reasons)

Constructors

Chain 

Fields

Instances

Eq Chain Source # 

Methods

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

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

Ord Chain Source # 

Methods

compare :: Chain -> Chain -> Ordering #

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

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

(>) :: Chain -> Chain -> Bool #

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

max :: Chain -> Chain -> Chain #

min :: Chain -> Chain -> Chain #

Show Chain Source # 

Methods

showsPrec :: Int -> Chain -> ShowS #

show :: Chain -> String #

showList :: [Chain] -> ShowS #

building the chain and related metadata

data ChainTable Source #

BlockChain metadata

Constructors

ChainTable 

Fields

buildChainTable' :: FilePath -> IO ChainTable Source #

The argument is the block directory

conveniance functions

forAllBlocks_ :: ChainTable -> (Int -> Block (Tx RawScript RawScript) -> IO ()) -> IO () Source #

Calls a user action for all blocks in the longest chain. The Int is the block height (with the genesis block having height zero).

misc helper functions (to be moved to some Misc.XXX modules)

buildMap :: Ord k => (b -> a) -> (b -> a -> a) -> [(k, b)] -> Map k a Source #

sortNub :: Ord a => [a] -> [a] Source #

setNub :: Ord a => [a] -> [a] Source #

forceList_ :: [a] -> () Source #

unfoldr' :: (b -> Maybe (a, b)) -> b -> [a] Source #