transaction

package
v0.0.0-...-33416f3 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoInputs         = errors.New("transaction must have at least one input")
	ErrNoOutputs        = errors.New("transaction must have at least one output")
	ErrNegativeOutput   = errors.New("transaction output value cannot be negative")
	ErrInvalidSignature = errors.New("invalid transaction signature")
)

Functions

This section is empty.

Types

type Input

type Input struct {
	TxID      []byte
	OutIndex  int
	PublicKey []byte
	Signature []byte
}

func NewInput

func NewInput(txID []byte, outIndex int, publicKey []byte) *Input

type Output

type Output struct {
	Value      float64
	PubKeyHash []byte
}

func NewOutput

func NewOutput(value float64, pubKeyHash []byte) *Output

type Transaction

type Transaction struct {
	ID        []byte
	Inputs    []Input
	Outputs   []Output
	Signature []byte
}

func NewTransaction

func NewTransaction(inputs []Input, outputs []Output) *Transaction

func (*Transaction) Hash

func (tx *Transaction) Hash() []byte

type Validator

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

func NewValidator

func NewValidator() *Validator

func (*Validator) ValidateTransaction

func (v *Validator) ValidateTransaction(tx *Transaction) error

Jump to

Keyboard shortcuts

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