bitcoin-payment-channel-0.4.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

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 state object

getChannelID :: a -> OutPoint Source #

getExpirationDate :: a -> BitcoinLockTime Source #

getSenderPubKey :: a -> SendPubKey Source #

getNewestPayment :: a -> Payment Source #

getNewestSig :: a -> Signature Source #

expiresBefore :: BitcoinLockTime -> a -> Bool Source #

Return True if channel expires earlier than given expiration date

_setChannelState :: a -> PaymentChannelState -> a Source #

For internal use

channelValueLeft :: a -> BitcoinAmount Source #

senderChangeValue :: a -> BitcoinAmount Source #

channelIsExhausted :: a -> Bool Source #

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

Instances

PaymentChannel ReceiverPaymentChannel Source # 
PaymentChannel SenderPaymentChannel Source # 
PaymentChannel MovableChan Source # 

newtype ReceiverPaymentChannel Source #

State object for the value receiver

Constructors

CReceiverPaymentChannel 

Fields

Instances

Eq ReceiverPaymentChannel Source # 
Show ReceiverPaymentChannel Source # 
ToJSON ReceiverPaymentChannel Source # 
FromJSON ReceiverPaymentChannel Source # 
Serialize ReceiverPaymentChannel Source # 
PaymentChannel ReceiverPaymentChannel Source # 

data Payment Source #

Used to transfer value from sender to receiver.

Instances

cpSignature :: Payment -> PaymentSignature Source #

Payment signature

data FullPayment Source #

Contains all information required to construct the payment transaction

Constructors

CFullPayment 

Fields

data FundingTxInfo Source #

Holds information about the Bitcoin transaction used to fund the channel

Constructors

CFundingTxInfo 

Fields

data ChannelParameters Source #

Defines channel: sender, receiver, and expiration date

Constructors

CChannelParameters 

Fields

data PayChanError Source #

Instances

Show PayChanError Source # 
Generic PayChanError Source # 

Associated Types

type Rep PayChanError :: * -> * #

type Rep PayChanError Source # 

class IsPubKey a where Source #

Minimal complete definition

getPubKey

Methods

getPubKey :: a -> PubKey Source #

data BitcoinAmount Source #

Represents a bitcoin amount as number of satoshis. 1 satoshi = 1e-8 bitcoin. Only natural numbers (>= 0) can be represented (fromInteger caps to a Word64). It is thus not possible to construct a negative BitcoinAmount which, when added to another BitcoinAmount, subtracts from its value. So we avoid the problem of being able to invert subtraction/addition by supplying a negative value as one of the arguments.

Instances

Enum BitcoinAmount Source # 
Eq BitcoinAmount Source # 
Integral BitcoinAmount Source # 
Num BitcoinAmount Source # 
Ord BitcoinAmount Source # 
Real BitcoinAmount Source # 
Show BitcoinAmount Source # 
Serialize BitcoinAmount Source # 

data BitcoinLockTime Source #

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

Constructors

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