Copyright | No rights reserved |
---|---|
License | MIT |
Maintainer | jprupp@protonmail.ch |
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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 {
- internalKey :: PubKey
- mast :: Maybe MAST
- taprootOutputKey :: Ctx -> TaprootOutput -> PubKey
- taprootScriptOutput :: Ctx -> TaprootOutput -> ScriptOutput
- data TaprootWitness
- data ScriptPathData = ScriptPathData {
- annex :: Maybe ByteString
- stack :: [ByteString]
- script :: Script
- extIsOdd :: Bool
- leafVersion :: Word8
- internalKey :: PubKey
- control :: [ByteString]
- viewTaprootWitness :: Ctx -> WitnessStack -> Maybe TaprootWitness
- encodeTaprootWitness :: Ctx -> TaprootWitness -> WitnessStack
- verifyScriptPathData :: Ctx -> 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
Instances
Read XOnlyPubKey Source # | |
Defined in Haskoin.Transaction.Taproot readsPrec :: Int -> ReadS XOnlyPubKey # readList :: ReadS [XOnlyPubKey] # readPrec :: ReadPrec XOnlyPubKey # readListPrec :: ReadPrec [XOnlyPubKey] # | |
Show XOnlyPubKey Source # | |
Defined in Haskoin.Transaction.Taproot showsPrec :: Int -> XOnlyPubKey -> ShowS # show :: XOnlyPubKey -> String # showList :: [XOnlyPubKey] -> ShowS # | |
Eq XOnlyPubKey Source # | |
Defined in Haskoin.Transaction.Taproot (==) :: XOnlyPubKey -> XOnlyPubKey -> Bool # (/=) :: XOnlyPubKey -> XOnlyPubKey -> Bool # | |
Marshal Ctx XOnlyPubKey Source # | |
Defined in Haskoin.Transaction.Taproot marshalPut :: MonadPut m => Ctx -> XOnlyPubKey -> m () Source # marshalGet :: MonadGet m => Ctx -> m XOnlyPubKey Source # | |
MarshalJSON Ctx XOnlyPubKey Source # | |
Defined in Haskoin.Transaction.Taproot marshalValue :: Ctx -> XOnlyPubKey -> Value Source # marshalEncoding :: Ctx -> XOnlyPubKey -> Encoding Source # unmarshalValue :: Ctx -> Value -> Parser XOnlyPubKey Source # |
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
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
TaprootOutput | |
|
taprootOutputKey :: Ctx -> TaprootOutput -> PubKey Source #
Since: 0.21.0
taprootScriptOutput :: Ctx -> 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
Instances
Eq TaprootWitness Source # | |
Defined in Haskoin.Transaction.Taproot (==) :: TaprootWitness -> TaprootWitness -> Bool # (/=) :: TaprootWitness -> TaprootWitness -> Bool # |
data ScriptPathData Source #
Since: 0.21.0
ScriptPathData | |
|
Instances
Eq ScriptPathData Source # | |
Defined in Haskoin.Transaction.Taproot (==) :: ScriptPathData -> ScriptPathData -> Bool # (/=) :: ScriptPathData -> ScriptPathData -> Bool # |
viewTaprootWitness :: Ctx -> WitnessStack -> Maybe TaprootWitness Source #
Try to interpret a WitnessStack
as taproot witness data.
Since: 0.21.0
encodeTaprootWitness :: Ctx -> TaprootWitness -> WitnessStack Source #
Transform the high-level representation of taproot witness data into a witness stack
Since: 0.21.0
:: Ctx | |
-> PubKey | Output key |
-> ScriptPathData | |
-> Bool |
Verify that the script path spend is valid, except for script execution.
Since: 0.21.0