| Copyright | No rights reserved |
|---|---|
| License | MIT |
| Maintainer | jprupp@protonmail.ch |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | None |
| Language | Haskell2010 |
Haskoin.Transaction.Taproot
Description
This module provides support for reperesenting full taproot outputs and parsing taproot witnesses. For reference see BIPS 340, 341, and 342.
Synopsis
- newtype XOnlyPubKey = XOnlyPubKey {}
- type TapLeafVersion = Word8
- data MAST
- mastCommitment :: MAST -> Digest SHA256
- getMerkleProofs :: MAST -> [(TapLeafVersion, Script, [Digest SHA256])]
- data TaprootOutput = TaprootOutput {}
- taprootOutputKey :: TaprootOutput -> PubKey
- taprootScriptOutput :: TaprootOutput -> ScriptOutput
- data TaprootWitness
- data ScriptPathData = ScriptPathData {}
- viewTaprootWitness :: WitnessStack -> Maybe TaprootWitness
- encodeTaprootWitness :: TaprootWitness -> WitnessStack
- verifyScriptPathData :: PubKey -> ScriptPathData -> Bool
Documentation
newtype XOnlyPubKey Source #
An x-only pubkey corresponds to the keys (x,y) and (x, -y). The
equality test only checks the x-coordinate. An x-only pubkey serializes to 32
bytes.
Since: 0.21.0
Constructors
| XOnlyPubKey | |
Fields | |
Instances
| Eq XOnlyPubKey Source # | |
Defined in Haskoin.Transaction.Taproot | |
| Show XOnlyPubKey Source # | |
Defined in Haskoin.Transaction.Taproot Methods showsPrec :: Int -> XOnlyPubKey -> ShowS # show :: XOnlyPubKey -> String # showList :: [XOnlyPubKey] -> ShowS # | |
| ToJSON XOnlyPubKey Source # | Hex encoding |
Defined in Haskoin.Transaction.Taproot Methods toJSON :: XOnlyPubKey -> Value # toEncoding :: XOnlyPubKey -> Encoding # toJSONList :: [XOnlyPubKey] -> Value # toEncodingList :: [XOnlyPubKey] -> Encoding # | |
| FromJSON XOnlyPubKey Source # | Hex encoding |
Defined in Haskoin.Transaction.Taproot | |
| Binary XOnlyPubKey Source # | |
Defined in Haskoin.Transaction.Taproot | |
| Serial XOnlyPubKey Source # | |
Defined in Haskoin.Transaction.Taproot | |
| Serialize XOnlyPubKey Source # | |
Defined in Haskoin.Transaction.Taproot | |
type TapLeafVersion = Word8 Source #
Since: 0.21.0
Merklized Abstract Syntax Tree. This type can represent trees where only a subset of the leaves are known. Note that the tree is invariant under swapping branches at an internal node.
Since: 0.21.0
Constructors
| MASTBranch MAST MAST | |
| MASTLeaf TapLeafVersion Script | |
| MASTCommitment (Digest SHA256) |
getMerkleProofs :: MAST -> [(TapLeafVersion, Script, [Digest SHA256])] Source #
Get the inclusion proofs for the leaves in the tree. The proof is ordered leaf-to-root.
Since: 0.21.0
data TaprootOutput Source #
Representation of a full taproot output.
Since: 0.21.0
Constructors
| TaprootOutput | |
Fields | |
Instances
| Show TaprootOutput Source # | |
Defined in Haskoin.Transaction.Taproot Methods showsPrec :: Int -> TaprootOutput -> ShowS # show :: TaprootOutput -> String # showList :: [TaprootOutput] -> ShowS # | |
taprootOutputKey :: TaprootOutput -> PubKey Source #
Since: 0.21.0
taprootScriptOutput :: TaprootOutput -> ScriptOutput Source #
Generate the output script for a taproot output
Since: 0.21.0
data TaprootWitness Source #
Comprehension of taproot witness data
Since: 0.21.0
Constructors
| KeyPathSpend ByteString | Signature |
| ScriptPathSpend ScriptPathData |
Instances
| Eq TaprootWitness Source # | |
Defined in Haskoin.Transaction.Taproot Methods (==) :: TaprootWitness -> TaprootWitness -> Bool # (/=) :: TaprootWitness -> TaprootWitness -> Bool # | |
| Show TaprootWitness Source # | |
Defined in Haskoin.Transaction.Taproot Methods showsPrec :: Int -> TaprootWitness -> ShowS # show :: TaprootWitness -> String # showList :: [TaprootWitness] -> ShowS # | |
data ScriptPathData Source #
Since: 0.21.0
Constructors
| ScriptPathData | |
Fields
| |
Instances
| Eq ScriptPathData Source # | |
Defined in Haskoin.Transaction.Taproot Methods (==) :: ScriptPathData -> ScriptPathData -> Bool # (/=) :: ScriptPathData -> ScriptPathData -> Bool # | |
| Show ScriptPathData Source # | |
Defined in Haskoin.Transaction.Taproot Methods showsPrec :: Int -> ScriptPathData -> ShowS # show :: ScriptPathData -> String # showList :: [ScriptPathData] -> ShowS # | |
viewTaprootWitness :: WitnessStack -> Maybe TaprootWitness Source #
Try to interpret a WitnessStack as taproot witness data.
Since: 0.21.0
encodeTaprootWitness :: TaprootWitness -> WitnessStack Source #
Transform the high-level representation of taproot witness data into a witness stack
Since: 0.21.0
Arguments
| :: PubKey | Output key |
| -> ScriptPathData | |
| -> Bool |
Verify that the script path spend is valid, except for script execution.
Since: 0.21.0