validator

package
v0.1.0-testnet Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2022 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingPubKey = errors.New("phonon missing public key")
View Source
var ErrPhononCompromised error = errors.New("transaction with phonon as sender detected")

Functions

func NewClient

func NewClient(url string, authToken string) *bcoinClient

Types

type BTCValidator

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

func NewBTCValidator

func NewBTCValidator(c *bcoinClient) *BTCValidator

func (*BTCValidator) Validate

func (b *BTCValidator) Validate(phonon *model.Phonon) (bool, error)

Validate returns true if the balance associated with the public key on the bitcoin phonon is greater than or equal to the balance stated in the phonon using as many known address generation functions as reasonable. Currently: P2SH script and P2PKH addresses.

type Coin

type Coin struct {
	Value   int64  `json:"value"`
	Address string `json:"address"`
}

type Inputs

type Inputs []struct {
	Coin Coin `json:"coin"`
}

type Outputs

type Outputs []output

type Validator

type Validator interface {
	Validate(phonon *model.Phonon) (valid bool, err error)
}

Validates that a phonon's presented public key represents an actual crypto asset

Jump to

Keyboard shortcuts

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