Safe Haskell | None |
---|---|
Language | Haskell98 |
Load the blockchain from the files downloaded by the Satoshi client (bitcoin-qt)
- data BlockLocation = BlockLocation {}
- blockDirectory :: IO FilePath
- blockFiles :: FilePath -> IO [FilePath]
- loadAllHeaders_ :: IO [BlockHeader]
- loadAllHeaders :: IO [(BlockLocation, BlockHeader)]
- loadAllHeaders' :: FilePath -> IO [(BlockLocation, BlockHeader)]
- loadAllBlocks_ :: IO [Block (Tx RawScript RawScript)]
- loadAllBlocks :: IO [(BlockLocation, Block (Tx RawScript RawScript))]
- loadAllBlocks' :: FilePath -> IO [(BlockLocation, Block (Tx RawScript RawScript))]
- loadBlockAt :: BlockLocation -> IO (Block (Tx RawScript RawScript))
- loadAllTxs_ :: IO [Tx RawScript RawScript]
- loadAllTxs :: IO [(BlockLocation, [Tx RawScript RawScript])]
- loadAllTxs' :: FilePath -> IO [(BlockLocation, [Tx RawScript RawScript])]
Documentation
data BlockLocation Source #
A file and a position within the file, pointing to the magic bytes of a block
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