Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Store = Store {
- storeManager :: !Manager
- storeChain :: !Chain
- storeBlock :: !BlockStore
- storePublisher :: !(Publisher StoreEvent)
- type BlockStore = Inbox BlockMessage
- data Output = Output {
- outputValue :: !Word64
- outBlock :: !(Maybe BlockRef)
- outScript :: !ByteString
- outSpender :: !(Maybe Spender)
- data Spender = Spender {
- spenderHash :: !TxHash
- spenderIndex :: !Word32
- spenderBlock :: !(Maybe BlockRef)
- data BlockRef = BlockRef {}
- data StoreConfig = StoreConfig {
- storeConfMaxPeers :: !Int
- storeConfInitPeers :: ![HostPort]
- storeConfDiscover :: !Bool
- storeConfDB :: !DB
- storeConfNetwork :: !Network
- data StoreEvent
- data BlockValue = BlockValue {}
- data DetailedTx = DetailedTx {
- detailedTxData :: !Tx
- detailedTxFee :: !Word64
- detailedTxInputs :: ![DetailedInput]
- detailedTxOutputs :: ![DetailedOutput]
- detailedTxBlock :: !(Maybe BlockRef)
- data DetailedInput
- = DetailedCoinbase { }
- | DetailedInput {
- detInOutPoint :: !OutPoint
- detInSequence :: !Word32
- detInSigScript :: !ByteString
- detInPkScript :: !ByteString
- detInValue :: !Word64
- detInBlock :: !(Maybe BlockRef)
- detInNetwork :: !Network
- data DetailedOutput = DetailedOutput {
- detOutValue :: !Word64
- detOutScript :: !ByteString
- detOutSpender :: !(Maybe Spender)
- detOutNetwork :: !Network
- newtype NewTx = NewTx {}
- data AddrOutput = AddrOutput {
- addrOutputKey :: !AddrOutKey
- addrOutput :: !Output
- data AddressBalance = AddressBalance {}
- data TxException
- data PeerInformation = PeerInformation {
- userAgent :: !ByteString
- address :: !ByteString
- connected :: !Bool
- version :: !Word32
- services :: !Word64
- relay :: !Bool
- block :: !BlockHash
- height :: !BlockHeight
- nonceLocal :: !Word64
- nonceRemote :: !Word64
- withStore :: (MonadLoggerIO m, MonadUnliftIO m) => StoreConfig -> (Store -> m a) -> m a
- getBestBlock :: MonadIO m => DB -> Snapshot -> m BlockValue
- getBlockAtHeight :: MonadIO m => BlockHeight -> DB -> Snapshot -> m (Maybe BlockValue)
- getBlock :: MonadIO m => BlockHash -> DB -> Snapshot -> m (Maybe BlockValue)
- getBlocks :: MonadIO m => [BlockHash] -> DB -> Snapshot -> m [BlockValue]
- getTx :: MonadUnliftIO m => Network -> TxHash -> DB -> Snapshot -> m (Maybe DetailedTx)
- getAddrTxs :: (MonadResource m, MonadUnliftIO m) => Network -> Address -> Maybe BlockHeight -> DB -> Snapshot -> ConduitT () DetailedTx m ()
- getUnspent :: (MonadResource m, MonadUnliftIO m) => Address -> Maybe BlockHeight -> DB -> Snapshot -> ConduitT () AddrOutput m ()
- getBalance :: MonadIO m => Address -> DB -> Snapshot -> m AddressBalance
- getMempool :: MonadUnliftIO m => DB -> Snapshot -> m [TxHash]
- getPeersInformation :: MonadIO m => Manager -> m [PeerInformation]
- publishTx :: (MonadUnliftIO m, MonadLoggerIO m) => Network -> Store -> DB -> Tx -> m (Either TxException DetailedTx)
Documentation
Store mailboxes.
Store | |
|
type BlockStore = Inbox BlockMessage Source #
Mailbox for block store.
Output data.
Output | |
|
Information about input spending output.
Spender | |
|
Reference to a block where a transaction is stored.
BlockRef | |
|
data StoreConfig Source #
Configuration for a Store
.
StoreConfig | |
|
data StoreEvent Source #
Event that the store can generate.
BestBlock !BlockHash | new best block |
MempoolNew !TxHash | new mempool transaction |
TxException !TxHash !TxException | published tx could not be imported |
PeerConnected !Peer | new peer connected |
PeerDisconnected !Peer | peer has disconnected |
PeerPong !Peer !Word64 | peer responded |
data BlockValue Source #
Database value for a block entry.
BlockValue | |
|
Instances
data DetailedTx Source #
Detailed transaction information.
DetailedTx | |
|
Instances
Eq DetailedTx Source # | |
Defined in Network.Haskoin.Store.Types (==) :: DetailedTx -> DetailedTx -> Bool # (/=) :: DetailedTx -> DetailedTx -> Bool # | |
Show DetailedTx Source # | |
Defined in Network.Haskoin.Store.Types showsPrec :: Int -> DetailedTx -> ShowS # show :: DetailedTx -> String # showList :: [DetailedTx] -> ShowS # | |
ToJSON DetailedTx Source # | |
Defined in Network.Haskoin.Store.Types toJSON :: DetailedTx -> Value # toEncoding :: DetailedTx -> Encoding # toJSONList :: [DetailedTx] -> Value # toEncodingList :: [DetailedTx] -> Encoding # |
data DetailedInput Source #
Input information.
DetailedCoinbase | coinbase input details |
| |
DetailedInput | regular input details |
|
Instances
Eq DetailedInput Source # | |
Defined in Network.Haskoin.Store.Types (==) :: DetailedInput -> DetailedInput -> Bool # (/=) :: DetailedInput -> DetailedInput -> Bool # | |
Show DetailedInput Source # | |
Defined in Network.Haskoin.Store.Types showsPrec :: Int -> DetailedInput -> ShowS # show :: DetailedInput -> String # showList :: [DetailedInput] -> ShowS # | |
ToJSON DetailedInput Source # | |
Defined in Network.Haskoin.Store.Types toJSON :: DetailedInput -> Value # toEncoding :: DetailedInput -> Encoding # toJSONList :: [DetailedInput] -> Value # toEncodingList :: [DetailedInput] -> Encoding # |
data DetailedOutput Source #
Output information.
DetailedOutput | |
|
Instances
Eq DetailedOutput Source # | |
Defined in Network.Haskoin.Store.Types (==) :: DetailedOutput -> DetailedOutput -> Bool # (/=) :: DetailedOutput -> DetailedOutput -> Bool # | |
Show DetailedOutput Source # | |
Defined in Network.Haskoin.Store.Types showsPrec :: Int -> DetailedOutput -> ShowS # show :: DetailedOutput -> String # showList :: [DetailedOutput] -> ShowS # | |
ToJSON DetailedOutput Source # | |
Defined in Network.Haskoin.Store.Types toJSON :: DetailedOutput -> Value # toEncoding :: DetailedOutput -> Encoding # toJSONList :: [DetailedOutput] -> Value # toEncodingList :: [DetailedOutput] -> Encoding # |
Wrapper for an transaction that can be deserialized from a JSON object.
data AddrOutput Source #
Address output.
AddrOutput | |
|
Instances
Eq AddrOutput Source # | |
Defined in Network.Haskoin.Store.Types (==) :: AddrOutput -> AddrOutput -> Bool # (/=) :: AddrOutput -> AddrOutput -> Bool # | |
Ord AddrOutput Source # | |
Defined in Network.Haskoin.Store.Types compare :: AddrOutput -> AddrOutput -> Ordering # (<) :: AddrOutput -> AddrOutput -> Bool # (<=) :: AddrOutput -> AddrOutput -> Bool # (>) :: AddrOutput -> AddrOutput -> Bool # (>=) :: AddrOutput -> AddrOutput -> Bool # max :: AddrOutput -> AddrOutput -> AddrOutput # min :: AddrOutput -> AddrOutput -> AddrOutput # | |
Show AddrOutput Source # | |
Defined in Network.Haskoin.Store.Types showsPrec :: Int -> AddrOutput -> ShowS # show :: AddrOutput -> String # showList :: [AddrOutput] -> ShowS # | |
ToJSON AddrOutput Source # | |
Defined in Network.Haskoin.Store.Types toJSON :: AddrOutput -> Value # toEncoding :: AddrOutput -> Encoding # toJSONList :: [AddrOutput] -> Value # toEncodingList :: [AddrOutput] -> Encoding # |
data AddressBalance Source #
Address balance information.
AddressBalance | |
|
Instances
Eq AddressBalance Source # | |
Defined in Network.Haskoin.Store.Types (==) :: AddressBalance -> AddressBalance -> Bool # (/=) :: AddressBalance -> AddressBalance -> Bool # | |
Show AddressBalance Source # | |
Defined in Network.Haskoin.Store.Types showsPrec :: Int -> AddressBalance -> ShowS # show :: AddressBalance -> String # showList :: [AddressBalance] -> ShowS # | |
ToJSON AddressBalance Source # | |
Defined in Network.Haskoin.Store.Types toJSON :: AddressBalance -> Value # toEncoding :: AddressBalance -> Encoding # toJSONList :: [AddressBalance] -> Value # toEncodingList :: [AddressBalance] -> Encoding # |
data TxException Source #
Reasons why a transaction may not get imported.
DoubleSpend | outputs already spent by another transaction |
OverSpend | outputs larger than inputs |
OrphanTx | inputs unknown |
NonStandard | non-standard transaction rejected by peer |
LowFee | pony up |
Dust | an output is too small |
NoPeers | no peers to send the transaction to |
InvalidTx | transaction is invalid in some other way |
CouldNotImport | could not import for an unknown reason |
PeerIsGone | the peer that got the transaction disconnected |
AlreadyImported | the transaction is already in the database |
PublishTimeout | some timeout was reached while publishing |
PeerRejectOther | peer rejected transaction for unknown reason |
NotAtHeight | this node is not yet synchronized |
Instances
Eq TxException Source # | |
Defined in Network.Haskoin.Store.Types (==) :: TxException -> TxException -> Bool # (/=) :: TxException -> TxException -> Bool # | |
Show TxException Source # | |
Defined in Network.Haskoin.Store.Types showsPrec :: Int -> TxException -> ShowS # show :: TxException -> String # showList :: [TxException] -> ShowS # | |
Exception TxException Source # | |
Defined in Network.Haskoin.Store.Types |
data PeerInformation Source #
PeerInformation | |
|
Instances
Eq PeerInformation Source # | |
Defined in Network.Haskoin.Store.Types (==) :: PeerInformation -> PeerInformation -> Bool # (/=) :: PeerInformation -> PeerInformation -> Bool # | |
Show PeerInformation Source # | |
Defined in Network.Haskoin.Store.Types showsPrec :: Int -> PeerInformation -> ShowS # show :: PeerInformation -> String # showList :: [PeerInformation] -> ShowS # | |
ToJSON PeerInformation Source # | |
Defined in Network.Haskoin.Store.Types toJSON :: PeerInformation -> Value # toEncoding :: PeerInformation -> Encoding # toJSONList :: [PeerInformation] -> Value # toEncodingList :: [PeerInformation] -> Encoding # |
withStore :: (MonadLoggerIO m, MonadUnliftIO m) => StoreConfig -> (Store -> m a) -> m a Source #
Run a Haskoin Store instance. It will launch a network node, a
BlockStore
, connect to the network and start synchronizing blocks and
transactions.
getBestBlock :: MonadIO m => DB -> Snapshot -> m BlockValue Source #
Get best block.
getBlockAtHeight :: MonadIO m => BlockHeight -> DB -> Snapshot -> m (Maybe BlockValue) Source #
Get one block at specified height.
getBlocks :: MonadIO m => [BlockHash] -> DB -> Snapshot -> m [BlockValue] Source #
Get blocks for specific hashes.
getTx :: MonadUnliftIO m => Network -> TxHash -> DB -> Snapshot -> m (Maybe DetailedTx) Source #
Get single transaction.
getAddrTxs :: (MonadResource m, MonadUnliftIO m) => Network -> Address -> Maybe BlockHeight -> DB -> Snapshot -> ConduitT () DetailedTx m () Source #
getUnspent :: (MonadResource m, MonadUnliftIO m) => Address -> Maybe BlockHeight -> DB -> Snapshot -> ConduitT () AddrOutput m () Source #
Get unspent outputs for an address.
getBalance :: MonadIO m => Address -> DB -> Snapshot -> m AddressBalance Source #
Get balance for an address.
getMempool :: MonadUnliftIO m => DB -> Snapshot -> m [TxHash] Source #
Get list of transactions in mempool.
getPeersInformation :: MonadIO m => Manager -> m [PeerInformation] Source #
publishTx :: (MonadUnliftIO m, MonadLoggerIO m) => Network -> Store -> DB -> Tx -> m (Either TxException DetailedTx) Source #
Publish a new transaction to the network.