| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Language.Bitcoin.Script.Descriptors
Contents
Description
A library for working with bitcoin script descriptors. Documentation taken from https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md.
Synopsis
- data ScriptDescriptor
- data KeyDescriptor = KeyDescriptor {}
- data Origin = Origin {}
- data Key
- data KeyCollection
- pubKey :: PubKeyI -> KeyDescriptor
- secKey :: SecKeyI -> KeyDescriptor
- keyDescPubKey :: KeyDescriptor -> Maybe PubKeyI
- keyBytes :: KeyDescriptor -> Maybe ByteString
- descriptorToText :: Network -> ScriptDescriptor -> Text
- keyDescriptorToText :: Network -> KeyDescriptor -> Text
- parseDescriptor :: Network -> Text -> Either String ScriptDescriptor
- descriptorParser :: Network -> Parser ScriptDescriptor
- parseKeyDescriptor :: Network -> Text -> Either String KeyDescriptor
- keyDescriptorParser :: Network -> Parser KeyDescriptor
Documentation
data ScriptDescriptor Source #
Constructors
| Sh ScriptDescriptor | P2SH embed the argument. |
| Wsh ScriptDescriptor | P2WSH embed the argument. |
| Pk KeyDescriptor | P2PK output for the given public key. |
| Pkh KeyDescriptor | P2PKH output for the given public key (use |
| Wpkh KeyDescriptor | P2WPKH output for the given compressed pubkey. |
| Combo KeyDescriptor | An alias for the collection of pk(KEY) and pkh(KEY). If the key is compressed, it also includes wpkh(KEY) and sh(wpkh(KEY)). |
| Multi Int [KeyDescriptor] | k-of-n multisig script. |
| SortedMulti Int [KeyDescriptor] | k-of-n multisig script with keys sorted lexicographically in the resulting script. |
| Addr Address | the script which ADDR expands to. |
| Raw ByteString | the script whose hex encoding is HEX. |
Instances
| Eq ScriptDescriptor Source # | |
Defined in Language.Bitcoin.Script.Descriptors.Syntax Methods (==) :: ScriptDescriptor -> ScriptDescriptor -> Bool # (/=) :: ScriptDescriptor -> ScriptDescriptor -> Bool # | |
| Show ScriptDescriptor Source # | |
Defined in Language.Bitcoin.Script.Descriptors.Syntax Methods showsPrec :: Int -> ScriptDescriptor -> ShowS # show :: ScriptDescriptor -> String # showList :: [ScriptDescriptor] -> ShowS # | |
data KeyDescriptor Source #
Instances
| Eq KeyDescriptor Source # | |
Defined in Language.Bitcoin.Script.Descriptors.Syntax Methods (==) :: KeyDescriptor -> KeyDescriptor -> Bool # (/=) :: KeyDescriptor -> KeyDescriptor -> Bool # | |
| Show KeyDescriptor Source # | |
Defined in Language.Bitcoin.Script.Descriptors.Syntax Methods showsPrec :: Int -> KeyDescriptor -> ShowS # show :: KeyDescriptor -> String # showList :: [KeyDescriptor] -> ShowS # | |
Constructors
| Origin | |
Fields | |
Constructors
| Pubkey PubKeyI | DER-hex encoded secp256k1 public key |
| SecretKey SecKeyI | (de)serialized as WIF |
| XPub XPubKey DerivPath KeyCollection |
Instances
data KeyCollection Source #
Represent whether the key corresponds to a collection (and how) or a single key.
Instances
| Eq KeyCollection Source # | |
Defined in Language.Bitcoin.Script.Descriptors.Syntax Methods (==) :: KeyCollection -> KeyCollection -> Bool # (/=) :: KeyCollection -> KeyCollection -> Bool # | |
| Ord KeyCollection Source # | |
Defined in Language.Bitcoin.Script.Descriptors.Syntax Methods compare :: KeyCollection -> KeyCollection -> Ordering # (<) :: KeyCollection -> KeyCollection -> Bool # (<=) :: KeyCollection -> KeyCollection -> Bool # (>) :: KeyCollection -> KeyCollection -> Bool # (>=) :: KeyCollection -> KeyCollection -> Bool # max :: KeyCollection -> KeyCollection -> KeyCollection # min :: KeyCollection -> KeyCollection -> KeyCollection # | |
| Show KeyCollection Source # | |
Defined in Language.Bitcoin.Script.Descriptors.Syntax Methods showsPrec :: Int -> KeyCollection -> ShowS # show :: KeyCollection -> String # showList :: [KeyCollection] -> ShowS # | |
pubKey :: PubKeyI -> KeyDescriptor Source #
Simple explicit public key with no origin information
secKey :: SecKeyI -> KeyDescriptor Source #
Simple explicit secret key with no origin information
keyDescPubKey :: KeyDescriptor -> Maybe PubKeyI Source #
Produce a pubkey if possible
keyBytes :: KeyDescriptor -> Maybe ByteString Source #
Produce a key literal if possible
Text representation
descriptorToText :: Network -> ScriptDescriptor -> Text Source #
keyDescriptorToText :: Network -> KeyDescriptor -> Text Source #
Parsing
parseDescriptor :: Network -> Text -> Either String ScriptDescriptor Source #
parseKeyDescriptor :: Network -> Text -> Either String KeyDescriptor Source #