bitcoin-scripting-0.1.0: Resources for working with miniscript, and script descriptors
Safe HaskellNone
LanguageHaskell2010

Language.Bitcoin.Miniscript

Description

Haskell embedding of miniscript. See http://bitcoin.sipa.be/miniscript/ for details. Much of the documentation below is taken from this site.

Synopsis

Syntax tree

data Value a Source #

Constructors

Variable Text 
Lit a 

Instances

Instances details
Eq a => Eq (Value a) Source # 
Instance details

Defined in Language.Bitcoin.Miniscript.Syntax

Methods

(==) :: Value a -> Value a -> Bool #

(/=) :: Value a -> Value a -> Bool #

Ord a => Ord (Value a) Source # 
Instance details

Defined in Language.Bitcoin.Miniscript.Syntax

Methods

compare :: Value a -> Value a -> Ordering #

(<) :: Value a -> Value a -> Bool #

(<=) :: Value a -> Value a -> Bool #

(>) :: Value a -> Value a -> Bool #

(>=) :: Value a -> Value a -> Bool #

max :: Value a -> Value a -> Value a #

min :: Value a -> Value a -> Value a #

Show a => Show (Value a) Source # 
Instance details

Defined in Language.Bitcoin.Miniscript.Syntax

Methods

showsPrec :: Int -> Value a -> ShowS #

show :: Value a -> String #

showList :: [Value a] -> ShowS #

literal :: a -> Value a Source #

keyH :: KeyDescriptor -> Miniscript Source #

Check a key hash

Type system

data BaseType Source #

Constructors

TypeB

Base expression

TypeV

Verify expression

TypeK

Key expression

TypeW

Wrapped expression

TypeNumber

Number expression

TypeBytes

Bytes expression

TypeKeyDesc

Key descriptor type

Instances

Instances details
Eq BaseType Source # 
Instance details

Defined in Language.Bitcoin.Miniscript.Types

Show BaseType Source # 
Instance details

Defined in Language.Bitcoin.Miniscript.Types

data ModField Source #

Type modifications that imply additional properties of the expression

Constructors

ModField 

Fields

  • modZ :: Bool

    Consumes exactly 0 stack elements

  • modO :: Bool

    One-arg: this expression always consumes exactly 1 stack element.

  • modN :: Bool

    Nonzero: this expression always consumes at least 1 stack element, no satisfaction for this expression requires the top input stack element to be zero.

  • modD :: Bool

    Dissatisfiable: a dissatisfaction for this expression can unconditionally be constructed.

  • modU :: Bool

    Unit: when satisfied put exactly 1 on the stack

Instances

Instances details
Eq ModField Source # 
Instance details

Defined in Language.Bitcoin.Miniscript.Types

Show ModField Source # 
Instance details

Defined in Language.Bitcoin.Miniscript.Types

typeCheckMiniscript Source #

Arguments

:: Map Text MiniscriptType

type hints for free variables in the miniscript expression

-> Miniscript 
-> Either MiniscriptTypeError MiniscriptType 

Check that a miniscript expression is well-typed.

Compilation

compile :: Miniscript -> Either CompilerError Script Source #

Type check and compile a miniscript

compileOnly :: Miniscript -> Either CompilerError Script Source #

Compile a miniscript without type checking

Printing and parsing