rbpcp-api-0.1.0.0: RESTful Bitcoin Payment Channel Protocol Servant API description

Safe HaskellNone
LanguageHaskell2010

RBPCP.Types

Synopsis

Documentation

data PaymentResult Source #

Constructors

PaymentResult 

Fields

Instances

Eq PaymentResult Source # 
Show PaymentResult Source # 
Generic PaymentResult Source # 

Associated Types

type Rep PaymentResult :: * -> * #

ToJSON PaymentResult Source # 
FromJSON PaymentResult Source # 
type Rep PaymentResult Source # 
type Rep PaymentResult = D1 (MetaData "PaymentResult" "RBPCP.Types" "rbpcp-api-0.1.0.0-7nMuS6Dii2hKY7GaZyXtjJ" False) (C1 (MetaCons "PaymentResult" PrefixI True) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "paymentResult_channel_status") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ChannelStatus)) (S1 (MetaSel (Just Symbol "paymentResult_channel_valueLeft") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Word64))) ((:*:) (S1 (MetaSel (Just Symbol "paymentResult_value_received") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Word64)) ((:*:) (S1 (MetaSel (Just Symbol "paymentResult_settlement_txid") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe TxHash))) (S1 (MetaSel (Just Symbol "paymentResult_application_data") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text))))))

data FundingInfo Source #

Constructors

FundingInfo 

Fields

  • fundingInfoServerPubkey :: Server PubKey

    Server/value receiver public key. Hex-encoded, compressed Secp256k1 pubkey, 33 bytes.

  • fundingInfoDustLimit :: Word64

    (Satoshis) The server will not accept payments where the client change amount is less than this amount. This "dust limit" is necessary in order to avoid producing a settlement transaction that will not circulate in the Bitcoin P2P network because it contains an output of minuscule value. Consequently, the maximum amount, that can be sent over the payment channel, is the amount sent to the funding address minus this "dust limit".

  • fundingInfoFundingAddressCopy :: Address

    Server derived channel funding address. The client will confirm that its own derived funding address matches this one, before paying to it.

  • fundingInfoRedeem_scriptCopy :: JsonHex Script

    Server derived channel redeem script. Defines sender, receiver and channel expiration date. Used to construct the input in the payment transaction. The client will also verify that this matches what it expects. Hex-encoded.

  • fundingInfoOpenPrice :: Word64

    Price (in satoshis) for opening a channel with the given {exp_time}. This amount is paid in the initial channel payment when creating a new channel. May be zero, in which case a payment of zero value is transferred, ensuring that the channel can be closed at any time.

  • fundingInfoFunding_tx_min_conf :: BtcConf

    Minimum confirmation count that the funding transaction must have before proceeding with opening a new channel.

  • fundingInfoSettlement_period_hours :: Hours

    The server reserves the right to close the payment channel this many hours before the specified expiration date. The server hasn't received any actual value until it publishes a payment transaction to the Bitcoin network, so it needs a window of time in which the client can no longer send payments over the channel, and yet the channel refund transaction hasn't become valid.

  • fundingInfoMin_duration_hours :: Hours

    Minimum duration of newly opened channels

data Error Source #

Error response type

Constructors

Error 

Fields

  • errorType :: ErrorType

    Either payment_error, in case of an invalid payment, or application_error, in case of application-related errors (invalid application_data in the supplied **Payment**)

  • errorMessage :: Text

    Human-readable error message

Instances

Eq Error Source # 

Methods

(==) :: Error -> Error -> Bool #

(/=) :: Error -> Error -> Bool #

Show Error Source # 

Methods

showsPrec :: Int -> Error -> ShowS #

show :: Error -> String #

showList :: [Error] -> ShowS #

Generic Error Source # 

Associated Types

type Rep Error :: * -> * #

Methods

from :: Error -> Rep Error x #

to :: Rep Error x -> Error #

ToJSON Error Source # 
FromJSON Error Source # 
type Rep Error Source # 
type Rep Error = D1 (MetaData "Error" "RBPCP.Types" "rbpcp-api-0.1.0.0-7nMuS6Dii2hKY7GaZyXtjJ" False) (C1 (MetaCons "Error" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "errorType") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ErrorType)) (S1 (MetaSel (Just Symbol "errorMessage") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text))))

data PaymentData Source #

A payment comprises a signature over a Bitcoin transaction with a decremented client change value. The Bitcoin transaction redeems the outpoint specified by 'funding_txid' and 'funding_vout' (a P2SH output governed by 'redeem_script'), and pays 'change_value' to 'change_address'.

Constructors

PaymentData 

