consensushashing

package
v0.12.18-rc2 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: ISC Imports: 8 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlockHash

func BlockHash(block *externalapi.DomainBlock) *externalapi.DomainHash

BlockHash returns the given block's hash

func CalculateSignatureHashECDSA added in v0.10.0

func CalculateSignatureHashECDSA(tx *externalapi.DomainTransaction, inputIndex int, hashType SigHashType,
	reusedValues *SighashReusedValues) (*externalapi.DomainHash, error)

CalculateSignatureHashECDSA will, given a script and hash type calculate the signature hash to be used for signing and verification for ECDSA. This returns error only if one of the provided parameters are consensus-invalid.

func CalculateSignatureHashSchnorr added in v0.10.0

func CalculateSignatureHashSchnorr(tx *externalapi.DomainTransaction, inputIndex int, hashType SigHashType,
	reusedValues *SighashReusedValues) (*externalapi.DomainHash, error)

CalculateSignatureHashSchnorr will, given a script and hash type calculate the signature hash to be used for signing and verification for Schnorr. This returns error only if one of the provided parameters are consensus-invalid.

func HeaderHash

HeaderHash returns the given header's hash

func TransactionHash

TransactionHash returns the transaction hash.

func TransactionID

TransactionID generates the Hash for the transaction without the signature script and payload field.

func TransactionIDs added in v0.11.0

TransactionIDs converts the provided slice of DomainTransactions to a corresponding slice of TransactionIDs

Types

type SigHashType added in v0.10.0

type SigHashType uint8

SigHashType represents hash type bits at the end of a signature.

const (
	SigHashAll          SigHashType = 0b00000001
	SigHashNone         SigHashType = 0b00000010
	SigHashSingle       SigHashType = 0b00000100
	SigHashAnyOneCanPay SigHashType = 0b10000000

	// SigHashMask defines the number of bits of the hash type which is used
	// to identify which outputs are signed.
	SigHashMask = 0b00000111
)

Hash type bits from the end of a signature.

func (SigHashType) IsStandardSigHashType added in v0.10.0

func (sht SigHashType) IsStandardSigHashType() bool

IsStandardSigHashType returns true if sht represents a standard SigHashType

type SighashReusedValues added in v0.10.0

type SighashReusedValues struct {
	// contains filtered or unexported fields
}

SighashReusedValues holds all fields used in the calculation of a transaction's sigHash, that are the same for all transaction inputs. Reuse of such values prevents the quadratic hashing problem.

Jump to

Keyboard shortcuts

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