bitcoin

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package bitcoin provides BIP 37 partial merkle tree verification and thin wrappers around btcsuite/btcd for transaction and txoutproof parsing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeTxID

func ComputeTxID(rawTxHex string) (string, error)

ComputeTxID computes the txid from raw transaction hex (display order, handles segwit).

func DecodeTransaction

func DecodeTransaction(rawTxHex string) (*wire.MsgTx, error)

DecodeTransaction decodes raw transaction hex into a wire.MsgTx.

func DecodeTxOutProof

func DecodeTxOutProof(txoutproofHex string) (*wire.MsgMerkleBlock, error)

DecodeTxOutProof decodes a txoutproof hex string into a wire.MsgMerkleBlock.

func ExtractOpReturn

func ExtractOpReturn(rawTxHex string) (string, error)

ExtractOpReturn parses a raw transaction and returns the OP_RETURN data as hex.

func ParseBlockHash

func ParseBlockHash(txoutproofHex string) (string, error)

ParseBlockHash decodes a txoutproof hex string and returns the block hash (display order).

Types

type MerkleResult

type MerkleResult struct {
	Valid        bool
	ComputedRoot *chainhash.Hash
	MatchedTxIDs []*chainhash.Hash
}

MerkleResult holds the result of a partial merkle tree verification.

func VerifyPartialMerkleTree

func VerifyPartialMerkleTree(
	hashes []*chainhash.Hash,
	flagBytes []byte,
	totalTxs uint32,
	expectedRoot *chainhash.Hash,
) MerkleResult

VerifyPartialMerkleTree verifies a Bitcoin BIP 37 partial merkle tree. Takes the hashes and raw flag bytes from wire.MsgMerkleBlock directly.

Jump to

Keyboard shortcuts

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