descriptor

package
v0.0.0-...-11b23e1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

View Source
const DefaultVtxoDescriptorTemplate = "tr(%s,{ and(pk(%s), pk(%s)), and(older(%d), pk(%s)) })"

tr(unspendable, { and(pk(user), pk(asp)), and(older(timeout), pk(user)) })

View Source
const UnspendableKey = "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"

UnspendableKey is the x-only pubkey of the secp256k1 base point G

Variables

View Source
var (
	ErrInvalidXOnlyKey    = errors.New("invalid x only public key")
	ErrInvalidPkPolicy    = errors.New("invalid public key policy")
	ErrInvalidOlderPolicy = errors.New("invalid older policy")
	ErrInvalidAndPolicy   = errors.New("invalid and() policy")
	ErrNotExpectedPolicy  = errors.New("not the expected policy")
)

Functions

func CompileDescriptor

func CompileDescriptor(desc TaprootDescriptor) string

CompileDescriptor compiles a TaprootDescriptor struct back into a descriptor string

func ParseDefaultVtxoDescriptor

func ParseDefaultVtxoDescriptor(
	descriptor string,
) (user, asp *secp256k1.PublicKey, timeout uint, err error)

Types

type And

type And struct {
	First  Expression
	Second Expression
}

func (*And) Parse

func (e *And) Parse(policy string) error

func (*And) Script

func (e *And) Script(verify bool) (string, error)

func (*And) String

func (e *And) String() string

type Expression

type Expression interface {
	Parse(policy string) error
	Script(verify bool) (string, error)
	String() string
}

type Key

type Key struct {
	Hex string
}

type Older

type Older struct {
	Timeout uint
}

func (*Older) Parse

func (e *Older) Parse(policy string) error

func (*Older) Script

func (e *Older) Script(bool) (string, error)

func (*Older) String

func (e *Older) String() string

type PK

type PK struct {
	Key XOnlyKey
}

pk(xonlypubkey)

func (*PK) Parse

func (e *PK) Parse(policy string) error

func (*PK) Script

func (e *PK) Script(verify bool) (string, error)

func (*PK) String

func (e *PK) String() string

type TaprootDescriptor

type TaprootDescriptor struct {
	InternalKey Key
	ScriptTree  []Expression
}

func ParseTaprootDescriptor

func ParseTaprootDescriptor(desc string) (*TaprootDescriptor, error)

type XOnlyKey

type XOnlyKey struct {
	Key
}

func (*XOnlyKey) Parse

func (e *XOnlyKey) Parse(policy string) error

func (*XOnlyKey) Script

func (e *XOnlyKey) Script() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL