Copyright | No rights reserved |
---|---|
License | MIT |
Maintainer | jprupp@protonmail.ch |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Types and logic for signing transactions.
Synopsis
- data SigInput = SigInput {
- sigInputScript :: !ScriptOutput
- sigInputValue :: !Word64
- sigInputOP :: !OutPoint
- sigInputSH :: !SigHash
- sigInputRedeem :: !(Maybe RedeemScript)
- makeSignature :: Network -> Tx -> Int -> SigInput -> SecKeyI -> TxSignature
- makeSigHash :: Network -> Tx -> Int -> ScriptOutput -> Word64 -> SigHash -> Maybe RedeemScript -> Hash256
- signTx :: Network -> Tx -> [(SigInput, Bool)] -> [SecKey] -> Either String Tx
- findInputIndex :: (a -> OutPoint) -> [a] -> [TxIn] -> [(a, Int)]
- signInput :: Network -> Tx -> Int -> (SigInput, Bool) -> SecKeyI -> Either String Tx
- buildInput :: Network -> Tx -> Int -> ScriptOutput -> Word64 -> Maybe RedeemScript -> TxSignature -> PubKeyI -> Either String ScriptInput
- sigKeys :: ScriptOutput -> Maybe RedeemScript -> [SecKey] -> Either String [SecKeyI]
Documentation
Data type used to specify the signing parameters of a transaction input. To sign an input, the previous output script, outpoint and sighash are required. When signing a pay to script hash output, an additional redeem script is required.
SigInput | |
|
Instances
makeSignature :: Network -> Tx -> Int -> SigInput -> SecKeyI -> TxSignature Source #
Produce a structured representation of a deterministic (RFC-6979) signature over an input.
makeSigHash :: Network -> Tx -> Int -> ScriptOutput -> Word64 -> SigHash -> Maybe RedeemScript -> Hash256 Source #
A function which selects the digest algorithm and parameters as appropriate
Since: 0.11.0.0
:: Network | |
-> Tx | transaction to sign |
-> [(SigInput, Bool)] | signing parameters, with nesting flag |
-> [SecKey] | private keys to sign with |
-> Either String Tx | signed transaction |
Sign a transaction by providing the SigInput
signing parameters and a
list of private keys. The signature is computed deterministically as defined
in RFC-6979.
Associate an input index to each value in a list
Sign a single input in a transaction deterministically (RFC-6979). The nesting flag only affects the behavior of segwit inputs.
:: Network | |
-> Tx | transaction where input will be added |
-> Int | input index where signature will go |
-> ScriptOutput | output script being spent |
-> Word64 | amount of previous output |
-> Maybe RedeemScript | redeem script if pay-to-script-hash |
-> TxSignature | |
-> PubKeyI | |
-> Either String ScriptInput |
Construct an input for a transaction given a signature, public key and data about the previous output.
sigKeys :: ScriptOutput -> Maybe RedeemScript -> [SecKey] -> Either String [SecKeyI] Source #
Find from the list of provided private keys which one is required to sign
the ScriptOutput
.