Fields

  • paymentDataRedeemScript :: JsonHex Script

    The funds sent to the funding address are bound by this contract (Bitcoin script). The data is needed to construct the payment signature. Hex-encoded data.

  • paymentDataFundingTxid :: TxHash

    The transaction ID of the Bitcoin transaction paying to the channel funding address.

  • paymentDataFundingVout :: Vout

    The output index/"vout" of the output (in the transaction) payingto the channel funding address.

  • paymentDataSignatureData :: JsonHex Signature

    DER-encoded ECDSA signature (in hex). This is a SIGHASH_SINGLE|ANYONECANPAY signature over the the "payment transaction", which is a Bitcoin transaction that: redeems the outpoint specified by funding_txid and funding_vout using the redeem script defined in redeem_script, with an output which sends change_value to change_address.

  • paymentDataChangeValue :: Word64

    The value sent back to the client in the payment transaction. The total amount transferred to the server is this amount subtracted from the value sent to the channel funding address.

  • paymentDataChangeAddress :: Address

    The client change address as used in the only output of the payment transaction.

  • paymentDataSighashFlag :: JsonHex SigHash

    Specifies which parts of the payment Bitcoin transaction are signed. Hex-encoded, single byte; in both v1 and v2 always equal to "83" (0x83), which is **SIGHASH_SINGLE|ANYONECANPAY**, meaning the client only signs its own output, and also allowing more to be added.

Instances

Eq PaymentData Source # 
Show PaymentData Source # 
Generic PaymentData Source # 

Associated Types

type Rep PaymentData :: * -> * #

ToJSON PaymentData Source # 
FromJSON PaymentData Source # 
type Rep PaymentData Source # 

data Payment Source #

A wrapper that contains both payment data and application data

Constructors

Payment 

Fields

  • paymentPaymentData :: PaymentData

    Actual payment

  • paymentApplicationData :: Text

    Optional application data (may be an empty string). The client may wish to include data with the payment, for example an order reference, or any other data which will be used by the server to deliver the appropriate application data in the **PaymentResult** response.

Instances

Eq Payment Source # 

Methods

(==) :: Payment -> Payment -> Bool #

(/=) :: Payment -> Payment -> Bool #

Show Payment Source # 
Generic Payment Source # 

Associated Types

type Rep Payment :: * -> * #

Methods

from :: Payment -> Rep Payment x #

to :: Rep Payment x -> Payment #

ToJSON Payment Source # 
FromJSON Payment Source # 
type Rep Payment Source # 
type Rep Payment = D1 (MetaData "Payment" "RBPCP.Types" "rbpcp-api-0.1.0.0-7nMuS6Dii2hKY7GaZyXtjJ" False) (C1 (MetaCons "Payment" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "paymentPaymentData") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 PaymentData)) (S1 (MetaSel (Just Symbol "paymentApplicationData") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text))))

data ChannelLocation Source #

Constructors

ChannelLocation 

Fields

  • channelInfo_channel_uri :: Text

    The URL of the resource which must the POSTed to in order to open a new payment channel, after which further payments can be PUT on this resource. Close the payment channel by issuing a DELETE request on the resource.

data JsonHex a Source #

Constructors

JsonHex 

Fields

Instances

Eq a => Eq (JsonHex a) Source # 

Methods

(==) :: JsonHex a -> JsonHex a -> Bool #

(/=) :: JsonHex a -> JsonHex a -> Bool #

Show a => Show (JsonHex a) Source # 

Methods

showsPrec :: Int -> JsonHex a -> ShowS #

show :: JsonHex a -> String #

showList :: [JsonHex a] -> ShowS #

Generic (JsonHex a) Source # 

Associated Types

type Rep (JsonHex a) :: * -> * #

Methods

from :: JsonHex a -> Rep (JsonHex a) x #

to :: Rep (JsonHex a) x -> JsonHex a #

(Eq a, Show a, Serialize a) => ToJSON (JsonHex a) Source # 
(Eq a, Show a, Serialize a) => FromJSON (JsonHex a) Source # 

Methods

parseJSON :: Value -> Parser (JsonHex a) #

Serialize a => Serialize (JsonHex a) Source # 

Methods

put :: Putter (JsonHex a) #

get :: Get (JsonHex a) #

type Rep (JsonHex a) Source # 
type Rep (JsonHex a) = D1 (MetaData "JsonHex" "RBPCP.Internal.Types" "rbpcp-api-0.1.0.0-7nMuS6Dii2hKY7GaZyXtjJ" False) (C1 (MetaCons "JsonHex" PrefixI True) (S1 (MetaSel (Just Symbol "fromHex") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)))