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

Safe HaskellNone
LanguageHaskell98

Bitcoin.BlockChain.Load

Contents

Description

Load the blockchain from the files downloaded by the Satoshi client (bitcoin-qt)

Synopsis

Documentation

where to find the blocks

blockDirectory :: IO FilePath Source #

Guess where the blocks are on the harddisk (as downloaded by the Satoshi client)

blockFiles :: FilePath -> IO [FilePath] Source #

Given the directory containing the blocks (blk000xx.dat), we return the list of the block files (full paths)

For example on windows the directory is

C:/Users/<username>/Application Data/Bitcoin/blocks/

load block headers

loadAllHeaders_ :: IO [BlockHeader] Source #

Loads all block headers lazily.

Note: this will also load the out-of-longest-chain blocks' headers

loadAllHeaders :: IO [(BlockLocation, BlockHeader)] Source #

Loads all block headers lazily.

loadAllHeaders' :: FilePath -> IO [(BlockLocation, BlockHeader)] Source #

The argument is the block directory

load blocks

loadAllBlocks_ :: IO [Block (Tx RawScript RawScript)] Source #

Lazily loads all blocks. Note 1: all blocks won't fit the memory, so you must process this lazy stream immediately and let the GC free the old blocks.

Note 2: this will also load the out-of-longest-chain blocks

loadAllBlocks :: IO [(BlockLocation, Block (Tx RawScript RawScript))] Source #

This version also returns the block file and the position within the file

loadAllBlocks' :: FilePath -> IO [(BlockLocation, Block (Tx RawScript RawScript))] Source #

The argument is the block directory

loadBlockAt :: BlockLocation -> IO (Block (Tx RawScript RawScript)) Source #

Tries to load a block from a file at the given position

load transactions

loadAllTxs_ :: IO [Tx RawScript RawScript] Source #

Lazily loads all transactions. Note 1: these won't fit the memory, so you must process this lazy stream immediately and let the GC free the old blocks.

Note 2: this will also load the out-of-longest-chain blocks

loadAllTxs :: IO [(BlockLocation, [Tx RawScript RawScript])] Source #

With this function, the list transactions are partitioned by blocks, and the file and file position containing the block is also returned

loadAllTxs' :: FilePath -> IO [(BlockLocation, [Tx RawScript RawScript])] Source #

The argument is the block directory