transactionverifier

package
v0.0.0-...-fb8e171 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TxnMerkleLeaf   = []byte("TL")
	MerkleArrayNode = []byte("MA")
)
View Source
var (
	ErrUnsupportedHashFunction      = errors.New("proof hash function is unsupported")
	ErrProofLengthTreeDepthMismatch = errors.New("proof length and tree depth do not match")
	ErrRootMismatch                 = errors.New("root mismatch")
	ErrInvalidTreeDepth             = errors.New("invalid tree depth")
	ErrIndexDepthMismatch           = errors.New("node index is not smaller than 2^depth")
	ErrInvalidPosition              = errors.New("invalid position for node")
)

Functions

func VerifyTransaction

func VerifyTransaction(transactionHash types.Digest, transactionProofResponse models.TransactionProofResponse,
	lightBlockHeaderProofResponse models.LightBlockHeaderProof, confirmedRound types.Round, genesisHash types.Digest, seed types.Seed, blockIntervalCommitment types.Digest) error

VerifyTransaction receives a sha256 hashed transaction, a proof to compute the transaction's commitment, a proof to compute the commitment belonging to the light block header associated with the transaction's commitment, and an expected commitment to compare to. The function verifies that the computed commitment using the given proofs is identical to the provided commitment. Parameters: transactionHash - the result of invoking Sha256 on the canonical msgpack encoded transaction. transactionProofResponse - the response returned by an Algorand node when queried using GetTransactionProof. lightBlockHeaderProofResponse - the response returned by an Algorand node when queried using the GetLightBlockHeaderProof. confirmedRound - the round in which the given transaction was confirmed. genesisHash - the hash of the genesis block. seed - the sortition seed of the block associated with the light block header. blockIntervalCommitment - the commitment to compare to, provided by the Oracle.

Types

type NodePosition

type NodePosition int

Jump to

Keyboard shortcuts

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