Copyright | No rights reserved |
---|---|
License | MIT |
Maintainer | matt@bitnomial.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Code related to PSBT parsing and serialization.
Synopsis
- data PSBT = PSBT {
- unsignedTransaction :: Tx
- globalUnknown :: UnknownMap
- inputs :: [Input]
- outputs :: [Output]
- getPSBT :: MonadGet m => Ctx -> m PSBT
- putPSBT :: MonadPut m => Ctx -> PSBT -> m ()
- data Input = Input {
- nonWitnessUtxo :: Maybe Tx
- witnessUtxo :: Maybe TxOut
- partialSigs :: HashMap PublicKey ByteString
- sigHashType :: Maybe SigHash
- inputRedeemScript :: Maybe Script
- inputWitnessScript :: Maybe Script
- inputHDKeypaths :: HashMap PublicKey (Fingerprint, [KeyIndex])
- finalScriptSig :: Maybe Script
- finalScriptWitness :: Maybe WitnessStack
- inputUnknown :: UnknownMap
- getInput :: MonadGet m => Ctx -> m Input
- putInput :: MonadPut m => Ctx -> Input -> m ()
- data Output = Output {}
- getOutput :: MonadGet m => Ctx -> m Output
- putOutput :: MonadPut m => Ctx -> Output -> m ()
- newtype UnknownMap = UnknownMap {}
- data Key = Key {
- keyType :: Word8
- key :: ByteString
- merge :: PSBT -> PSBT -> Maybe PSBT
- mergeMany :: [PSBT] -> Maybe PSBT
- mergeInput :: Input -> Input -> Input
- mergeOutput :: Output -> Output -> Output
- complete :: Ctx -> PSBT -> PSBT
- finalTransaction :: PSBT -> Tx
- emptyPSBT :: Tx -> PSBT
- emptyInput :: Input
- emptyOutput :: Output
- data PSBTSigner
- getSignerKey :: PSBTSigner -> PublicKey -> Maybe (Fingerprint, DerivPath) -> Maybe SecKey
- secKeySigner :: Ctx -> SecKey -> PSBTSigner
- xPrvSigner :: Ctx -> XPrvKey -> Maybe (Fingerprint, DerivPath) -> PSBTSigner
- signPSBT :: Network -> Ctx -> PSBTSigner -> PSBT -> PSBT
Partially-Signed Transactions
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
PSBT
line up by index with the inputs and outputs in
the unsigned transaction.
PSBT | |
|
Instances
Generic PSBT Source # | |
Read PSBT Source # | |
Show PSBT Source # | |
NFData PSBT Source # | |
Defined in Haskoin.Transaction.Partial | |
Eq PSBT Source # | |
type Rep PSBT Source # | |
Defined in Haskoin.Transaction.Partial type Rep PSBT = D1 ('MetaData "PSBT" "Haskoin.Transaction.Partial" "haskoin-core-1.1.0-EPeWWz60EKPlWai44F9WC" 'False) (C1 ('MetaCons "PSBT" 'PrefixI 'True) ((S1 ('MetaSel ('Just "unsignedTransaction") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Tx) :*: S1 ('MetaSel ('Just "globalUnknown") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UnknownMap)) :*: (S1 ('MetaSel ('Just "inputs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Input]) :*: S1 ('MetaSel ('Just "outputs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Output])))) |
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
Generic Output Source # | |
Read Output Source # | |
Show Output Source # | |
NFData Output Source # | |
Defined in Haskoin.Transaction.Partial | |
Eq Output Source # | |
type Rep Output Source # | |
Defined in Haskoin.Transaction.Partial type Rep Output = D1 ('MetaData "Output" "Haskoin.Transaction.Partial" "haskoin-core-1.1.0-EPeWWz60EKPlWai44F9WC" '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 PublicKey (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
Generic Key Source # | |
Read Key Source # | |
Show Key Source # | |
Binary Key Source # | |
Serial Key Source # | |
Defined in Haskoin.Transaction.Partial | |
Serialize Key Source # | |
NFData Key Source # | |
Defined in Haskoin.Transaction.Partial | |
Eq Key Source # | |
Hashable 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-1.1.0-EPeWWz60EKPlWai44F9WC" '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 :: PSBT -> PSBT -> Maybe PSBT Source #
Take two PSBT
s and merge them. The
unsignedTransaction
field in both must be the same.
mergeMany :: [PSBT] -> Maybe PSBT Source #
A version of merge
for a collection of PSBTs.
Since: 0.21.0
complete :: Ctx -> PSBT -> PSBT Source #
Take partial signatures from all of the Input
s and finalize the signature.
finalTransaction :: PSBT -> Tx Source #
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
Monoid PSBTSigner Source # | |
Defined in Haskoin.Transaction.Partial mempty :: PSBTSigner # mappend :: PSBTSigner -> PSBTSigner -> PSBTSigner # mconcat :: [PSBTSigner] -> PSBTSigner # | |
Semigroup PSBTSigner Source # | |
Defined in Haskoin.Transaction.Partial (<>) :: PSBTSigner -> PSBTSigner -> PSBTSigner # sconcat :: NonEmpty PSBTSigner -> PSBTSigner # stimes :: Integral b => b -> PSBTSigner -> PSBTSigner # |
getSignerKey :: PSBTSigner -> PublicKey -> Maybe (Fingerprint, DerivPath) -> Maybe SecKey Source #
Fetch the secret key for the given PublicKey
if possible.
since 0.21
secKeySigner :: Ctx -> SecKey -> PSBTSigner Source #
This signer can sign for one key.
since 0.21
:: Ctx | |
-> 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