btctapscript

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: ISC Imports: 8 Imported by: 0

README

Bitcoin Tapscript Disassembler

This project uses the opcodes from the btcd project, and implements according to BIP 342 and BIP 341 a tapscript disassembler for witness entries of a pay to taproot Bitcoin transaction input, similar to what can be found in the mempool.space project.

It's stipped down to the bone and pretty much only parses the most common version of tapscript as of now that has the leaf version being 0xc0 (and can ensure it is according to BIP specs).

Documentation

Index

Constants

View Source
const WitnessAnnexPrefixByte = 0x50

WitnessAnnexPrefixByte is the prefix in the witness array of the annex that is to be removed in the parsing process.

Variables

This section is empty.

Functions

func DisassembleAsmTaprootScript

func DisassembleAsmTaprootScript(scriptAsm []byte) (string, error)

DisassembleAsmTaprootScript tries to disassemble the taproot script from its ASM format into human readable script with OP codes names.

func GetWitnessesTaprootScriptAsm

func GetWitnessesTaprootScriptAsm(witnessWithAnnexe [][]byte) ([]byte, error)

GetWitnessesTaprootScriptAsm return the part of the witness entries that contains the script and errors out if input the witnesses are from does not contains tapscript with the right version.

func RemoveWitnessAnnex

func RemoveWitnessAnnex(witnesses [][]byte) ([][]byte, error)

RemoveWitnessAnnex removes the eventual annex from the slice of witnesses and return a new one.

func WitnessContainsCompatibleTapscript

func WitnessContainsCompatibleTapscript(witnessWithAnnexe [][]byte) bool

WitnessContainsTapscript, given the array of txinwitness from the bitcoin transaction input, will tell if it has a tapscript in the right version.

func WitnessLeafVersionIs0xc0

func WitnessLeafVersionIs0xc0(witnessWithoutAnnex [][]byte) bool

WitnessLeafVersionIs0xc0 tells if the witness (after annex is removed before passing it) has its leaf version being 0xc0.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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