bitcoin-payment-channel-0.1.0.0: Library for working with Bitcoin payment channels

Copyright(c) Rune K. Svendsen, 2016
LicensePublicDomain
Maintainerrunesvend@gmail.com
Safe HaskellNone
LanguageHaskell2010

Data.Bitcoin.PaymentChannel.Types

Description

Types used with the interface provided by Data.Bitcoin.PaymentChannel.

Synopsis

Documentation

data SenderPaymentChannel Source

State object for the value sender

Constructors

CSenderPaymentChannel 

Fields

spcState :: PaymentChannelState

Internal state object

spcSignFunc :: Hash256 -> Signature

Used to sign payments from sender. This function, when given a Hash256, produces a signature that verifies against cpSenderPubKey.

data ReceiverPaymentChannel Source

State object for the value receiver

Constructors

CReceiverPaymentChannel 

Fields

rpcState :: PaymentChannelState

Internal state object

rpcVerifyFunc :: Hash256 -> PubKey -> Signature -> Bool

Used to verify signatures from value sender.

rpcSignFunc :: Hash256 -> Signature

Function which produces a signature that verifies against cpReceiverPubKey. Used to produce the Bitcoin transaction that closes the channel.

data Payment Source

Used to transfer value from sender to receiver.

Instances

data FundingTxInfo Source

Holds information about the Bitcoin transaction used to fund the channel

Constructors

CFundingTxInfo 

Fields

ftiHash :: TxHash

Hash of funding transaction.

ftiOutIndex :: Word32

Index/"vout" of funding output

ftiOutValue :: BitcoinAmount

Value of funding output (channel max value)

data ChannelParameters Source

Defines the sender, receiver, and expiration date for the channel

Constructors

CChannelParameters 

Fields

cpSenderPubKey :: PubKey
 
cpReceiverPubKey :: PubKey
 
cpLockTime :: BitcoinLockTime

Channel expiration date/time

data BitcoinAmount Source

Represents a bitcoin amount as number of satoshis. 1 satoshi = 1e-8 bitcoins. Integer operations will never over- or underflow with this type. Convert to a Word64 using toWord64, which caps the final amount.

toWord64 :: BitcoinAmount -> Word64 Source

Convert to Word64, with zero as floor, UINT64_MAX as ceiling

class PaymentChannel a where Source

Get various information about an open payment channel.

Minimal complete definition

valueToMe, getChannelState

Methods

valueToMe :: a -> BitcoinAmount Source

Get value sent to receiver/left for sender

getChannelState :: a -> PaymentChannelState Source

Retrieve internal channel state

getChannelID :: a -> TxHash Source

Get channel ID

channelIsExhausted :: a -> Bool Source

Returns True if all available channel value has been transferred, False otherwise

data BitcoinLockTime Source

Data type representing a Bitcoin LockTime, which specifies a point in time. Derive a BitcoinLockTime from a UTCTime using fromDate.