script

package
v0.27.1-beta Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// TaprootMultiSigWitnessSize evaluates to 66 bytes:
	//	- num_witness_elements: 1 byte
	//	- sig_varint_len: 1 byte
	//	- <sig>: 64 bytes
	TaprootMultiSigWitnessSize = 1 + 1 + 64

	// TaprootExpiryScriptSize evaluates to 39 bytes:
	//	- OP_DATA: 1 byte (trader_key length)
	//	- <trader_key>: 32 bytes
	//	- OP_CHECKSIGVERIFY: 1 byte
	//	- <reservation_expiry>: 4 bytes
	//	- OP_CHECKLOCKTIMEVERIFY: 1 byte
	TaprootExpiryScriptSize = 1 + 32 + 1 + 4 + 1

	// TaprootExpiryWitnessSize evaluates to 140 bytes:
	//	- num_witness_elements: 1 byte
	//	- trader_sig_varint_len: 1 byte (trader_sig length)
	//	- <trader_sig>: 64 bytes
	//	- witness_script_varint_len: 1 byte (script length)
	//	- <witness_script>: 39 bytes
	//	- control_block_varint_len: 1 byte (control block length)
	//	- <control_block>: 33 bytes
	TaprootExpiryWitnessSize = 1 + 1 + 64 + 1 + TaprootExpiryScriptSize + 1 + 33
)

Variables

This section is empty.

Functions

func ExpirySpendWeight

func ExpirySpendWeight() int64

ExpirySpendWeight returns the weight of the expiry path spend.

func PayToWitnessTaprootScript

func PayToWitnessTaprootScript(taprootKey *btcec.PublicKey) ([]byte, error)

PayToWitnessTaprootScript creates a new script to pay to a version 1 (taproot) witness program.

func ReservationScript

func ReservationScript(expiry uint32, serverKey,
	clientKey *btcec.PublicKey) ([]byte, error)

ReservationScript returns the tapscript pkscript for the given reservation parameters.

func TaprootExpiryScript

func TaprootExpiryScript(expiry uint32,
	serverKey *btcec.PublicKey) (*txscript.TapLeaf, error)

TaprootExpiryScript returns the leaf script of the expiry script path.

<server_key> OP_CHECKSIGVERIFY <reservation_expiry> OP_CHECKLOCKTIMEVERIFY.

func TaprootKey

func TaprootKey(expiry uint32, serverKey,
	clientKey *btcec.PublicKey) (*musig2.AggregateKey, error)

TaprootKey returns the aggregated MuSig2 combined key.

Types

This section is empty.

Jump to

Keyboard shortcuts

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