Safe Haskell | None |
---|---|
Language | Haskell2010 |
- nowishTimestamp :: UTCTime
- mIN_CHANNEL_SIZE :: BitcoinAmount
- data ArbChannelPair = ArbChannelPair SenderPaymentChannel ReceiverPaymentChannel [BitcoinAmount] [BitcoinAmount] (Hash256 -> Signature)
- doPayment :: ArbChannelPair -> BitcoinAmount -> ArbChannelPair
- mkChanParams :: Gen (ChannelParameters, (PrvKeyC, PrvKeyC))
- mkChanPair :: Gen (ArbChannelPair, FullPayment)
- module Data.Bitcoin.PaymentChannel
- module Data.Bitcoin.PaymentChannel.Types
- data PaymentChannelState = CPaymentChannelState {}
- data ChannelParameters = CChannelParameters {}
- data FundingTxInfo = CFundingTxInfo {}
- data PaymentTxConfig = CPaymentTxConfig {}
- data Config = Config {}
- data Payment = CPayment {}
- data FullPayment = CFullPayment {}
- data PaymentSignature = CPaymentSignature {}
- newtype ChanScript = ChanScript {}
- type PayChanState = PaymentChannelState
- type ChanParams = ChannelParameters
- type ReceiverPaymentChannel = ReceiverPaymentChannelI ()
- type ReceiverPaymentChannelX = ReceiverPaymentChannelI XPubKey
- data ReceiverPaymentChannelI pkInfo = CReceiverPaymentChannel {
- rpcState :: PaymentChannelState
- rpcPubKeyInfo :: pkInfo
- rpcGetXPub :: ReceiverPaymentChannelI pkInfo -> pkInfo
- type Hour = Tagged "Hour" Word32
- toSeconds :: Hour -> Integer
- defaultConfig :: Config
- defaultDustLimit :: BitcoinAmount
- defaultSettlementPeriod :: Hour
- newtype BitcoinAmount = BitcoinAmount Integer
- capTo21Mill :: Integer -> Word64
- data BitcoinLockTime
- parseBitcoinLocktime :: Word32 -> BitcoinLockTime
- toWord32 :: BitcoinLockTime -> Word32
- fromDate :: UTCTime -> BitcoinLockTime
- usesBlockHeight :: BitcoinLockTime -> Bool
- class Serialize a => IsPubKey a where
- newtype SendPubKey = MkSendPubKey {}
- newtype RecvPubKey = MkRecvPubKey {}
- module Network.Haskoin.Transaction
- module Network.Haskoin.Crypto
- module Network.Haskoin.Script
- pcsChannelTotalValue :: PaymentChannelState -> BitcoinAmount
- pcsValueTransferred :: PaymentChannelState -> BitcoinAmount
- pcsChannelValueLeft :: PaymentChannelState -> BitcoinAmount
- pcsClientPubKey :: PaymentChannelState -> SendPubKey
- pcsServerPubKey :: PaymentChannelState -> RecvPubKey
- pcsDustLimit :: PaymentChannelState -> BitcoinAmount
- pcsExpirationDate :: PaymentChannelState -> BitcoinLockTime
- pcsClientChangeAddress :: PaymentChannelState -> Address
- pcsClientChangeScriptPubKey :: PaymentChannelState -> ByteString
- pcsLockTime :: PaymentChannelState -> BitcoinLockTime
- pcsPrevOut :: PaymentChannelState -> OutPoint
- pcsChannelFundingSource :: PaymentChannelState -> OutPoint
- pcsGetPayment :: PaymentChannelState -> Payment
- setClientChangeAddress :: PaymentChannelState -> Address -> PaymentChannelState
- setFundingSource :: PaymentChannelState -> FundingTxInfo -> PaymentChannelState
- channelValueLeft :: PaymentChannelState -> BitcoinAmount
- channelIsExhausted :: PaymentChannelState -> Bool
- newPaymentChannelState :: Config -> ChannelParameters -> FundingTxInfo -> PaymentTxConfig -> PaymentSignature -> PaymentChannelState
- updatePaymentChannelState :: PaymentChannelState -> FullPayment -> Either PayChanError PaymentChannelState
- mkExtendedKeyRPC :: ReceiverPaymentChannel -> XPubKey -> Maybe ReceiverPaymentChannelX
- checkDustLimit :: Config -> Payment -> Either PayChanError Payment
- isPastLockTimeDate :: UTCTime -> Config -> ChannelParameters -> Bool
Documentation
data ArbChannelPair Source #
mkChanParams :: Gen (ChannelParameters, (PrvKeyC, PrvKeyC)) Source #
module Data.Bitcoin.PaymentChannel
data PaymentChannelState Source #
Shared state object used by both value sender and value receiver.
CPaymentChannelState | |
|
data ChannelParameters Source #
Defines channel: sender, receiver, and expiration date
CChannelParameters | |
|
data FundingTxInfo Source #
Holds information about the Bitcoin transaction used to fund the channel
CFundingTxInfo | |
|
data PaymentTxConfig Source #
Holds information about how to construct the payment transaction
CPaymentTxConfig | |
|
Miscellaneous configuration options
Config | |
|
Contains the bare minimum of information to transfer value from sender to receiver.
CPayment | |
|
data FullPayment Source #
Contains all information required to construct the payment transaction
CFullPayment | |
|
newtype ChanScript Source #
Wraps a Network.Haskoin.Script.Script
type PayChanState = PaymentChannelState Source #
type ChanParams = ChannelParameters Source #
type ReceiverPaymentChannel = ReceiverPaymentChannelI () Source #
ReceiverPaymentChannel without public key metadata
type ReceiverPaymentChannelX = ReceiverPaymentChannelI XPubKey Source #
ReceiverPaymentChannel with BIP32 , "extended" public key metadata
data ReceiverPaymentChannelI pkInfo Source #
State object for the value receiver. pkInfo holds optional, extra data associated with the receiver public key
CReceiverPaymentChannel | |
|
rpcGetXPub :: ReceiverPaymentChannelI pkInfo -> pkInfo Source #
newtype BitcoinAmount Source #
Represents a bitcoin amount as number of satoshis.
1 satoshi = 1e-8 bitcoin. 1e8 satohis = 1 bitcoin.
Only amounts >= 0 can be represented, and fromInteger
caps to a Word64
.
It is thus not possible to eg. construct a negative BitcoinAmount which, when added to
another BitcoinAmount, subtracts from its value. Adding two large amounts together will
never overflow, nor will subtraction underflow.
capTo21Mill :: Integer -> Word64 Source #
Convert to 21 million, zero as floor
data BitcoinLockTime Source #
Data type representing a Bitcoin LockTime, which specifies a point in time.
Derive a BitcoinLockTime
from a UTCTime
using fromDate
.
LockTimeBlockHeight Word32 | A value of "n" represents the point in time at which Bitcoin block number "n" appears |
LockTimeDate UTCTime | Specifies a point in time using a timestamp with 1-second accuracy |
parseBitcoinLocktime :: Word32 -> BitcoinLockTime Source #
Convert from Bitcoin format (Word32
)
toWord32 :: BitcoinLockTime -> Word32 Source #
Convert to Bitcoin format (uint32 UNIX timestamp)
fromDate :: UTCTime -> BitcoinLockTime Source #
Convert a UTCTime
to a BitcoinLockTime
newtype SendPubKey Source #
Wrapper for value sender's public key
newtype RecvPubKey Source #
Wrapper for value receiver's public key
module Network.Haskoin.Transaction
module Network.Haskoin.Crypto
module Network.Haskoin.Script
setClientChangeAddress :: PaymentChannelState -> Address -> PaymentChannelState Source #
Set new client/sender change address. Use this function if the client wishes to change its change address. First set the new change address using this function, then accept the payment which uses this new change address.
channelValueLeft :: PaymentChannelState -> BitcoinAmount Source #
We subtract the specified "dust" limit from the total available value. This avoids creating a Bitcoin transaction that won't circulate in the Bitcoin P2P network.
newPaymentChannelState :: Config -> ChannelParameters -> FundingTxInfo -> PaymentTxConfig -> PaymentSignature -> PaymentChannelState Source #
updatePaymentChannelState :: PaymentChannelState -> FullPayment -> Either PayChanError PaymentChannelState Source #
Update state with verified payment.
mkExtendedKeyRPC :: ReceiverPaymentChannel -> XPubKey -> Maybe ReceiverPaymentChannelX Source #
Create a ReceiverPaymentChannelX
, which has an associated XPubKey, from a
ReceiverPaymentChannel
checkDustLimit :: Config -> Payment -> Either PayChanError Payment Source #
isPastLockTimeDate :: UTCTime -> Config -> ChannelParameters -> Bool Source #