decoders

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

提供一些通用的解析函数

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddressToPkScript

func AddressToPkScript(addr string) ([]byte, error)

通过btcd库, 解析钱包地址, 获取钱包地址对应的锁定脚本.

func AddressToType added in v0.1.0

func AddressToType(addr string) (types.AddressType, error)

通过btcd库, 解析钱包地址, 获取钱包地址对应类型.

func DecodeAddress

func DecodeAddress(addr string) (*types.AddressScriptInfo, error)

通过btcd库, 解析钱包地址, 获取钱包地址对应的类型, 锁定脚本, 脚本哈希等信息.

func DecodeAsmScript

func DecodeAsmScript(pkScript []byte) (ops []types.ScriptOp, asm string, err error)

反汇编脚本

func DecodePkScript

func DecodePkScript(pkScript []byte) (*types.AddressInfo, error)

func DecodeRawTx

func DecodeRawTx(raw []byte) (*types.Tx, error)

func DecodeRawTxString added in v0.1.1

func DecodeRawTxString(rawHex string) (*types.Tx, error)

func ExtractTapScriptPath

func ExtractTapScriptPath(w [][]byte) (stack [][]byte, script []byte, control []byte, ok bool)

ExtractTapScriptPath: 返回(栈元素, 脚本, 控制块)

func IsTapScriptPathWitness

func IsTapScriptPathWitness(w [][]byte) bool

严格:必须能成功解析 control block(长度规则 + 头字节 leaf version 合法)

func PKScriptToType

func PKScriptToType(pkScript []byte) (types.AddressType, error)

func ParseControlBlock

func ParseControlBlock(cb []byte) (types.TapControlBlock, error)

func TapLeafHash

func TapLeafHash(leafVersion byte, script []byte) [32]byte

TapLeafHash computes the tagged hash for a tapscript leaf per BIP-342. H_TapLeaf(leafVer || varint(len(script)) || script)

Types

This section is empty.

Jump to

Keyboard shortcuts

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