Safe Haskell | None |
---|---|
Language | Haskell98 |
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
- type Client = ByteString -> IO ByteString
- type TransactionID = HexString
- type BTC = Fixed Satoshi
- getBlockCount :: Client -> IO BlockHeight
- getDifficulty :: Client -> IO Integer
- setTransactionFee :: Client -> BTC -> IO ()
- getRawMemoryPool :: Client -> IO (Vector TransactionID)
- type BlockHash = HexString
- type BlockHeight = Integer
- getBlockHash :: Client -> BlockHeight -> IO BlockHash
- data Block = Block {
- blockHash :: BlockHash
- blkConfirmations :: Integer
- blkSize :: Integer
- blkHeight :: BlockHeight
- blkVersion :: Integer
- merkleRoot :: BlockHash
- subTransactions :: Vector TransactionID
- blkTime :: Integer
- blkNonce :: Integer
- blkBits :: HexString
- blkDifficulty :: Double
- nextBlock :: Maybe BlockHash
- prevBlock :: Maybe BlockHash
- getBlock :: Client -> BlockHash -> IO Block
- data OutputSetInfo = OutputSetInfo {}
- getOutputSetInfo :: Client -> IO OutputSetInfo
- data OutputInfo = OutputInfo {}
- getOutputInfo :: Client -> TransactionID -> Integer -> IO (Maybe OutputInfo)
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.
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 BlockHeight = Integer Source #
Arguments
:: Client | |
-> BlockHeight | Block index. |
-> IO BlockHash |
Returns the hash of the block in best-block-chain at the given index.
Information about a given block in the block chain.
Constructors
Block | |
Fields
|
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
|
Instances
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
|
Instances
Eq OutputInfo Source # | |
Defined in Network.Bitcoin.BlockChain | |
Ord OutputInfo Source # | |
Defined in Network.Bitcoin.BlockChain Methods compare :: OutputInfo -> OutputInfo -> Ordering # (<) :: OutputInfo -> OutputInfo -> Bool # (<=) :: OutputInfo -> OutputInfo -> Bool # (>) :: OutputInfo -> OutputInfo -> Bool # (>=) :: OutputInfo -> OutputInfo -> Bool # max :: OutputInfo -> OutputInfo -> OutputInfo # min :: OutputInfo -> OutputInfo -> OutputInfo # | |
Read OutputInfo Source # | |
Defined in Network.Bitcoin.BlockChain Methods readsPrec :: Int -> ReadS OutputInfo # readList :: ReadS [OutputInfo] # readPrec :: ReadPrec OutputInfo # readListPrec :: ReadPrec [OutputInfo] # | |
Show OutputInfo Source # | |
Defined in Network.Bitcoin.BlockChain Methods showsPrec :: Int -> OutputInfo -> ShowS # show :: OutputInfo -> String # showList :: [OutputInfo] -> ShowS # | |
FromJSON OutputInfo Source # | |
Defined in Network.Bitcoin.BlockChain |
Arguments
:: Client | |
-> TransactionID | |
-> Integer | The index we're looking at. |
-> IO (Maybe OutputInfo) |
Returns details about an unspent transaction output.