Copyright | No rights reserved |
---|---|
License | MIT |
Maintainer | jprupp@protonmail.ch |
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Types and logic for signing transactions.
Synopsis
- data SigInput = SigInput {}
- makeSignature :: Network -> Ctx -> Tx -> Int -> SigInput -> PrivateKey -> TxSignature
- makeSigHash :: Network -> Ctx -> Tx -> Int -> ScriptOutput -> Word64 -> SigHash -> Maybe RedeemScript -> Hash256
- signTx :: Network -> Ctx -> Tx -> [(SigInput, Bool)] -> [SecKey] -> Either String Tx
- findInputIndex :: (a -> OutPoint) -> [a] -> [TxIn] -> [(a, Int)]
- signInput :: Network -> Ctx -> Tx -> Int -> (SigInput, Bool) -> PrivateKey -> Either String Tx
- buildInput :: Network -> Ctx -> Tx -> Int -> ScriptOutput -> Word64 -> Maybe RedeemScript -> TxSignature -> PublicKey -> Either String ScriptInput
- sigKeys :: Ctx -> ScriptOutput -> Maybe RedeemScript -> [SecKey] -> Either String [PrivateKey]
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.
Instances
makeSignature :: Network -> Ctx -> Tx -> Int -> SigInput -> PrivateKey -> TxSignature Source #
Produce a structured representation of a deterministic (RFC-6979) signature over an input.
makeSigHash :: Network -> Ctx -> 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 | |
-> Ctx | |
-> 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
:: Network | |
-> Ctx | |
-> Tx | |
-> Int | |
-> (SigInput, Bool) | boolean flag: nest input |
-> PrivateKey | |
-> Either String Tx |
Sign a single input in a transaction deterministically (RFC-6979). The nesting flag only affects the behavior of segwit inputs.
:: Network | |
-> Ctx | |
-> 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 | |
-> PublicKey | |
-> Either String ScriptInput |
Construct an input for a transaction given a signature, public key and data about the previous output.
sigKeys :: Ctx -> ScriptOutput -> Maybe RedeemScript -> [SecKey] -> Either String [PrivateKey] Source #
Find from the list of provided private keys which one is required to sign
the ScriptOutput
.