-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | An interface to bitcoind. -- @package network-bitcoin @version 1.7.2 -- | Contains the common types used through bitcoin RPC calls, that aren't -- specific to a single submodule. module Network.Bitcoin.Types -- | Client describes authentication credentials and host info for -- making API requests to the Bitcoin daemon. type Client = ByteString -> IO ByteString -- | A BitcoinException is thrown when 'callApi encounters an error. -- The API error code is represented as an Int, the message as a -- String. -- -- It may also be thrown when the value returned by the bitcoin API -- wasn't what we expected. -- -- WARNING: Any of the functions in this module's public API may throw -- this exception. You should plan on handling it. data BitcoinException -- | A BitcoinApiError has an error code error message, as returned -- by bitcoind's JSON-RPC response. BitcoinApiError :: Int -> Text -> BitcoinException -- | The raw JSON returned, if we can't figure out what actually went -- wrong. BitcoinResultTypeError :: ByteString -> BitcoinException -- | A string returned by the bitcoind API, representing data as hex. -- -- What that data represents depends on the API call, but should be -- dcumented accordingly. type HexString = Text -- | A hexadecimal string representation of a 256-bit unsigned integer. -- -- This integer is a unique transaction identifier. type TransactionID = HexString -- | A satoshi is the smallest subdivision of bitcoins. For the resolution, -- use resolution from Fixed. data Satoshi Satoshi :: Satoshi -- | The type of bitcoin money, represented with a fixed-point number. type BTC = Fixed Satoshi -- | An account on the wallet is just a label to easily specify private -- keys. -- -- The default account is an empty string. type Account = Text -- | An address for sending or receiving money. type Address = HexString instance Typeable BitcoinException instance Show BitcoinException instance Read BitcoinException instance Ord BitcoinException instance Eq BitcoinException instance HasResolution Satoshi instance Exception BitcoinException -- | The API exposed in this module should be considered unstable, and is -- subject to change between minor revisions. -- -- If the version number is a.b.c.d, and either a or b changes, then the -- module's whole API may have changed (if only b changes, then it was -- probably a minor change). -- -- If c changed, then only the internal API may change. The rest of the -- module is guaranteed to be stable. -- -- If only d changes, then there were no user-facing code changes made. module Network.Bitcoin.Internal -- | A space efficient, packed, unboxed Unicode text type. data Text :: * -- | Boxed vectors, supporting efficient slicing. data Vector a :: * -> * -- | A type that can be converted from JSON, with the possibility of -- failure. -- -- When writing an instance, use empty, mzero, or -- fail to make a conversion fail, e.g. if an Object is -- missing a required key, or the value is of the wrong type. -- -- An example type and instance: -- -- @{-# LANGUAGE OverloadedStrings #-} -- -- data Coord = Coord { x :: Double, y :: Double } -- -- instance FromJSON Coord where parseJSON (Object v) = Coord -- <$> v .: "x" <*> v .: -- "y" -- -- -- A non-Object value is of the wrong type, so use -- mzero to fail. parseJSON _ = mzero @ -- -- Note the use of the OverloadedStrings language extension -- which enables Text values to be written as string literals. -- -- Instead of manually writing your FromJSON instance, there are -- three options to do it automatically: -- -- -- -- To use this, simply add a deriving Generic clause to -- your datatype and declare a FromJSON instance for your -- datatype without giving a definition for parseJSON. -- -- For example the previous example can be simplified to just: -- -- @{-# LANGUAGE DeriveGeneric #-} -- -- import GHC.Generics -- -- data Coord = Coord { x :: Double, y :: Double } deriving Generic -- -- instance FromJSON Coord @ -- -- Note that, instead of using DefaultSignatures, it's also -- possible to parameterize the generic decoding using -- genericParseJSON applied to your encoding/decoding -- Options: -- --
--   instance FromJSON Coord where
--       parseJSON = genericParseJSON defaultOptions
--   
class FromJSON a parseJSON :: FromJSON a => Value -> Parser a -- | callApi is a low-level interface for making authenticated API -- calls to a Bitcoin daemon. The first argument specifies rpc client -- details (URL, username, password) -- -- The second argument is the command name. The third argument provides -- parameters for the API call. -- --
--   genHash = do
--   
-- -- client <- getClient "http://127.0.0.1:8332" "user" -- "password" callApi client "getblockhash" [tj 0] -- -- On error, throws a BitcoinException. callApi :: FromJSON v => Client -> Text -> [Value] -> IO v -- | getClient takes a url, rpc username, and rpc password and -- returns a Client that can be used to make API calls. Each Client -- encloses a Manager (from http-client) that re-uses connections for -- requests, so long as the same Client is is used for each call. getClient :: String -> ByteString -> ByteString -> IO Client -- | Used to allow "null" to decode to a tuple. data Nil Nil :: () -> Nil unNil :: Nil -> () -- | A handy shortcut for toJSON, because I'm lazy. tj :: ToJSON a => a -> Value tjm :: ToJSON a => a -> Maybe a -> Value tja :: ToJSON a => Maybe a -> [Value] -- | A wrapper for a vector of address:amount pairs. The RPC expects that -- as an object of "address":"amount" pairs, instead of a vector. So -- that's what we give them with AddrAddress's ToJSON. newtype AddrAddress AA :: (Vector (Address, BTC)) -> AddrAddress -- | A response from bitcoind will contain the result of the JSON-RPC call, -- and an error. The error should be null if a valid response was -- received. data BitcoinRpcResponse a BitcoinRpcResponse :: a -> BitcoinRpcError -> BitcoinRpcResponse a btcResult :: BitcoinRpcResponse a -> a btcError :: BitcoinRpcResponse a -> BitcoinRpcError instance Show BitcoinRpcError instance Read BitcoinRpcError instance Ord BitcoinRpcError instance Eq BitcoinRpcError instance Show a => Show (BitcoinRpcResponse a) instance Read a => Read (BitcoinRpcResponse a) instance Ord a => Ord (BitcoinRpcResponse a) instance Eq a => Eq (BitcoinRpcResponse a) instance ToJSON AddrAddress instance FromJSON Nil instance FromJSON a => FromJSON (BitcoinRpcResponse a) instance FromJSON BitcoinRpcError -- | An interface to bitcoind's available private key calls. The -- implementation of these functions can be found at -- https://github.com/bitcoin/bitcoin/blob/master/src/rpcdump.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. module Network.Bitcoin.Dump -- | A textual representation of a bitcoin private key. type PrivateKey = Text -- | Adds a private key (as returned by dumpprivkey) to your wallet. importPrivateKey :: Client -> PrivateKey -> Maybe Account -> IO () -- | Reveals the private key corresponding to the given address. dumpPrivateKey :: Client -> Address -> IO PrivateKey -- | An interface to bitcoind's available mining RPC calls. The -- implementation of these functions can be found at -- https://github.com/bitcoin/bitcoin/blob/master/src/rpcmining.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. -- -- Note that it is highly discouraged to use bitcoind for actual bitcoin -- mining. It uses the CPU for mining, which is much, much less power -- efficient than GPU mining. If you're paying for power, you will not -- come out ahead. -- -- Instead, consider using a GPU miner listed at -- https://en.bitcoin.it/wiki/Software#Mining_apps. module Network.Bitcoin.Mining -- | Client describes authentication credentials and host info for -- making API requests to the Bitcoin daemon. type Client = ByteString -> IO ByteString -- | getClient takes a url, rpc username, and rpc password and -- returns a Client that can be used to make API calls. Each Client -- encloses a Manager (from http-client) that re-uses connections for -- requests, so long as the same Client is is used for each call. getClient :: String -> ByteString -> ByteString -> IO Client -- | Returns whether or not bitcoind is generating bitcoins. getGenerate :: Client -> IO Bool -- | Controls whether or not bitcoind is generating bitcoins. setGenerate :: Client -> Bool -> Maybe Int -> IO () -- | Returns a recent hashes per second performance measurement while -- generating. getHashesPerSec :: Client -> IO Integer -- | Information related to the current bitcoind mining operation. -- -- If a field is undocumented here, it's because I don't know what it -- means. If you DO know what it means, I'd love it if you would submit a -- patch to help complete this documentation. data MiningInfo MiningInfo :: Integer -> Integer -> Integer -> Double -> Text -> Bool -> Integer -> Integer -> Integer -> Bool -> MiningInfo -- | The number of blocks in our block-chain. nBlocks :: MiningInfo -> Integer -- | The size of the current block we're mining. currentBlockSize :: MiningInfo -> Integer currentBlockTransaction :: MiningInfo -> Integer -- | How difficult mining currently is. difficulty :: MiningInfo -> Double -- | Any mining errors that may have come up. miningErrors :: MiningInfo -> Text -- | Are we currently generating bitcoins? isGenerating :: MiningInfo -> Bool -- | How many processors have we limited bitcoin mining to? generationProcessorLimit :: MiningInfo -> Integer -- | How fast is the mining going? hashesPerSecond :: MiningInfo -> Integer pooledTransactions :: MiningInfo -> Integer -- | Are we on the bitcoin test network (as opposed to the real thing)? miningOnTestNetwork :: MiningInfo -> Bool -- | Returns an object containing mining-related information. getMiningInfo :: Client -> IO MiningInfo -- | The hash data returned from getWork. data HashData HashData :: HexString -> HexString -> HexString -> HexString -> HashData blockData :: HashData -> HexString -- | Little-endian hash target, formatted as a hexadecimal string. hdTarget :: HashData -> HexString hash1 :: HashData -> HexString midstate :: HashData -> HexString -- | Returns formatted hash data to work on. getWork :: Client -> IO HashData -- | Tries to solve the given block, and returns true if it was successful. solveBlock :: Client -> HexString -> IO Bool -- | A transaction to be included in the next block. data Transaction Transaction :: HexString -> HexString -> Vector Integer -> Maybe Integer -> Integer -> Transaction txnData :: Transaction -> HexString txnHash :: Transaction -> HexString depends :: Transaction -> Vector Integer txnFee :: Transaction -> Maybe Integer sigOps :: Transaction -> Integer data CoinBaseAux CoinBaseAux :: HexString -> CoinBaseAux cbFlags :: CoinBaseAux -> HexString -- | A template for constructing a block to work on. -- -- See https://en.bitcoin.it/wiki/BIP_0022 for the full -- specification. data BlockTemplate BlockTemplate :: Integer -> HexString -> Vector Transaction -> CoinBaseAux -> Integer -> HexString -> Integer -> HexString -> Integer -> Integer -> Integer -> HexString -> Integer -> BlockTemplate blockVersion :: BlockTemplate -> Integer -- | Hash of current highest block. previousBlockHash :: BlockTemplate -> HexString -- | Contents of non-coinbase transactions that should be included in the -- next block. transactionsToInclude :: BlockTemplate -> Vector Transaction -- | Data that should be included in coinbase. coinBaseAux :: BlockTemplate -> CoinBaseAux -- | Maximum allowable input to coinbase transaction, including the -- generation award and transaction fees. coinBaseValue :: BlockTemplate -> Integer -- | Hash target. btTarget :: BlockTemplate -> HexString -- | Minimum timestamp appropriate for next block. minTime :: BlockTemplate -> Integer -- | Range of valid nonces. nonceRange :: BlockTemplate -> HexString -- | Limit of sigops in blocks. sigopLimit :: BlockTemplate -> Integer -- | Limit of block size. sizeLimit :: BlockTemplate -> Integer -- | Current timestamp. curTime :: BlockTemplate -> Integer -- | Compressed target of the next block. btBits :: BlockTemplate -> HexString -- | Height of the next block. btHeight :: BlockTemplate -> Integer -- | Returns data needed to construct a block to work on. getBlockTemplate :: Client -> IO BlockTemplate -- | Attempts to submit a new block to the network. submitBlock :: Client -> HexString -> IO Bool instance Show MiningInfo instance Read MiningInfo instance Ord MiningInfo instance Eq MiningInfo instance Show HashData instance Read HashData instance Ord HashData instance Eq HashData instance Show Transaction instance Read Transaction instance Ord Transaction instance Eq Transaction instance Show CoinBaseAux instance Read CoinBaseAux instance Ord CoinBaseAux instance Eq CoinBaseAux instance Show BlockTemplate instance Read BlockTemplate instance Ord BlockTemplate instance Eq BlockTemplate instance FromJSON StupidReturnValue instance FromJSON BlockTemplate instance FromJSON CoinBaseAux instance FromJSON Transaction instance ToJSON HashData instance FromJSON HashData instance FromJSON MiningInfo -- | An interface to bitcoind's available network-related RPC calls. The -- implementation of these functions can be found at -- https://github.com/bitcoin/bitcoin/blob/master/src/rpcnet.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. module Network.Bitcoin.Net -- | Client describes authentication credentials and host info for -- making API requests to the Bitcoin daemon. type Client = ByteString -> IO ByteString -- | getClient takes a url, rpc username, and rpc password and -- returns a Client that can be used to make API calls. Each Client -- encloses a Manager (from http-client) that re-uses connections for -- requests, so long as the same Client is is used for each call. getClient :: String -> ByteString -> ByteString -> IO Client -- | Returns the number of connections to other nodes. getConnectionCount :: Client -> IO Integer -- | Information about a peer node of the Bitcoin network. -- -- The documentation for this data structure is incomplete, as I honestly -- don't know what some of these fields are for. Patches are welcome! data PeerInfo PeerInfo :: Text -> Text -> Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> Text -> Bool -> Integer -> Integer -> PeerInfo -- | The IP:port of this peer, as a string. addressName :: PeerInfo -> Text services :: PeerInfo -> Text -- | Relative to the first time we conected with this peer (and in -- milliseconds), the last time we sent this peer any data. lastSend :: PeerInfo -> Integer -- | Relative to the first time we connected with this peer (and in -- milliseconds), the last time we sent this peer any data. lastRecv :: PeerInfo -> Integer bytesSent :: PeerInfo -> Integer bytesRecv :: PeerInfo -> Integer -- | How long have we been connected to this peer (in milliseconds). connectionTime :: PeerInfo -> Integer -- | The version of the Bitcion client the peer is running. peerVersion :: PeerInfo -> Integer -- | The sub-version of the Bitcoin client the peer is running. peerSubversion :: PeerInfo -> Text inbound :: PeerInfo -> Bool startingHeight :: PeerInfo -> Integer -- | How many times has this peer behaved badly? banScore :: PeerInfo -> Integer -- | Returns data about all connected peer nodes. getPeerInfo :: Client -> IO [PeerInfo] instance Show PeerInfo instance Read PeerInfo instance Ord PeerInfo instance Eq PeerInfo instance FromJSON PeerInfo -- | An interface to bitcoind's available raw transaction-related RPC -- calls. The implementation of these functions can be found at -- https://github.com/bitcoin/bitcoin/blob/master/src/rpcrawtransaction.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. -- -- Also, documentation for this module is scarce. I would love the -- addition of more documentation by anyone who knows what these things -- are. module Network.Bitcoin.RawTransaction -- | Client describes authentication credentials and host info for -- making API requests to the Bitcoin daemon. type Client = ByteString -> IO ByteString -- | getClient takes a url, rpc username, and rpc password and -- returns a Client that can be used to make API calls. Each Client -- encloses a Manager (from http-client) that re-uses connections for -- requests, so long as the same Client is is used for each call. getClient :: String -> ByteString -> ByteString -> IO Client -- | Just like most binary data retrieved from bitcoind, a raw transaction -- is represented by a hexstring. -- -- This is a serialized, hex-encoded transaction. type RawTransaction = HexString -- | Get a raw transaction from its unique ID. getRawTransaction :: Client -> TransactionID -> IO RawTransaction -- | A transaction into an account. This can either be a coinbase -- transaction, or a standard transaction with another account. data TxIn TxCoinbase :: HexString -> TxIn txCoinbase :: TxIn -> HexString TxIn :: TransactionID -> Integer -> ScriptSig -> Integer -> TxIn -- | This transaction's ID. txInId :: TxIn -> TransactionID numOut :: TxIn -> Integer scriptSig :: TxIn -> ScriptSig -- | A transaction sequence number. txSequence :: TxIn -> Integer -- | The type of a transaction out. -- -- More documentation is needed here. Submit a patch if you know what -- this is about! data TxnOutputType -- | JSON of "pubkey" received. TxnPubKey :: TxnOutputType -- | JSON of "pubkeyhash" received. TxnPubKeyHash :: TxnOutputType -- | JSON of "scripthash" received. TxnScriptHash :: TxnOutputType -- | JSON of "multisig" received. TxnMultisig :: TxnOutputType -- | A public key of someone we sent money to. data ScriptPubKey NonStandardScriptPubKey :: HexString -> HexString -> ScriptPubKey -- | The JSON "asm" field. nspkAsm :: ScriptPubKey -> HexString -- | The JSON "hex" field. nspkHex :: ScriptPubKey -> HexString StandardScriptPubKey :: HexString -> HexString -> Integer -> TxnOutputType -> Vector Address -> ScriptPubKey -- | The JSON "asm" field. sspkAsm :: ScriptPubKey -> HexString -- | The JSON "hex" field. sspkHex :: ScriptPubKey -> HexString -- | The number of required signatures. requiredSigs :: ScriptPubKey -> Integer -- | The type of the transaction. sspkType :: ScriptPubKey -> TxnOutputType -- | The addresses associated with this key. sspkAddresses :: ScriptPubKey -> Vector Address -- | A script signature. data ScriptSig ScriptSig :: HexString -> HexString -> ScriptSig sigAsm :: ScriptSig -> HexString sigHex :: ScriptSig -> HexString -- | A transaction out of an account. data TxOut TxOut :: BTC -> ScriptPubKey -> TxOut -- | The amount of bitcoin transferred out. txoutVal :: TxOut -> BTC -- | The public key of the account we sent the money to. scriptPubKey :: TxOut -> ScriptPubKey -- | Information on a single block. data BlockInfo ConfirmedBlock :: Integer -> Integer -> Integer -> BlockInfo -- | The number of confirmations a block has. This will always be >= 1. confirmations :: BlockInfo -> Integer cbTime :: BlockInfo -> Integer -- | The JSON "blocktime" field. blockTime :: BlockInfo -> Integer -- | An unconfirmed block is boring, but a possibility. UnconfirmedBlock :: BlockInfo -- | The raw transaction info for a given transaction ID. data RawTransactionInfo RawTransactionInfo :: RawTransaction -> Integer -> Integer -> Vector TxIn -> Vector TxOut -> HexString -> BlockInfo -> RawTransactionInfo -- | The raw transaction. raw :: RawTransactionInfo -> RawTransaction -- | The transaction version number. txnVersion :: RawTransactionInfo -> Integer txnLockTime :: RawTransactionInfo -> Integer -- | The vector of transactions in. vin :: RawTransactionInfo -> Vector TxIn -- | The vector of transactions out. vout :: RawTransactionInfo -> Vector TxOut -- | The hash of the block that was used for this transaction. rawTxBlockHash :: RawTransactionInfo -> HexString -- | The transaction's block's info. rawBlockInfo :: RawTransactionInfo -> BlockInfo -- | Get raw transaction info for a given transaction ID. The data -- structure returned is quite sprawling and undocumented, so any patches -- to help simplify things would be greatly appreciated. getRawTransactionInfo :: Client -> TransactionID -> IO RawTransactionInfo data UnspentTransaction UnspentTransaction :: TransactionID -> Integer -> Address -> HexString -> Maybe HexString -> BTC -> Integer -> UnspentTransaction unspentTransactionId :: UnspentTransaction -> TransactionID outIdx :: UnspentTransaction -> Integer unspentAddress :: UnspentTransaction -> Address unspentScriptPubKey :: UnspentTransaction -> HexString redeemScript :: UnspentTransaction -> Maybe HexString unspentAmount :: UnspentTransaction -> BTC usConfirmations :: UnspentTransaction -> Integer -- | Returns an array of unspent transaction outputs with between minconf -- and maxconf (inclusive) confirmations. If addresses are given, the -- result will be filtered to include only those addresses. listUnspent :: Client -> Maybe Int -> Maybe Int -> Vector Address -> IO (Vector UnspentTransaction) -- | Create a transaction spending given inputs, sending to given -- addresses. -- -- Note that the transaction's inputs are not signed, and it is not -- stored in the wallet or transmitted to the network. -- -- Also, there is no checking to see if it's possible to send that much -- to the targets specified. In the future, such a scenario might throw -- an exception. createRawTransaction :: Client -> Vector UnspentTransaction -> Vector (Address, BTC) -> IO HexString -- | A successfully decoded raw transaction, from a given serialized, -- hex-encoded transaction. data DecodedRawTransaction DecodedRawTransaction :: RawTransaction -> Integer -> Integer -> Vector TxIn -> Vector TxOut -> DecodedRawTransaction -- | The raw transaction. decRaw :: DecodedRawTransaction -> RawTransaction -- | The transaction version number. decTxnVersion :: DecodedRawTransaction -> Integer decTxnLockTime :: DecodedRawTransaction -> Integer -- | The vector of transactions in. decVin :: DecodedRawTransaction -> Vector TxIn -- | The vector of transactions out. decVout :: DecodedRawTransaction -> Vector TxOut -- | Decodes a raw transaction into a more accessible data structure. decodeRawTransaction :: Client -> RawTransaction -> IO DecodedRawTransaction -- | Who can pay for a given transaction. data WhoCanPay All :: WhoCanPay AllOrAnyoneCanPay :: WhoCanPay None :: WhoCanPay NoneOrAnyoneCanPay :: WhoCanPay Single :: WhoCanPay SingleOrAnyoneCanPay :: WhoCanPay -- | A raw signed transaction contains the raw, signed hexstring and -- whether or not this transaction has a complete signature set. data RawSignedTransaction RawSignedTransaction :: HexString -> Bool -> RawSignedTransaction rawSigned :: RawSignedTransaction -> HexString hasCompleteSigSet :: RawSignedTransaction -> Bool -- | Sign inputs for a raw transaction. signRawTransaction :: Client -> RawTransaction -> Maybe (Vector UnspentTransaction) -> Maybe (Vector HexString) -> Maybe WhoCanPay -> IO RawSignedTransaction sendRawTransaction :: Client -> RawTransaction -> IO TransactionID instance Show TxnOutputType instance Read TxnOutputType instance Ord TxnOutputType instance Eq TxnOutputType instance Show ScriptPubKey instance Read ScriptPubKey instance Ord ScriptPubKey instance Eq ScriptPubKey instance Show TxOut instance Read TxOut instance Ord TxOut instance Eq TxOut instance Show ScriptSig instance Read ScriptSig instance Ord ScriptSig instance Eq ScriptSig instance Show TxIn instance Read TxIn instance Ord TxIn instance Eq TxIn instance Show BlockInfo instance Read BlockInfo instance Ord BlockInfo instance Eq BlockInfo instance Show RawTransactionInfo instance Read RawTransactionInfo instance Ord RawTransactionInfo instance Eq RawTransactionInfo instance Show UnspentTransaction instance Eq UnspentTransaction instance FromJSON RawSignedTransaction instance ToJSON UnspentForSigning instance FromJSON DecodedRawTransaction instance ToJSON UnspentTransaction instance FromJSON UnspentTransaction instance FromJSON RawTransactionInfo instance FromJSON BlockInfo instance FromJSON ScriptSig instance FromJSON ScriptPubKey instance FromJSON TxOut instance FromJSON TxnOutputType instance FromJSON TxIn -- | 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. module Network.Bitcoin.BlockChain -- | Client describes authentication credentials and host info for -- making API requests to the Bitcoin daemon. type Client = ByteString -> IO ByteString -- | A hexadecimal string representation of a 256-bit unsigned integer. -- -- This integer is a unique transaction identifier. type TransactionID = HexString -- | The type of bitcoin money, represented with a fixed-point number. type BTC = Fixed Satoshi -- | Returns the number of blocks in the longest block chain. getBlockCount :: Client -> IO Integer -- | Returns the proof-of-work difficulty as a multiple of the minimum -- difficulty. getDifficulty :: Client -> IO Integer -- | Sets the transaction fee will will pay to the network. Values of 0 are -- rejected. setTransactionFee :: Client -> BTC -> IO () -- | Returns all transaction identifiers in the memory pool. getRawMemoryPool :: Client -> IO (Vector TransactionID) -- | The hash of a given block. type BlockHash = HexString -- | Returns the hash of the block in best-block-chain at the given index. getBlockHash :: Client -> Integer -> IO BlockHash -- | Information about a given block in the block chain. data Block Block :: BlockHash -> Integer -> Integer -> Integer -> Integer -> BlockHash -> Vector TransactionID -> Integer -> Integer -> HexString -> Integer -> Maybe BlockHash -> Maybe BlockHash -> Block blockHash :: Block -> BlockHash -- | The number of confirmations the block has. blkConfirmations :: Block -> Integer -- | The size of the block. blkSize :: Block -> Integer -- | The "height" of the block. TODO: Clarify this. blkHeight :: Block -> Integer -- | The version of the block. blkVersion :: Block -> Integer -- | The hash of the block at the root of the merkle tree which this block -- belongs to. merkleRoot :: Block -> BlockHash -- | Should this be a transaction, or transaction id? subTransactions :: Block -> Vector TransactionID -- | The time it was mined. blkTime :: Block -> Integer -- | The block's nonce. blkNonce :: Block -> Integer blkBits :: Block -> HexString -- | How hard was this block to mine? blkDifficulty :: Block -> Integer -- | A pointer to the next block in the chain. nextBlock :: Block -> Maybe BlockHash -- | A pointer to the previous block in the chain. prevBlock :: Block -> Maybe BlockHash -- | Returns details of a block with given block-hash. getBlock :: Client -> BlockHash -> IO Block -- | Information on the unspent transaction in the output set. data OutputSetInfo OutputSetInfo :: BlockHash -> Integer -> Integer -> Integer -> OutputSetInfo osiBestBlock :: OutputSetInfo -> BlockHash -- | The number of transactions in the output set. numTransactions :: OutputSetInfo -> Integer -- | The number of outputs for the transactions. transactionOutputs :: OutputSetInfo -> Integer -- | The serialized size of the output set. serializedSize :: OutputSetInfo -> Integer -- | Returns statistics about the unspent transaction output set. getOutputSetInfo :: Client -> IO OutputSetInfo -- | Details about an unspent transaction output. data OutputInfo OutputInfo :: BlockHash -> Integer -> BTC -> ScriptPubKey -> Integer -> Bool -> OutputInfo oiBestBlock :: OutputInfo -> BlockHash -- | The number of times this transaction has been confirmed. oiConfirmations :: OutputInfo -> Integer -- | The amount transferred. oiAmount :: OutputInfo -> BTC -- | The public key of the sender. oiScriptPubKey :: OutputInfo -> ScriptPubKey -- | The version of this transaction. oiVersion :: OutputInfo -> Integer -- | Is this transaction part of the coin base? oiCoinBase :: OutputInfo -> Bool -- | Returns details about an unspent transaction output. getOutputInfo :: Client -> TransactionID -> Integer -> IO OutputInfo instance Show Block instance Read Block instance Ord Block instance Eq Block instance Show OutputSetInfo instance Read OutputSetInfo instance Ord OutputSetInfo instance Eq OutputSetInfo instance Show OutputInfo instance Read OutputInfo instance Ord OutputInfo instance Eq OutputInfo instance FromJSON OutputInfo instance FromJSON OutputSetInfo instance FromJSON Block -- | An interface to bitcoind's available wallet-related RPC calls. The -- implementation of these functions can be found at -- https://github.com/bitcoin/bitcoin/blob/master/src/rpcwallet.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. -- -- Certain APIs were too complicated for me to write an interface for. If -- you figure them out, then patches are always welcome! They're left in -- the source as comments. module Network.Bitcoin.Wallet -- | Client describes authentication credentials and host info for -- making API requests to the Bitcoin daemon. type Client = ByteString -> IO ByteString -- | getClient takes a url, rpc username, and rpc password and -- returns a Client that can be used to make API calls. Each Client -- encloses a Manager (from http-client) that re-uses connections for -- requests, so long as the same Client is is used for each call. getClient :: String -> ByteString -> ByteString -> IO Client -- | A plethora of information about a bitcoind instance. data BitcoindInfo BitcoindInfo :: Integer -> Integer -> Integer -> BTC -> Integer -> Integer -> Text -> Double -> Bool -> Integer -> Integer -> BTC -> Maybe Integer -> Text -> BitcoindInfo -- | What version of bitcoind are we running? bitcoinVersion :: BitcoindInfo -> Integer -- | What is bitcoind's current protocol number? protocolVersion :: BitcoindInfo -> Integer -- | What version is the wallet? walletVersion :: BitcoindInfo -> Integer -- | How much money is currently in the wallet? balance :: BitcoindInfo -> BTC -- | The number of blocks in our chain. numBlocks :: BitcoindInfo -> Integer -- | How many peers are we connected to? numConnections :: BitcoindInfo -> Integer -- | A blank string if we're not using a proxy. proxy :: BitcoindInfo -> Text -- | The difficulty multiplier for bitcoin mining operations. generationDifficulty :: BitcoindInfo -> Double -- | Are we on the test network (as opposed to the primary bitcoin -- network)? onTestNetwork :: BitcoindInfo -> Bool -- | The timestamp of the oldest key in the key pool. keyPoolOldest :: BitcoindInfo -> Integer -- | The size of the key pool. keyPoolSize :: BitcoindInfo -> Integer -- | How much do we currently pay as a transaction fee? transactionFeePaid :: BitcoindInfo -> BTC -- | If the wallet is unlocked, the number of seconds until a re-lock is -- needed. unlockedUntil :: BitcoindInfo -> Maybe Integer -- | Any alerts will show up here. This should normally be an empty string. bitcoindErrors :: BitcoindInfo -> Text -- | Returns an object containing various state info. getBitcoindInfo :: Client -> IO BitcoindInfo -- | Returns a new bitcoin address for receiving payments. -- -- If an account is specified (recommended), the new address is added to -- the address book so payments received with the address will be -- credited to the given account. -- -- If no account is specified, the address will be credited to the -- account whose name is the empty string. i.e. the default account. getNewAddress :: Client -> Maybe Account -> IO Address -- | Returns the current Bitcoin address for receiving payments to the -- given account. getAccountAddress :: Client -> Account -> IO Address -- | Returns the account associated with the given address. getAccount :: Client -> Address -> IO Account -- | Sets the account associated with the given address. setAccount :: Client -> Address -> Account -> IO () -- | Returns the list of addresses for the given address. getAddressesByAccount :: Client -> Account -> IO (Vector Address) -- | Sends some bitcoins to an address. sendToAddress :: Client -> Address -> BTC -> Maybe Text -> Maybe Text -> IO TransactionID -- | Information on a given address. data AddressInfo AddressInfo :: Address -> BTC -> Maybe Account -> AddressInfo -- | The address in question. aiAddress :: AddressInfo -> Address -- | The address' balance. aiAmount :: AddressInfo -> BTC -- | The address' linked account. aiAccount :: AddressInfo -> Maybe Account -- | Lists groups of addresses which have had their common ownership made -- public by common use as inputs or as the resulting change in past -- transactions. listAddressGroupings :: Client -> IO (Vector (Vector AddressInfo)) -- | A signature is a base-64 encoded string. type Signature = HexString -- | Sign a message with the private key of an address. signMessage :: Client -> Address -> Text -> IO Signature -- | Verifies a signed message. verifyMessage :: Client -> Address -> Signature -> Text -> IO Bool -- | Returns the total amount received by the given address with at least -- one confirmation. getReceivedByAddress :: Client -> Address -> IO BTC -- | Returns the total amount received by the given address, with at least -- the give number of confirmations. getReceivedByAddress' :: Client -> Address -> Int -> IO BTC -- | Returns the total amount received by address with the given account. getReceivedByAccount :: Client -> Account -> IO BTC -- | Returns the total amount received by addresses with the given account, -- counting only transactions with the given minimum number of -- confirmations. getReceivedByAccount' :: Client -> Account -> Int -> IO BTC -- | Returns the server's total available balance. getBalance :: Client -> IO BTC -- | Returns the balance in the given account, counting only transactions -- with at least one confirmation. getBalance' :: Client -> Account -> IO BTC -- | Returns the balance in the given account, counting only transactions -- with at least the given number of confirmations. getBalance'' :: Client -> Account -> Int -> IO BTC -- | Move bitcoins from one account in your wallet to another. -- -- If you want to send bitcoins to an address not in your wallet, use -- sendFromAccount. moveBitcoins :: Client -> Account -> Account -> BTC -> Text -> IO () -- | Sends bitcoins from a given account in our wallet to a given address. -- -- A transaction and sender comment may be optionally provided. sendFromAccount :: Client -> Account -> Address -> BTC -> Maybe Text -> Maybe Text -> IO TransactionID -- | Send to a whole bunch of address at once. sendMany :: Client -> Account -> Vector (Address, BTC) -> Maybe Text -> IO TransactionID -- | Information on how much was received by a given address. data ReceivedByAddress ReceivedByAddress :: Address -> Account -> BTC -> Integer -> ReceivedByAddress -- | The address which the money was deposited to. recvAddress :: ReceivedByAddress -> Address -- | The account which this address belongs to. recvAccount :: ReceivedByAddress -> Account -- | The amount received. recvAmount :: ReceivedByAddress -> BTC -- | The number of confirmations of the most recent included transaction. recvNumConfirmations :: ReceivedByAddress -> Integer -- | Lists the amount received by each address which has received money at -- some point, counting only transactions with at least one confirmation. listReceivedByAddress :: Client -> IO (Vector ReceivedByAddress) -- | List the amount received by each of our addresses, counting only -- transactions with the given minimum number of confirmations. listReceivedByAddress' :: Client -> Int -> Bool -> IO (Vector ReceivedByAddress) data ReceivedByAccount ReceivedByAccount :: Account -> BTC -> Integer -> ReceivedByAccount -- | The account we received into. raccAccount :: ReceivedByAccount -> Account -- | The mount received. ^ The number of confirmations of the most recent -- included transaction. raccAmount :: ReceivedByAccount -> BTC raccNumConfirmations :: ReceivedByAccount -> Integer -- | Lists the amount received by each account which has received money at -- some point, counting only transactions with at leaset one -- confirmation. listReceivedByAccount :: Client -> IO (Vector ReceivedByAccount) -- | List the amount received by each of our accounts, counting only -- transactions with the given minimum number of confirmations. listReceivedByAccount' :: Client -> Int -> Bool -> IO (Vector ReceivedByAccount) -- | Returns transactions from the blockchain. listTransactions :: Client -> Account -> Int -> Int -> IO (Vector SimpleTransaction) -- | Returns transactions from the blockchain. listTransactions' :: Client -> Maybe Account -> Maybe Int -> Maybe Int -> IO (Vector SimpleTransaction) -- | List accounts and their current balance. listAccounts :: Client -> Maybe Int -> IO (HashMap Account BTC) data SinceBlock SinceBlock :: Vector SimpleTransaction -> BlockHash -> SinceBlock strransactions :: SinceBlock -> Vector SimpleTransaction sbLastBlockHash :: SinceBlock -> BlockHash -- | Data type for simple transactions. Rules involving Maybe are -- indications of the most probable value only when the transaction is -- obtained from listTransactions or listSinceBlock are -- their associated methods. They are never enforced on this side. data SimpleTransaction SimpleTransaction :: Account -> Maybe Address -> TransactionCategory -> Maybe BTC -> BTC -> Maybe Integer -> Maybe BlockHash -> Maybe Integer -> Maybe POSIXTime -> Maybe TransactionID -> Maybe (Vector TransactionID) -> POSIXTime -> Maybe POSIXTime -> Maybe Text -> Maybe Text -> Maybe Account -> SimpleTransaction -- | The account name associated with the transaction. The empty string is -- the default account. stReceivingAccount :: SimpleTransaction -> Account -- | The bitcoin address of the transaction. Is Nothing unless -- trCategory is TCSend or TCReceive. stAddress :: SimpleTransaction -> Maybe Address -- | The category of the transaction stCategory :: SimpleTransaction -> TransactionCategory -- | The fees paid to process the transaction. Is Nothing unless -- trCategory is TCSend or TCReceive. stFee :: SimpleTransaction -> Maybe BTC -- | The amount of bitcoins transferred. stAmount :: SimpleTransaction -> BTC -- | The number of confirmations of the transaction. Is Nothing -- unless trCategory is TCSend or TCReceive. stConfirmations :: SimpleTransaction -> Maybe Integer -- | The hash of the block containing the transaction. Is Nothing -- unless trCategory is TCSend or TCReceive. stBlockHash :: SimpleTransaction -> Maybe BlockHash -- | The index of the the block containing the transaction. Is -- Nothing unless trCategory is TCSend or -- TCReceive. stBlockIndex :: SimpleTransaction -> Maybe Integer -- | The block time in seconds since epoch (1 Jan 1970 GMT). Is -- Nothing unless trCategory is TCSend or -- TCReceive. stBlockTime :: SimpleTransaction -> Maybe POSIXTime -- | The transaction id. Is Nothing unless trCategory is -- TCSend or TCReceive. stTransactionId :: SimpleTransaction -> Maybe TransactionID -- | The list of transaction ids containing the same data as the original -- transaction (See ID-malleation bug). Is Nothing unless -- trCategory is TCSend or TCReceive. stWalletConflicts :: SimpleTransaction -> Maybe (Vector TransactionID) -- | The block time in seconds since epoch (1 Jan 1970 GMT). stTime :: SimpleTransaction -> POSIXTime stTimeReceived :: SimpleTransaction -> Maybe POSIXTime -- | Is Nothing unless a comment is associated with the transaction. stComment :: SimpleTransaction -> Maybe Text -- | Is Nothing unless a "to" is associated with the transaction. stTo :: SimpleTransaction -> Maybe Text -- | The account the funds came from (for receiving funds, positive -- amounts), or went to (for sending funds, negative amounts). Is -- Nothing unless trCategory is TCMove. stOtherAccount :: SimpleTransaction -> Maybe Account data TransactionCategory TCSend :: TransactionCategory TCOrphan :: TransactionCategory TCImmature :: TransactionCategory TCGenerate :: TransactionCategory TCReceive :: TransactionCategory TCMove :: TransactionCategory TCErrorUnexpected :: Text -> TransactionCategory -- | Gets all transactions in blocks since the given block. listSinceBlock :: Client -> BlockHash -> Maybe Int -> IO (SinceBlock) -- | Gets all transactions in blocks since the given block, or all -- transactions if ommited. listSinceBlock' :: Client -> Maybe BlockHash -> Maybe Int -> IO (SinceBlock) -- | Data type for detailed transactions. Rules involving -- trCategory are indications of the most probable value only -- when the transaction is obtained from listTransactions or -- listSinceBlock are their associated methods. data DetailedTransaction DetailedTransaction :: BTC -> Maybe BTC -> Maybe Integer -> Maybe TransactionID -> Maybe (Vector TransactionID) -> POSIXTime -> Maybe POSIXTime -> Maybe Text -> Maybe Text -> Vector DetailedTransactionDetails -> RawTransaction -> DetailedTransaction -- | The amount of bitcoins transferred. dtAmount :: DetailedTransaction -> BTC -- | The fees paid to process the transaction. Is Nothing unless -- trCategory is TCSend or TCReceive. dtFee :: DetailedTransaction -> Maybe BTC -- | The number of confirmations of the transaction. Is Nothing -- unless trCategory is TCSend or TCReceive. dtConfirmations :: DetailedTransaction -> Maybe Integer -- | The transaction id. Is Nothing unless trCategory is -- TCSend or TCReceive. dtTransactionId :: DetailedTransaction -> Maybe TransactionID -- | The list of transaction ids containing the same data as the original -- transaction (See ID-malleation bug). Is Nothing unless -- trCategory is TCSend or TCReceive. dtWalletConflicts :: DetailedTransaction -> Maybe (Vector TransactionID) -- | The block time in seconds since epoch (1 Jan 1970 GMT). dtTime :: DetailedTransaction -> POSIXTime dtTimeReceived :: DetailedTransaction -> Maybe POSIXTime -- | Is Nothing unless a comment is associated with the transaction. dtComment :: DetailedTransaction -> Maybe Text -- | Is Nothing unless a "to" is associated with the transaction. dtTo :: DetailedTransaction -> Maybe Text -- | The details of the transaction. dtDetails :: DetailedTransaction -> Vector DetailedTransactionDetails -- | Raw data for the transaction. dtHex :: DetailedTransaction -> RawTransaction data DetailedTransactionDetails DetailedTransactionDetails :: Account -> Address -> TransactionCategory -> BTC -> DetailedTransactionDetails -- | The account name associated with the transaction. The empty string is -- the default account. dtdReceivingAccount :: DetailedTransactionDetails -> Account -- | The bitcoin address of the transaction. dtdAddress :: DetailedTransactionDetails -> Address -- | The category of the transaction dtdCategory :: DetailedTransactionDetails -> TransactionCategory -- | The amount of bitcoins transferred. dtdAmount :: DetailedTransactionDetails -> BTC getTransaction :: Client -> TransactionID -> IO (DetailedTransaction) -- | Safely copies wallet.dat to the given destination, which can be either -- a directory, or a path with filename. backupWallet :: Client -> FilePath -> IO () -- | Fills the keypool. keyPoolRefill :: Client -> IO () -- | Stores the wallet decryption key in memory for the given amount of -- time. unlockWallet :: Client -> Text -> Integer -> IO () -- | Removes the wallet encryption key from memory, locking the wallet. -- -- After calling this function, you will need to call unlockWallet -- again before being able to call methods which require the wallet to be -- unlocked. -- -- Note: In future releases, we might introduce an "unlocked" monad, so -- locking and unlocking is automatic. lockWallet :: Client -> IO () -- | Changes the wallet passphrase. changePassword :: Client -> Text -> Text -> IO () -- | Encrypts the wallet with the given passphrase. -- -- WARNING: bitcoind will shut down after calling this method. Don't say -- I didn't warn you. encryptWallet :: Client -> Text -> IO () -- | Checks if a given address is a valid one. isAddressValid :: Client -> Address -> IO Bool instance Show BitcoindInfo instance Read BitcoindInfo instance Ord BitcoindInfo instance Eq BitcoindInfo instance Show AddressInfo instance Read AddressInfo instance Eq AddressInfo instance Ord AddressInfo instance Show ReceivedByAddress instance Read ReceivedByAddress instance Ord ReceivedByAddress instance Eq ReceivedByAddress instance Show ReceivedByAccount instance Read ReceivedByAccount instance Ord ReceivedByAccount instance Eq ReceivedByAccount instance Show TransactionCategory instance Read TransactionCategory instance Ord TransactionCategory instance Eq TransactionCategory instance Show SimpleTransaction instance Ord SimpleTransaction instance Eq SimpleTransaction instance Show SinceBlock instance Ord SinceBlock instance Eq SinceBlock instance Show DetailedTransactionDetails instance Ord DetailedTransactionDetails instance Eq DetailedTransactionDetails instance Show DetailedTransaction instance Ord DetailedTransaction instance Eq DetailedTransaction instance FromJSON IsValid instance FromJSON DetailedTransactionDetails instance FromJSON DetailedTransaction instance FromJSON TransactionCategory instance FromJSON SimpleTransaction instance FromJSON SinceBlock instance FromJSON ReceivedByAccount instance FromJSON ReceivedByAddress instance FromJSON AddressInfo instance FromJSON BitcoindInfo -- | A Haskell binding to the bitcoind server. module Network.Bitcoin -- | Client describes authentication credentials and host info for -- making API requests to the Bitcoin daemon. type Client = ByteString -> IO ByteString -- | getClient takes a url, rpc username, and rpc password and -- returns a Client that can be used to make API calls. Each Client -- encloses a Manager (from http-client) that re-uses connections for -- requests, so long as the same Client is is used for each call. getClient :: String -> ByteString -> ByteString -> IO Client -- | A BitcoinException is thrown when 'callApi encounters an error. -- The API error code is represented as an Int, the message as a -- String. -- -- It may also be thrown when the value returned by the bitcoin API -- wasn't what we expected. -- -- WARNING: Any of the functions in this module's public API may throw -- this exception. You should plan on handling it. data BitcoinException -- | A BitcoinApiError has an error code error message, as returned -- by bitcoind's JSON-RPC response. BitcoinApiError :: Int -> Text -> BitcoinException -- | The raw JSON returned, if we can't figure out what actually went -- wrong. BitcoinResultTypeError :: ByteString -> BitcoinException -- | A string returned by the bitcoind API, representing data as hex. -- -- What that data represents depends on the API call, but should be -- dcumented accordingly. type HexString = Text -- | A hexadecimal string representation of a 256-bit unsigned integer. -- -- This integer is a unique transaction identifier. type TransactionID = HexString -- | A satoshi is the smallest subdivision of bitcoins. For the resolution, -- use resolution from Fixed. data Satoshi Satoshi :: Satoshi -- | The type of bitcoin money, represented with a fixed-point number. type BTC = Fixed Satoshi -- | An account on the wallet is just a label to easily specify private -- keys. -- -- The default account is an empty string. type Account = Text -- | An address for sending or receiving money. type Address = HexString -- | A script signature. data ScriptSig -- | Returns the number of blocks in the longest block chain. getBlockCount :: Client -> IO Integer -- | Returns the proof-of-work difficulty as a multiple of the minimum -- difficulty. getDifficulty :: Client -> IO Integer -- | Sets the transaction fee will will pay to the network. Values of 0 are -- rejected. setTransactionFee :: Client -> BTC -> IO () -- | Returns all transaction identifiers in the memory pool. getRawMemoryPool :: Client -> IO (Vector TransactionID) -- | The hash of a given block. type BlockHash = HexString -- | Returns the hash of the block in best-block-chain at the given index. getBlockHash :: Client -> Integer -> IO BlockHash -- | Information about a given block in the block chain. data Block Block :: BlockHash -> Integer -> Integer -> Integer -> Integer -> BlockHash -> Vector TransactionID -> Integer -> Integer -> HexString -> Integer -> Maybe BlockHash -> Maybe BlockHash -> Block blockHash :: Block -> BlockHash -- | The number of confirmations the block has. blkConfirmations :: Block -> Integer -- | The size of the block. blkSize :: Block -> Integer -- | The "height" of the block. TODO: Clarify this. blkHeight :: Block -> Integer -- | The version of the block. blkVersion :: Block -> Integer -- | The hash of the block at the root of the merkle tree which this block -- belongs to. merkleRoot :: Block -> BlockHash -- | Should this be a transaction, or transaction id? subTransactions :: Block -> Vector TransactionID -- | The time it was mined. blkTime :: Block -> Integer -- | The block's nonce. blkNonce :: Block -> Integer blkBits :: Block -> HexString -- | How hard was this block to mine? blkDifficulty :: Block -> Integer -- | A pointer to the next block in the chain. nextBlock :: Block -> Maybe BlockHash -- | A pointer to the previous block in the chain. prevBlock :: Block -> Maybe BlockHash -- | Returns details of a block with given block-hash. getBlock :: Client -> BlockHash -> IO Block -- | Information on the unspent transaction in the output set. data OutputSetInfo OutputSetInfo :: BlockHash -> Integer -> Integer -> Integer -> OutputSetInfo osiBestBlock :: OutputSetInfo -> BlockHash -- | The number of transactions in the output set. numTransactions :: OutputSetInfo -> Integer -- | The number of outputs for the transactions. transactionOutputs :: OutputSetInfo -> Integer -- | The serialized size of the output set. serializedSize :: OutputSetInfo -> Integer -- | Returns statistics about the unspent transaction output set. getOutputSetInfo :: Client -> IO OutputSetInfo -- | Details about an unspent transaction output. data OutputInfo OutputInfo :: BlockHash -> Integer -> BTC -> ScriptPubKey -> Integer -> Bool -> OutputInfo oiBestBlock :: OutputInfo -> BlockHash -- | The number of times this transaction has been confirmed. oiConfirmations :: OutputInfo -> Integer -- | The amount transferred. oiAmount :: OutputInfo -> BTC -- | The public key of the sender. oiScriptPubKey :: OutputInfo -> ScriptPubKey -- | The version of this transaction. oiVersion :: OutputInfo -> Integer -- | Is this transaction part of the coin base? oiCoinBase :: OutputInfo -> Bool -- | Returns details about an unspent transaction output. getOutputInfo :: Client -> TransactionID -> Integer -> IO OutputInfo -- | Adds a private key (as returned by dumpprivkey) to your wallet. importPrivateKey :: Client -> PrivateKey -> Maybe Account -> IO () -- | Reveals the private key corresponding to the given address. dumpPrivateKey :: Client -> Address -> IO PrivateKey -- | Returns whether or not bitcoind is generating bitcoins. getGenerate :: Client -> IO Bool -- | Controls whether or not bitcoind is generating bitcoins. setGenerate :: Client -> Bool -> Maybe Int -> IO () -- | Returns a recent hashes per second performance measurement while -- generating. getHashesPerSec :: Client -> IO Integer -- | Information related to the current bitcoind mining operation. -- -- If a field is undocumented here, it's because I don't know what it -- means. If you DO know what it means, I'd love it if you would submit a -- patch to help complete this documentation. data MiningInfo MiningInfo :: Integer -> Integer -> Integer -> Double -> Text -> Bool -> Integer -> Integer -> Integer -> Bool -> MiningInfo -- | The number of blocks in our block-chain. nBlocks :: MiningInfo -> Integer -- | The size of the current block we're mining. currentBlockSize :: MiningInfo -> Integer currentBlockTransaction :: MiningInfo -> Integer -- | How difficult mining currently is. difficulty :: MiningInfo -> Double -- | Any mining errors that may have come up. miningErrors :: MiningInfo -> Text -- | Are we currently generating bitcoins? isGenerating :: MiningInfo -> Bool -- | How many processors have we limited bitcoin mining to? generationProcessorLimit :: MiningInfo -> Integer -- | How fast is the mining going? hashesPerSecond :: MiningInfo -> Integer pooledTransactions :: MiningInfo -> Integer -- | Are we on the bitcoin test network (as opposed to the real thing)? miningOnTestNetwork :: MiningInfo -> Bool -- | Returns an object containing mining-related information. getMiningInfo :: Client -> IO MiningInfo -- | The hash data returned from getWork. data HashData HashData :: HexString -> HexString -> HexString -> HexString -> HashData blockData :: HashData -> HexString -- | Little-endian hash target, formatted as a hexadecimal string. hdTarget :: HashData -> HexString hash1 :: HashData -> HexString midstate :: HashData -> HexString -- | Returns formatted hash data to work on. getWork :: Client -> IO HashData -- | Tries to solve the given block, and returns true if it was successful. solveBlock :: Client -> HexString -> IO Bool -- | A transaction to be included in the next block. data Transaction Transaction :: HexString -> HexString -> Vector Integer -> Maybe Integer -> Integer -> Transaction txnData :: Transaction -> HexString txnHash :: Transaction -> HexString depends :: Transaction -> Vector Integer txnFee :: Transaction -> Maybe Integer sigOps :: Transaction -> Integer data CoinBaseAux CoinBaseAux :: HexString -> CoinBaseAux cbFlags :: CoinBaseAux -> HexString -- | A template for constructing a block to work on. -- -- See https://en.bitcoin.it/wiki/BIP_0022 for the full -- specification. data BlockTemplate BlockTemplate :: Integer -> HexString -> Vector Transaction -> CoinBaseAux -> Integer -> HexString -> Integer -> HexString -> Integer -> Integer -> Integer -> HexString -> Integer -> BlockTemplate blockVersion :: BlockTemplate -> Integer -- | Hash of current highest block. previousBlockHash :: BlockTemplate -> HexString -- | Contents of non-coinbase transactions that should be included in the -- next block. transactionsToInclude :: BlockTemplate -> Vector Transaction -- | Data that should be included in coinbase. coinBaseAux :: BlockTemplate -> CoinBaseAux -- | Maximum allowable input to coinbase transaction, including the -- generation award and transaction fees. coinBaseValue :: BlockTemplate -> Integer -- | Hash target. btTarget :: BlockTemplate -> HexString -- | Minimum timestamp appropriate for next block. minTime :: BlockTemplate -> Integer -- | Range of valid nonces. nonceRange :: BlockTemplate -> HexString -- | Limit of sigops in blocks. sigopLimit :: BlockTemplate -> Integer -- | Limit of block size. sizeLimit :: BlockTemplate -> Integer -- | Current timestamp. curTime :: BlockTemplate -> Integer -- | Compressed target of the next block. btBits :: BlockTemplate -> HexString -- | Height of the next block. btHeight :: BlockTemplate -> Integer -- | Returns data needed to construct a block to work on. getBlockTemplate :: Client -> IO BlockTemplate -- | Attempts to submit a new block to the network. submitBlock :: Client -> HexString -> IO Bool -- | Returns the number of connections to other nodes. getConnectionCount :: Client -> IO Integer -- | Information about a peer node of the Bitcoin network. -- -- The documentation for this data structure is incomplete, as I honestly -- don't know what some of these fields are for. Patches are welcome! data PeerInfo PeerInfo :: Text -> Text -> Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> Text -> Bool -> Integer -> Integer -> PeerInfo -- | The IP:port of this peer, as a string. addressName :: PeerInfo -> Text services :: PeerInfo -> Text -- | Relative to the first time we conected with this peer (and in -- milliseconds), the last time we sent this peer any data. lastSend :: PeerInfo -> Integer -- | Relative to the first time we connected with this peer (and in -- milliseconds), the last time we sent this peer any data. lastRecv :: PeerInfo -> Integer bytesSent :: PeerInfo -> Integer bytesRecv :: PeerInfo -> Integer -- | How long have we been connected to this peer (in milliseconds). connectionTime :: PeerInfo -> Integer -- | The version of the Bitcion client the peer is running. peerVersion :: PeerInfo -> Integer -- | The sub-version of the Bitcoin client the peer is running. peerSubversion :: PeerInfo -> Text inbound :: PeerInfo -> Bool startingHeight :: PeerInfo -> Integer -- | How many times has this peer behaved badly? banScore :: PeerInfo -> Integer -- | Returns data about all connected peer nodes. getPeerInfo :: Client -> IO [PeerInfo] -- | Just like most binary data retrieved from bitcoind, a raw transaction -- is represented by a hexstring. -- -- This is a serialized, hex-encoded transaction. type RawTransaction = HexString -- | Get a raw transaction from its unique ID. getRawTransaction :: Client -> TransactionID -> IO RawTransaction -- | A transaction into an account. This can either be a coinbase -- transaction, or a standard transaction with another account. data TxIn TxCoinbase :: HexString -> TxIn txCoinbase :: TxIn -> HexString TxIn :: TransactionID -> Integer -> ScriptSig -> Integer -> TxIn -- | This transaction's ID. txInId :: TxIn -> TransactionID numOut :: TxIn -> Integer scriptSig :: TxIn -> ScriptSig -- | A transaction sequence number. txSequence :: TxIn -> Integer -- | The type of a transaction out. -- -- More documentation is needed here. Submit a patch if you know what -- this is about! data TxnOutputType -- | JSON of "pubkey" received. TxnPubKey :: TxnOutputType -- | JSON of "pubkeyhash" received. TxnPubKeyHash :: TxnOutputType -- | JSON of "scripthash" received. TxnScriptHash :: TxnOutputType -- | JSON of "multisig" received. TxnMultisig :: TxnOutputType -- | A public key of someone we sent money to. data ScriptPubKey NonStandardScriptPubKey :: HexString -> HexString -> ScriptPubKey -- | The JSON "asm" field. nspkAsm :: ScriptPubKey -> HexString -- | The JSON "hex" field. nspkHex :: ScriptPubKey -> HexString StandardScriptPubKey :: HexString -> HexString -> Integer -> TxnOutputType -> Vector Address -> ScriptPubKey -- | The JSON "asm" field. sspkAsm :: ScriptPubKey -> HexString -- | The JSON "hex" field. sspkHex :: ScriptPubKey -> HexString -- | The number of required signatures. requiredSigs :: ScriptPubKey -> Integer -- | The type of the transaction. sspkType :: ScriptPubKey -> TxnOutputType -- | The addresses associated with this key. sspkAddresses :: ScriptPubKey -> Vector Address -- | A transaction out of an account. data TxOut TxOut :: BTC -> ScriptPubKey -> TxOut -- | The amount of bitcoin transferred out. txoutVal :: TxOut -> BTC -- | The public key of the account we sent the money to. scriptPubKey :: TxOut -> ScriptPubKey -- | Information on a single block. data BlockInfo ConfirmedBlock :: Integer -> Integer -> Integer -> BlockInfo -- | The number of confirmations a block has. This will always be >= 1. confirmations :: BlockInfo -> Integer cbTime :: BlockInfo -> Integer -- | The JSON "blocktime" field. blockTime :: BlockInfo -> Integer -- | An unconfirmed block is boring, but a possibility. UnconfirmedBlock :: BlockInfo -- | The raw transaction info for a given transaction ID. data RawTransactionInfo RawTransactionInfo :: RawTransaction -> Integer -> Integer -> Vector TxIn -> Vector TxOut -> HexString -> BlockInfo -> RawTransactionInfo -- | The raw transaction. raw :: RawTransactionInfo -> RawTransaction -- | The transaction version number. txnVersion :: RawTransactionInfo -> Integer txnLockTime :: RawTransactionInfo -> Integer -- | The vector of transactions in. vin :: RawTransactionInfo -> Vector TxIn -- | The vector of transactions out. vout :: RawTransactionInfo -> Vector TxOut -- | The hash of the block that was used for this transaction. rawTxBlockHash :: RawTransactionInfo -> HexString -- | The transaction's block's info. rawBlockInfo :: RawTransactionInfo -> BlockInfo -- | Get raw transaction info for a given transaction ID. The data -- structure returned is quite sprawling and undocumented, so any patches -- to help simplify things would be greatly appreciated. getRawTransactionInfo :: Client -> TransactionID -> IO RawTransactionInfo data UnspentTransaction UnspentTransaction :: TransactionID -> Integer -> Address -> HexString -> Maybe HexString -> BTC -> Integer -> UnspentTransaction unspentTransactionId :: UnspentTransaction -> TransactionID outIdx :: UnspentTransaction -> Integer unspentAddress :: UnspentTransaction -> Address unspentScriptPubKey :: UnspentTransaction -> HexString redeemScript :: UnspentTransaction -> Maybe HexString unspentAmount :: UnspentTransaction -> BTC usConfirmations :: UnspentTransaction -> Integer -- | Returns an array of unspent transaction outputs with between minconf -- and maxconf (inclusive) confirmations. If addresses are given, the -- result will be filtered to include only those addresses. listUnspent :: Client -> Maybe Int -> Maybe Int -> Vector Address -> IO (Vector UnspentTransaction) -- | Create a transaction spending given inputs, sending to given -- addresses. -- -- Note that the transaction's inputs are not signed, and it is not -- stored in the wallet or transmitted to the network. -- -- Also, there is no checking to see if it's possible to send that much -- to the targets specified. In the future, such a scenario might throw -- an exception. createRawTransaction :: Client -> Vector UnspentTransaction -> Vector (Address, BTC) -> IO HexString -- | A successfully decoded raw transaction, from a given serialized, -- hex-encoded transaction. data DecodedRawTransaction DecodedRawTransaction :: RawTransaction -> Integer -> Integer -> Vector TxIn -> Vector TxOut -> DecodedRawTransaction -- | The raw transaction. decRaw :: DecodedRawTransaction -> RawTransaction -- | The transaction version number. decTxnVersion :: DecodedRawTransaction -> Integer decTxnLockTime :: DecodedRawTransaction -> Integer -- | The vector of transactions in. decVin :: DecodedRawTransaction -> Vector TxIn -- | The vector of transactions out. decVout :: DecodedRawTransaction -> Vector TxOut -- | Decodes a raw transaction into a more accessible data structure. decodeRawTransaction :: Client -> RawTransaction -> IO DecodedRawTransaction -- | Who can pay for a given transaction. data WhoCanPay All :: WhoCanPay AllOrAnyoneCanPay :: WhoCanPay None :: WhoCanPay NoneOrAnyoneCanPay :: WhoCanPay Single :: WhoCanPay SingleOrAnyoneCanPay :: WhoCanPay -- | A raw signed transaction contains the raw, signed hexstring and -- whether or not this transaction has a complete signature set. data RawSignedTransaction RawSignedTransaction :: HexString -> Bool -> RawSignedTransaction rawSigned :: RawSignedTransaction -> HexString hasCompleteSigSet :: RawSignedTransaction -> Bool -- | Sign inputs for a raw transaction. signRawTransaction :: Client -> RawTransaction -> Maybe (Vector UnspentTransaction) -> Maybe (Vector HexString) -> Maybe WhoCanPay -> IO RawSignedTransaction sendRawTransaction :: Client -> RawTransaction -> IO TransactionID -- | A plethora of information about a bitcoind instance. data BitcoindInfo BitcoindInfo :: Integer -> Integer -> Integer -> BTC -> Integer -> Integer -> Text -> Double -> Bool -> Integer -> Integer -> BTC -> Maybe Integer -> Text -> BitcoindInfo -- | What version of bitcoind are we running? bitcoinVersion :: BitcoindInfo -> Integer -- | What is bitcoind's current protocol number? protocolVersion :: BitcoindInfo -> Integer -- | What version is the wallet? walletVersion :: BitcoindInfo -> Integer -- | How much money is currently in the wallet? balance :: BitcoindInfo -> BTC -- | The number of blocks in our chain. numBlocks :: BitcoindInfo -> Integer -- | How many peers are we connected to? numConnections :: BitcoindInfo -> Integer -- | A blank string if we're not using a proxy. proxy :: BitcoindInfo -> Text -- | The difficulty multiplier for bitcoin mining operations. generationDifficulty :: BitcoindInfo -> Double -- | Are we on the test network (as opposed to the primary bitcoin -- network)? onTestNetwork :: BitcoindInfo -> Bool -- | The timestamp of the oldest key in the key pool. keyPoolOldest :: BitcoindInfo -> Integer -- | The size of the key pool. keyPoolSize :: BitcoindInfo -> Integer -- | How much do we currently pay as a transaction fee? transactionFeePaid :: BitcoindInfo -> BTC -- | If the wallet is unlocked, the number of seconds until a re-lock is -- needed. unlockedUntil :: BitcoindInfo -> Maybe Integer -- | Any alerts will show up here. This should normally be an empty string. bitcoindErrors :: BitcoindInfo -> Text -- | Returns an object containing various state info. getBitcoindInfo :: Client -> IO BitcoindInfo -- | Returns a new bitcoin address for receiving payments. -- -- If an account is specified (recommended), the new address is added to -- the address book so payments received with the address will be -- credited to the given account. -- -- If no account is specified, the address will be credited to the -- account whose name is the empty string. i.e. the default account. getNewAddress :: Client -> Maybe Account -> IO Address -- | Returns the current Bitcoin address for receiving payments to the -- given account. getAccountAddress :: Client -> Account -> IO Address -- | Returns the account associated with the given address. getAccount :: Client -> Address -> IO Account -- | Sets the account associated with the given address. setAccount :: Client -> Address -> Account -> IO () -- | Returns the list of addresses for the given address. getAddressesByAccount :: Client -> Account -> IO (Vector Address) -- | Sends some bitcoins to an address. sendToAddress :: Client -> Address -> BTC -> Maybe Text -> Maybe Text -> IO TransactionID -- | Information on a given address. data AddressInfo AddressInfo :: Address -> BTC -> Maybe Account -> AddressInfo -- | The address in question. aiAddress :: AddressInfo -> Address -- | The address' balance. aiAmount :: AddressInfo -> BTC -- | The address' linked account. aiAccount :: AddressInfo -> Maybe Account -- | Lists groups of addresses which have had their common ownership made -- public by common use as inputs or as the resulting change in past -- transactions. listAddressGroupings :: Client -> IO (Vector (Vector AddressInfo)) -- | A signature is a base-64 encoded string. type Signature = HexString -- | Sign a message with the private key of an address. signMessage :: Client -> Address -> Text -> IO Signature -- | Verifies a signed message. verifyMessage :: Client -> Address -> Signature -> Text -> IO Bool -- | Returns the total amount received by the given address with at least -- one confirmation. getReceivedByAddress :: Client -> Address -> IO BTC -- | Returns the total amount received by the given address, with at least -- the give number of confirmations. getReceivedByAddress' :: Client -> Address -> Int -> IO BTC -- | Returns the total amount received by address with the given account. getReceivedByAccount :: Client -> Account -> IO BTC -- | Returns the total amount received by addresses with the given account, -- counting only transactions with the given minimum number of -- confirmations. getReceivedByAccount' :: Client -> Account -> Int -> IO BTC -- | Returns the server's total available balance. getBalance :: Client -> IO BTC -- | Returns the balance in the given account, counting only transactions -- with at least one confirmation. getBalance' :: Client -> Account -> IO BTC -- | Returns the balance in the given account, counting only transactions -- with at least the given number of confirmations. getBalance'' :: Client -> Account -> Int -> IO BTC -- | Move bitcoins from one account in your wallet to another. -- -- If you want to send bitcoins to an address not in your wallet, use -- sendFromAccount. moveBitcoins :: Client -> Account -> Account -> BTC -> Text -> IO () -- | Sends bitcoins from a given account in our wallet to a given address. -- -- A transaction and sender comment may be optionally provided. sendFromAccount :: Client -> Account -> Address -> BTC -> Maybe Text -> Maybe Text -> IO TransactionID -- | Send to a whole bunch of address at once. sendMany :: Client -> Account -> Vector (Address, BTC) -> Maybe Text -> IO TransactionID -- | Information on how much was received by a given address. data ReceivedByAddress ReceivedByAddress :: Address -> Account -> BTC -> Integer -> ReceivedByAddress -- | The address which the money was deposited to. recvAddress :: ReceivedByAddress -> Address -- | The account which this address belongs to. recvAccount :: ReceivedByAddress -> Account -- | The amount received. recvAmount :: ReceivedByAddress -> BTC -- | The number of confirmations of the most recent included transaction. recvNumConfirmations :: ReceivedByAddress -> Integer -- | Lists the amount received by each address which has received money at -- some point, counting only transactions with at least one confirmation. listReceivedByAddress :: Client -> IO (Vector ReceivedByAddress) -- | List the amount received by each of our addresses, counting only -- transactions with the given minimum number of confirmations. listReceivedByAddress' :: Client -> Int -> Bool -> IO (Vector ReceivedByAddress) data ReceivedByAccount ReceivedByAccount :: Account -> BTC -> Integer -> ReceivedByAccount -- | The account we received into. raccAccount :: ReceivedByAccount -> Account -- | The mount received. ^ The number of confirmations of the most recent -- included transaction. raccAmount :: ReceivedByAccount -> BTC raccNumConfirmations :: ReceivedByAccount -> Integer -- | Lists the amount received by each account which has received money at -- some point, counting only transactions with at leaset one -- confirmation. listReceivedByAccount :: Client -> IO (Vector ReceivedByAccount) -- | List the amount received by each of our accounts, counting only -- transactions with the given minimum number of confirmations. listReceivedByAccount' :: Client -> Int -> Bool -> IO (Vector ReceivedByAccount) -- | Returns transactions from the blockchain. listTransactions :: Client -> Account -> Int -> Int -> IO (Vector SimpleTransaction) -- | Returns transactions from the blockchain. listTransactions' :: Client -> Maybe Account -> Maybe Int -> Maybe Int -> IO (Vector SimpleTransaction) -- | List accounts and their current balance. listAccounts :: Client -> Maybe Int -> IO (HashMap Account BTC) data SinceBlock SinceBlock :: Vector SimpleTransaction -> BlockHash -> SinceBlock strransactions :: SinceBlock -> Vector SimpleTransaction sbLastBlockHash :: SinceBlock -> BlockHash -- | Data type for simple transactions. Rules involving Maybe are -- indications of the most probable value only when the transaction is -- obtained from listTransactions or listSinceBlock are -- their associated methods. They are never enforced on this side. data SimpleTransaction SimpleTransaction :: Account -> Maybe Address -> TransactionCategory -> Maybe BTC -> BTC -> Maybe Integer -> Maybe BlockHash -> Maybe Integer -> Maybe POSIXTime -> Maybe TransactionID -> Maybe (Vector TransactionID) -> POSIXTime -> Maybe POSIXTime -> Maybe Text -> Maybe Text -> Maybe Account -> SimpleTransaction -- | The account name associated with the transaction. The empty string is -- the default account. stReceivingAccount :: SimpleTransaction -> Account -- | The bitcoin address of the transaction. Is Nothing unless -- trCategory is TCSend or TCReceive. stAddress :: SimpleTransaction -> Maybe Address -- | The category of the transaction stCategory :: SimpleTransaction -> TransactionCategory -- | The fees paid to process the transaction. Is Nothing unless -- trCategory is TCSend or TCReceive. stFee :: SimpleTransaction -> Maybe BTC -- | The amount of bitcoins transferred. stAmount :: SimpleTransaction -> BTC -- | The number of confirmations of the transaction. Is Nothing -- unless trCategory is TCSend or TCReceive. stConfirmations :: SimpleTransaction -> Maybe Integer -- | The hash of the block containing the transaction. Is Nothing -- unless trCategory is TCSend or TCReceive. stBlockHash :: SimpleTransaction -> Maybe BlockHash -- | The index of the the block containing the transaction. Is -- Nothing unless trCategory is TCSend or -- TCReceive. stBlockIndex :: SimpleTransaction -> Maybe Integer -- | The block time in seconds since epoch (1 Jan 1970 GMT). Is -- Nothing unless trCategory is TCSend or -- TCReceive. stBlockTime :: SimpleTransaction -> Maybe POSIXTime -- | The transaction id. Is Nothing unless trCategory is -- TCSend or TCReceive. stTransactionId :: SimpleTransaction -> Maybe TransactionID -- | The list of transaction ids containing the same data as the original -- transaction (See ID-malleation bug). Is Nothing unless -- trCategory is TCSend or TCReceive. stWalletConflicts :: SimpleTransaction -> Maybe (Vector TransactionID) -- | The block time in seconds since epoch (1 Jan 1970 GMT). stTime :: SimpleTransaction -> POSIXTime stTimeReceived :: SimpleTransaction -> Maybe POSIXTime -- | Is Nothing unless a comment is associated with the transaction. stComment :: SimpleTransaction -> Maybe Text -- | Is Nothing unless a "to" is associated with the transaction. stTo :: SimpleTransaction -> Maybe Text -- | The account the funds came from (for receiving funds, positive -- amounts), or went to (for sending funds, negative amounts). Is -- Nothing unless trCategory is TCMove. stOtherAccount :: SimpleTransaction -> Maybe Account data TransactionCategory TCSend :: TransactionCategory TCOrphan :: TransactionCategory TCImmature :: TransactionCategory TCGenerate :: TransactionCategory TCReceive :: TransactionCategory TCMove :: TransactionCategory TCErrorUnexpected :: Text -> TransactionCategory -- | Gets all transactions in blocks since the given block. listSinceBlock :: Client -> BlockHash -> Maybe Int -> IO (SinceBlock) -- | Gets all transactions in blocks since the given block, or all -- transactions if ommited. listSinceBlock' :: Client -> Maybe BlockHash -> Maybe Int -> IO (SinceBlock) -- | Data type for detailed transactions. Rules involving -- trCategory are indications of the most probable value only -- when the transaction is obtained from listTransactions or -- listSinceBlock are their associated methods. data DetailedTransaction DetailedTransaction :: BTC -> Maybe BTC -> Maybe Integer -> Maybe TransactionID -> Maybe (Vector TransactionID) -> POSIXTime -> Maybe POSIXTime -> Maybe Text -> Maybe Text -> Vector DetailedTransactionDetails -> RawTransaction -> DetailedTransaction -- | The amount of bitcoins transferred. dtAmount :: DetailedTransaction -> BTC -- | The fees paid to process the transaction. Is Nothing unless -- trCategory is TCSend or TCReceive. dtFee :: DetailedTransaction -> Maybe BTC -- | The number of confirmations of the transaction. Is Nothing -- unless trCategory is TCSend or TCReceive. dtConfirmations :: DetailedTransaction -> Maybe Integer -- | The transaction id. Is Nothing unless trCategory is -- TCSend or TCReceive. dtTransactionId :: DetailedTransaction -> Maybe TransactionID -- | The list of transaction ids containing the same data as the original -- transaction (See ID-malleation bug). Is Nothing unless -- trCategory is TCSend or TCReceive. dtWalletConflicts :: DetailedTransaction -> Maybe (Vector TransactionID) -- | The block time in seconds since epoch (1 Jan 1970 GMT). dtTime :: DetailedTransaction -> POSIXTime dtTimeReceived :: DetailedTransaction -> Maybe POSIXTime -- | Is Nothing unless a comment is associated with the transaction. dtComment :: DetailedTransaction -> Maybe Text -- | Is Nothing unless a "to" is associated with the transaction. dtTo :: DetailedTransaction -> Maybe Text -- | The details of the transaction. dtDetails :: DetailedTransaction -> Vector DetailedTransactionDetails -- | Raw data for the transaction. dtHex :: DetailedTransaction -> RawTransaction data DetailedTransactionDetails DetailedTransactionDetails :: Account -> Address -> TransactionCategory -> BTC -> DetailedTransactionDetails -- | The account name associated with the transaction. The empty string is -- the default account. dtdReceivingAccount :: DetailedTransactionDetails -> Account -- | The bitcoin address of the transaction. dtdAddress :: DetailedTransactionDetails -> Address -- | The category of the transaction dtdCategory :: DetailedTransactionDetails -> TransactionCategory -- | The amount of bitcoins transferred. dtdAmount :: DetailedTransactionDetails -> BTC getTransaction :: Client -> TransactionID -> IO (DetailedTransaction) -- | Safely copies wallet.dat to the given destination, which can be either -- a directory, or a path with filename. backupWallet :: Client -> FilePath -> IO () -- | Fills the keypool. keyPoolRefill :: Client -> IO () -- | Stores the wallet decryption key in memory for the given amount of -- time. unlockWallet :: Client -> Text -> Integer -> IO () -- | Removes the wallet encryption key from memory, locking the wallet. -- -- After calling this function, you will need to call unlockWallet -- again before being able to call methods which require the wallet to be -- unlocked. -- -- Note: In future releases, we might introduce an "unlocked" monad, so -- locking and unlocking is automatic. lockWallet :: Client -> IO () -- | Changes the wallet passphrase. changePassword :: Client -> Text -> Text -> IO () -- | Encrypts the wallet with the given passphrase. -- -- WARNING: bitcoind will shut down after calling this method. Don't say -- I didn't warn you. encryptWallet :: Client -> Text -> IO () -- | Checks if a given address is a valid one. isAddressValid :: Client -> Address -> IO Bool