Copyright | No rights reserved |
---|---|
License | MIT |
Maintainer | matt@bitnomial.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Code related to PSBT parsing and serialization.
Synopsis
- data PartiallySignedTransaction = PartiallySignedTransaction {
- unsignedTransaction :: Tx
- globalUnknown :: UnknownMap
- inputs :: [Input]
- outputs :: [Output]
- data Input = Input {
- nonWitnessUtxo :: Maybe Tx
- witnessUtxo :: Maybe TxOut
- partialSigs :: HashMap PubKeyI ByteString
- sigHashType :: Maybe SigHash
- inputRedeemScript :: Maybe Script
- inputWitnessScript :: Maybe Script
- inputHDKeypaths :: HashMap PubKeyI (Fingerprint, [KeyIndex])
- finalScriptSig :: Maybe Script
- finalScriptWitness :: Maybe WitnessStack
- inputUnknown :: UnknownMap
- data Output = Output {}
- newtype UnknownMap = UnknownMap {}
- data Key = Key {
- keyType :: Word8
- key :: ByteString
- merge :: PartiallySignedTransaction -> PartiallySignedTransaction -> Maybe PartiallySignedTransaction
- mergeMany :: [PartiallySignedTransaction] -> Maybe PartiallySignedTransaction
- mergeInput :: Input -> Input -> Input
- mergeOutput :: Output -> Output -> Output
- complete :: PartiallySignedTransaction -> PartiallySignedTransaction
- finalTransaction :: PartiallySignedTransaction -> Tx
- emptyPSBT :: Tx -> PartiallySignedTransaction
- emptyInput :: Input
- emptyOutput :: Output
- data PsbtSigner
- getSignerKey :: PsbtSigner -> PubKeyI -> Maybe (Fingerprint, DerivPath) -> Maybe SecKey
- secKeySigner :: SecKey -> PsbtSigner
- xPrvSigner :: XPrvKey -> Maybe (Fingerprint, DerivPath) -> PsbtSigner
- signPSBT :: Network -> PsbtSigner -> PartiallySignedTransaction -> PartiallySignedTransaction
Partially-Signed Transactions
data PartiallySignedTransaction Source #
PSBT data type as specified in
BIP-174.
This contains an unsigned transaction, inputs and outputs, and unspecified
extra data. There is one input per input in the unsigned transaction, and one
output per output in the unsigned transaction. The inputs and outputs in the
PartiallySignedTransaction
line up by index with the inputs and outputs in
the unsigned transaction.
PartiallySignedTransaction | |
|
Instances
Inputs contain all of the data needed to sign a transaction and all of the resulting signature data after signing.
Instances
Outputs can contain information needed to spend the output at a later date.
Instances
Eq Output Source # | |
Show Output Source # | |
Generic Output Source # | |
Serialize Output Source # | |
NFData Output Source # | |
Defined in Haskoin.Transaction.Partial | |
type Rep Output Source # | |
Defined in Haskoin.Transaction.Partial type Rep Output = D1 ('MetaData "Output" "Haskoin.Transaction.Partial" "haskoin-core-0.21.2-inplace" 'False) (C1 ('MetaCons "Output" 'PrefixI 'True) ((S1 ('MetaSel ('Just "outputRedeemScript") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Script)) :*: S1 ('MetaSel ('Just "outputWitnessScript") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Script))) :*: (S1 ('MetaSel ('Just "outputHDKeypaths") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (HashMap PubKeyI (Fingerprint, [KeyIndex]))) :*: S1 ('MetaSel ('Just "outputUnknown") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UnknownMap)))) |
newtype UnknownMap Source #
A map of raw PSBT keys to byte strings for extra data. The keyType
field
cannot overlap with any of the reserved keyType
fields specified in the
PSBT specification.
Instances
Raw keys for the map type used in PSBTs.
Key | |
|
Instances
Eq Key Source # | |
Show Key Source # | |
Generic Key Source # | |
Hashable Key Source # | |
Defined in Haskoin.Transaction.Partial | |
Serialize Key Source # | |
NFData Key Source # | |
Defined in Haskoin.Transaction.Partial | |
type Rep Key Source # | |
Defined in Haskoin.Transaction.Partial type Rep Key = D1 ('MetaData "Key" "Haskoin.Transaction.Partial" "haskoin-core-0.21.2-inplace" 'False) (C1 ('MetaCons "Key" 'PrefixI 'True) (S1 ('MetaSel ('Just "keyType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word8) :*: S1 ('MetaSel ('Just "key") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) |
merge :: PartiallySignedTransaction -> PartiallySignedTransaction -> Maybe PartiallySignedTransaction Source #
Take two PartiallySignedTransaction
s and merge them. The
unsignedTransaction
field in both must be the same.
mergeMany :: [PartiallySignedTransaction] -> Maybe PartiallySignedTransaction Source #
A version of merge
for a collection of PSBTs.
Since: 0.21.0
complete :: PartiallySignedTransaction -> PartiallySignedTransaction Source #
Take partial signatures from all of the Input
s and finalize the signature.
finalTransaction :: PartiallySignedTransaction -> Tx Source #
Take a finalized PartiallySignedTransaction
and produce the signed final
transaction. You may need to call complete
on the
PartiallySignedTransaction
before producing the final transaction.
emptyPSBT :: Tx -> PartiallySignedTransaction Source #
Take an unsigned transaction and produce an empty
PartiallySignedTransaction
emptyInput :: Input Source #
emptyOutput :: Output Source #
Signing
data PsbtSigner Source #
A abstraction which covers varying key configurations. Use the Semigroup
instance to create signers for sets of keys: `signerA <> signerB` can sign
anything for which signerA
or signerB
could sign.
since 0.21
Instances
Semigroup PsbtSigner Source # | |
Defined in Haskoin.Transaction.Partial (<>) :: PsbtSigner -> PsbtSigner -> PsbtSigner # sconcat :: NonEmpty PsbtSigner -> PsbtSigner # stimes :: Integral b => b -> PsbtSigner -> PsbtSigner # | |
Monoid PsbtSigner Source # | |
Defined in Haskoin.Transaction.Partial mempty :: PsbtSigner # mappend :: PsbtSigner -> PsbtSigner -> PsbtSigner # mconcat :: [PsbtSigner] -> PsbtSigner # |
getSignerKey :: PsbtSigner -> PubKeyI -> Maybe (Fingerprint, DerivPath) -> Maybe SecKey Source #
Fetch the secret key for the given PubKeyI
if possible.
since 0.21
secKeySigner :: SecKey -> PsbtSigner Source #
This signer can sign for one key.
since 0.21
:: XPrvKey | |
-> Maybe (Fingerprint, DerivPath) | Origin data, if the input key is explicitly a child key |
-> PsbtSigner |
This signer can sign with any child key, provided that derivation information is present.
since 0.21
signPSBT :: Network -> PsbtSigner -> PartiallySignedTransaction -> PartiallySignedTransaction Source #
Update a PSBT with signatures when possible. This function uses
inputHDKeypaths
in order to calculate secret keys.
since 0.21