script

package
v0.0.0-...-7e0e8da Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(privKeyBytes map[string][]byte, inputKeyBytes []byte,
	outputs []TxOutput, pkScripts [][]byte, scriptIndex int,
	witnessGen []WitnessGen, interactive, noStep bool, tags map[string]string,
	skipAhead int) error

Execute builds a tap leaf using the passed pkScript and executes it step by step with the provided witness.

privKeyBytes should map names of private keys given in the input witness to key bytes. An empty key will generate a random one.

If [input/output]KeyBytes is empty, a random key will be generated.

func Parse

func Parse(script string) ([]byte, error)

func StepScript

func StepScript(setupFunc func(func(*txscript.StepInfo) error) (*txscript.Engine, error),
	stepChan <-chan error, witness [][]byte,
	tags map[string]string, numSteps int) (<-chan string, <-chan error)

Types

type SignFunc

type SignFunc func(string) ([]byte, error)

SignFunc should return a signature for the current input given the private key ID given as an argument.

type TxOutput

type TxOutput struct {
	OutputKey *btcec.PublicKey
	Value     int64
}

type WitnessGen

type WitnessGen func(SignFunc) ([]byte, error)

WitnessGen returns an element to place on the witness stack.

func ParseWitness

func ParseWitness(witness string) ([]WitnessGen, error)

ParseWitness parses the given witness string and returns a slice of WitnessGen functions. Each function should provide the witness element at its index, given a function to optionally obtain a signature.

Signatures can be created by <sig:privkeyid> in the witness string, which will attempt to produce a signature from the key with name privkeyid.

Jump to

Keyboard shortcuts

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