objs

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaseDepositEquation

func BaseDepositEquation(dataSize32 uint32, numEpochs32 uint32) (*uint256.Uint256, error)

BaseDepositEquation specifies a required deposit for a certain amount of data to persist for a specified number of epochs.

The simple equation is

deposit = (dataSize + BaseDatasizeConst) * (2 + numEpochs)

We have additional checks to ensure there is no integer overflow. This will never happen for valid deposits, but we protect against it.

func MakeUTXOID

func MakeUTXOID(txHash []byte, idx uint32) []byte

MakeUTXOID will create the UTXOID for a utxo given a transaction hash and index.

func NumEpochsEquation

func NumEpochsEquation(dataSize32 uint32, depositOrig *uint256.Uint256) (uint32, error)

NumEpochsEquation returns the number of epochs until expiration.

The simple equation is

numEpochs = (deposit / (dataSize + BaseDatasizeConst)) - 2

We have additional checks to ensure there is no integer overflow.

func RewardDepositEquation

func RewardDepositEquation(depositOrig *uint256.Uint256, dataSize32 uint32, epochInitial uint32, epochFinal uint32) (*uint256.Uint256, error)

RewardDepositEquation allows a reward calculated for cleaning up an expired DataStore.

Types

type ASPreImage

type ASPreImage struct {
	ChainID  uint32
	Value    *uint256.Uint256
	TXOutIdx uint32
	IssuedAt uint32
	Exp      uint32
	Owner    *AtomicSwapOwner
	// contains filtered or unexported fields
}

ASPreImage holds the values required for an AtomicSwap object

func (*ASPreImage) IsExpired

func (b *ASPreImage) IsExpired(currentHeight uint32) (bool, error)

IsExpired returns true if the current epoch is greater than exp

func (*ASPreImage) MarshalBinary

func (b *ASPreImage) MarshalBinary() ([]byte, error)

MarshalBinary takes the ASPreImage object and returns the canonical byte slice

func (*ASPreImage) MarshalCapn

func (b *ASPreImage) MarshalCapn(seg *capnp.Segment) (mdefs.ASPreImage, error)

MarshalCapn marshals the object into its capnproto definition

func (*ASPreImage) PreHash

func (b *ASPreImage) PreHash() ([]byte, error)

PreHash returns the PreHash of the object

func (*ASPreImage) SignAsAlternate

func (b *ASPreImage) SignAsAlternate(msg []byte, signer *crypto.Secp256k1Signer, hashKey []byte) (*AtomicSwapSignature, error)

SignAsAlternate signs the ASPreImage as the alternate account owner

func (*ASPreImage) SignAsPrimary

func (b *ASPreImage) SignAsPrimary(msg []byte, signer *crypto.Secp256k1Signer, hashKey []byte) (*AtomicSwapSignature, error)

SignAsPrimary signs the ASPreImage as the primary account owner

func (*ASPreImage) UnmarshalBinary

func (b *ASPreImage) UnmarshalBinary(data []byte) error

UnmarshalBinary takes a byte slice and returns the corresponding ASPreImage object

func (*ASPreImage) UnmarshalCapn

func (b *ASPreImage) UnmarshalCapn(bc mdefs.ASPreImage) error

UnmarshalCapn unmarshals the capnproto definition of the object

func (*ASPreImage) ValidateSignature

func (b *ASPreImage) ValidateSignature(currentHeight uint32, msg []byte, sig *AtomicSwapSignature) error

ValidateSignature validates the signature for ASPreImage

type AtomicSwap

type AtomicSwap struct {
	ASPreImage *ASPreImage
	TxHash     []byte
	// contains filtered or unexported fields
}

AtomicSwap is an atomic swap object based on a time lock hash

func (*AtomicSwap) ChainID

func (b *AtomicSwap) ChainID() (uint32, error)

ChainID returns the ChainID of the AtomicSwap

func (*AtomicSwap) Exp

func (b *AtomicSwap) Exp() (uint32, error)

Exp returns the epoch after which the AtomicSwap will expire

func (*AtomicSwap) GenericOwner

func (b *AtomicSwap) GenericOwner() (*Owner, error)

GenericOwner returns the PrimaryOwner of the AtomicSwap as an Owner object

func (*AtomicSwap) IsExpired

func (b *AtomicSwap) IsExpired(currentHeight uint32) (bool, error)

IsExpired returns true if the current epoch is greater than exp

func (*AtomicSwap) IssuedAt

func (b *AtomicSwap) IssuedAt() (uint32, error)

IssuedAt returns the epoch of issuance for the AtomicSwap

func (*AtomicSwap) MakeTxIn

func (b *AtomicSwap) MakeTxIn() (*TXIn, error)

MakeTxIn constructs a TXIn object for the current object

func (*AtomicSwap) MarshalBinary

func (b *AtomicSwap) MarshalBinary() ([]byte, error)

MarshalBinary takes the AtomicSwap object and returns the canonical byte slice

func (*AtomicSwap) MarshalCapn

func (b *AtomicSwap) MarshalCapn(seg *capnp.Segment) (mdefs.AtomicSwap, error)

MarshalCapn marshals the object into its capnproto definition

func (*AtomicSwap) Owner

func (b *AtomicSwap) Owner() (*AtomicSwapOwner, error)

Owner returns the AtomicSwapOwner object of the AtomicSwap

func (*AtomicSwap) PreHash

func (b *AtomicSwap) PreHash() ([]byte, error)

PreHash returns the PreHash of the object

func (*AtomicSwap) SetTXOutIdx

func (b *AtomicSwap) SetTXOutIdx(idx uint32) error

SetTXOutIdx sets the TXOutIdx of the object

func (*AtomicSwap) SetTxHash

func (b *AtomicSwap) SetTxHash(txHash []byte) error

SetTxHash sets the TxHash of the object

func (*AtomicSwap) SignAsAlternate

func (b *AtomicSwap) SignAsAlternate(txIn *TXIn, signer *crypto.Secp256k1Signer, hashKey []byte) error

SignAsAlternate signs the object as the user who is exchanging in the AtomicSwap

func (*AtomicSwap) SignAsPrimary

func (b *AtomicSwap) SignAsPrimary(txIn *TXIn, signer *crypto.Secp256k1Signer, hashKey []byte) error

SignAsPrimary signs the object as the user who is the original creator of the AtomicSwap

func (*AtomicSwap) TXOutIdx

func (b *AtomicSwap) TXOutIdx() (uint32, error)

TXOutIdx returns the TXOutIdx of the object

func (*AtomicSwap) UTXOID

func (b *AtomicSwap) UTXOID() ([]byte, error)

UTXOID returns the UTXOID of the object

func (*AtomicSwap) UnmarshalBinary

func (b *AtomicSwap) UnmarshalBinary(data []byte) error

UnmarshalBinary takes a byte slice and returns the corresponding AtomicSwap object

func (*AtomicSwap) UnmarshalCapn

func (b *AtomicSwap) UnmarshalCapn(bc mdefs.AtomicSwap) error

UnmarshalCapn unmarshals the capnproto definition of the object

func (*AtomicSwap) ValidateSignature

func (b *AtomicSwap) ValidateSignature(currentHeight uint32, txIn *TXIn) error

ValidateSignature validates the signature of the TXIn against the atomic swap

func (*AtomicSwap) Value

func (b *AtomicSwap) Value() (*uint256.Uint256, error)

Value returns the Value of the object

type AtomicSwapOwner

type AtomicSwapOwner struct {
	SVA            SVA
	HashLock       []byte
	AlternateOwner *AtomicSwapSubOwner
	PrimaryOwner   *AtomicSwapSubOwner
}

AtomicSwapOwner describes the necessary information for AtomicSwap object

func (*AtomicSwapOwner) AlternateAccount

func (aso *AtomicSwapOwner) AlternateAccount() ([]byte, error)

AlternateAccount returns the account byte slice of the AlternateOwner

func (*AtomicSwapOwner) MarshalBinary

func (aso *AtomicSwapOwner) MarshalBinary() ([]byte, error)

MarshalBinary takes the AtomicSwapOwner object and returns the canonical byte slice

func (*AtomicSwapOwner) New

func (aso *AtomicSwapOwner) New(priOwnerAcct []byte, altOwnerAcct []byte, hashKey []byte) error

New creates a new AtomicSwapOwner

func (*AtomicSwapOwner) NewFromOwner

func (aso *AtomicSwapOwner) NewFromOwner(priOwner *Owner, altOwner *Owner, hashKey []byte) error

NewFromOwner creates a new AtomicSwapOwner from Owner objects

func (*AtomicSwapOwner) PrimaryAccount

func (aso *AtomicSwapOwner) PrimaryAccount() ([]byte, error)

PrimaryAccount returns the account byte slice of the PrimaryOwner

func (*AtomicSwapOwner) SignAsAlternate

func (aso *AtomicSwapOwner) SignAsAlternate(msg []byte, signer *crypto.Secp256k1Signer, hashKey []byte) (*AtomicSwapSignature, error)

SignAsAlternate ...

func (*AtomicSwapOwner) SignAsPrimary

func (aso *AtomicSwapOwner) SignAsPrimary(msg []byte, signer *crypto.Secp256k1Signer, hashKey []byte) (*AtomicSwapSignature, error)

SignAsPrimary ...

func (*AtomicSwapOwner) UnmarshalBinary

func (aso *AtomicSwapOwner) UnmarshalBinary(o []byte) error

UnmarshalBinary takes a byte slice and returns the corresponding AtomicSwapOwner object

func (*AtomicSwapOwner) Validate

func (aso *AtomicSwapOwner) Validate() error

Validate validates the AtomicSwapOwner

func (*AtomicSwapOwner) ValidateSignature

func (aso *AtomicSwapOwner) ValidateSignature(msg []byte, sig *AtomicSwapSignature, isExpired bool) error

ValidateSignature validates the signature

type AtomicSwapSignature

type AtomicSwapSignature struct {
	SVA        SVA
	CurveSpec  constants.CurveSpec
	SignerRole SignerRole
	HashKey    []byte
	Signature  []byte
}

AtomicSwapSignature is the signs the AtomicSwap object

func (*AtomicSwapSignature) MarshalBinary

func (onr *AtomicSwapSignature) MarshalBinary() ([]byte, error)

MarshalBinary takes the AtomicSwapSignature object and returns the canonical byte slice

func (*AtomicSwapSignature) UnmarshalBinary

func (onr *AtomicSwapSignature) UnmarshalBinary(signature []byte) error

UnmarshalBinary takes a byte slice and returns the corresponding AtomicSwapSignature object

func (*AtomicSwapSignature) Validate

func (onr *AtomicSwapSignature) Validate() error

Validate validates the AtomicSwapSignature

type AtomicSwapSubOwner

type AtomicSwapSubOwner struct {
	CurveSpec constants.CurveSpec
	Account   []byte
}

AtomicSwapSubOwner ...

func (*AtomicSwapSubOwner) MarshalBinary

func (asso *AtomicSwapSubOwner) MarshalBinary() ([]byte, error)

MarshalBinary takes the AtomicSwapSubOwner object and returns the canonical byte slice

func (*AtomicSwapSubOwner) NewFromOwner

func (asso *AtomicSwapSubOwner) NewFromOwner(o *Owner) error

NewFromOwner takes an Owner object and creates the corresponding AtomicSwapSubOwner

func (*AtomicSwapSubOwner) UnmarshalBinary

func (asso *AtomicSwapSubOwner) UnmarshalBinary(o []byte) ([]byte, error)

UnmarshalBinary takes a byte slice and returns the corresponding AtomicSwapSubOwner object

func (*AtomicSwapSubOwner) Validate

func (asso *AtomicSwapSubOwner) Validate() error

Validate validates the AtomicSwapSubOwner object

func (*AtomicSwapSubOwner) ValidateSignature

func (asso *AtomicSwapSubOwner) ValidateSignature(msg []byte, sig *AtomicSwapSignature) error

ValidateSignature validates the signature of the AtomicSwapSignature object

type DSLinker

type DSLinker struct {
	DSPreImage *DSPreImage
	TxHash     []byte
}

DSLinker links the DSPreImage to the DataStore

func (*DSLinker) ChainID

func (b *DSLinker) ChainID() (uint32, error)

ChainID returns the ChainID of the object

func (*DSLinker) EpochOfExpiration

func (b *DSLinker) EpochOfExpiration() (uint32, error)

EpochOfExpiration returns the epoch in which the datastore may be garbage collected

func (*DSLinker) Index

func (b *DSLinker) Index() ([]byte, error)

Index returns the Index of the object

func (*DSLinker) IssuedAt

func (b *DSLinker) IssuedAt() (uint32, error)

IssuedAt returns the IssuedAt of the object

func (*DSLinker) MarshalBinary

func (b *DSLinker) MarshalBinary() ([]byte, error)

MarshalBinary takes the DSLinker object and returns the canonical byte slice

func (*DSLinker) MarshalCapn

func (b *DSLinker) MarshalCapn(seg *capnp.Segment) (mdefs.DSLinker, error)

MarshalCapn marshals the object into its capnproto definition

func (*DSLinker) Owner

func (b *DSLinker) Owner() (*DataStoreOwner, error)

Owner returns the Owner field of the sub object

func (*DSLinker) PreHash

func (b *DSLinker) PreHash() ([]byte, error)

PreHash returns the PreHash of the object

func (*DSLinker) RawData

func (b *DSLinker) RawData() ([]byte, error)

RawData returns the RawData field of the sub object

func (*DSLinker) RemainingValue

func (b *DSLinker) RemainingValue(currentHeight uint32) (*uint256.Uint256, error)

RemainingValue returns remaining value at the time of consumption

func (*DSLinker) SetTXOutIdx

func (b *DSLinker) SetTXOutIdx(idx uint32) error

SetTXOutIdx sets the TXOutIdx of the object

func (*DSLinker) TXOutIdx

func (b *DSLinker) TXOutIdx() (uint32, error)

TXOutIdx returns the TXOutIdx of the object

func (*DSLinker) UTXOID

func (b *DSLinker) UTXOID() ([]byte, error)

UTXOID returns the UTXOID of the object

func (*DSLinker) UnmarshalBinary

func (b *DSLinker) UnmarshalBinary(data []byte) error

UnmarshalBinary takes a byte slice and returns the corresponding DSLinker object

func (*DSLinker) UnmarshalCapn

func (b *DSLinker) UnmarshalCapn(bc mdefs.DSLinker) error

UnmarshalCapn unmarshals the capnproto definition of the object

func (*DSLinker) ValidatePreSignature

func (b *DSLinker) ValidatePreSignature(msg []byte, sig *DataStoreSignature) error

ValidatePreSignature validates the signature of the datastore at the time of creation

func (*DSLinker) ValidateSignature

func (b *DSLinker) ValidateSignature(currentHeight uint32, msg []byte, sig *DataStoreSignature) error

ValidateSignature validates the signature of the datastore at the time of consumption

func (*DSLinker) Value

func (b *DSLinker) Value() (*uint256.Uint256, error)

Value returns the value stored in the object at the time of creation

type DSPreImage

type DSPreImage struct {
	ChainID  uint32
	Index    []byte
	IssuedAt uint32
	Deposit  *uint256.Uint256
	RawData  []byte
	TXOutIdx uint32
	Owner    *DataStoreOwner
}

DSPreImage is a DataStore preimage

func (*DSPreImage) EpochOfExpiration

func (b *DSPreImage) EpochOfExpiration() (uint32, error)

EpochOfExpiration returns the epoch in which the datastore may be garbage collected

func (*DSPreImage) IsExpired

func (b *DSPreImage) IsExpired(currentHeight uint32) (bool, error)

IsExpired returns true if the datastore is free for garbage collection

func (*DSPreImage) MarshalBinary

func (b *DSPreImage) MarshalBinary() ([]byte, error)

MarshalBinary takes the DSPreImage object and returns the canonical byte slice

func (*DSPreImage) MarshalCapn

func (b *DSPreImage) MarshalCapn(seg *capnp.Segment) (mdefs.DSPreImage, error)

MarshalCapn marshals the object into its capnproto definition

func (*DSPreImage) PreHash

func (b *DSPreImage) PreHash() ([]byte, error)

PreHash returns the PreHash of the object

func (*DSPreImage) RemainingValue

func (b *DSPreImage) RemainingValue(currentHeight uint32) (*uint256.Uint256, error)

RemainingValue returns remaining value at the time of consumption

func (*DSPreImage) UnmarshalBinary

func (b *DSPreImage) UnmarshalBinary(data []byte) error

UnmarshalBinary takes a byte slice and returns the corresponding DSPreImage object

func (*DSPreImage) UnmarshalCapn

func (b *DSPreImage) UnmarshalCapn(bc mdefs.DSPreImage) error

UnmarshalCapn unmarshals the capnproto definition of the object

func (*DSPreImage) ValidateDeposit

func (b *DSPreImage) ValidateDeposit() error

ValidateDeposit validates the deposit

func (*DSPreImage) ValidatePreSignature

func (b *DSPreImage) ValidatePreSignature(msg []byte, sig *DataStoreSignature) error

ValidatePreSignature validates the signature of the datastore at the time of creation

func (*DSPreImage) ValidateSignature

func (b *DSPreImage) ValidateSignature(currentHeight uint32, msg []byte, sig *DataStoreSignature) error

ValidateSignature validates the signature of the datastore at the time of consumption

func (*DSPreImage) Value

func (b *DSPreImage) Value() (*uint256.Uint256, error)

Value returns the value stored in the object at the time of creation

type DataStore

type DataStore struct {
	DSLinker  *DSLinker
	Signature *DataStoreSignature
}

DataStore is a datastore UTXO

func (*DataStore) ChainID

func (b *DataStore) ChainID() (uint32, error)

ChainID returns the ChainID of the object

func (*DataStore) EpochOfExpiration

func (b *DataStore) EpochOfExpiration() (uint32, error)

EpochOfExpiration returns the epoch in which the datastore may be garbage collected

func (*DataStore) GenericOwner

func (b *DataStore) GenericOwner() (*Owner, error)

GenericOwner returns the Owner of the DataStore

func (*DataStore) Index

func (b *DataStore) Index() ([]byte, error)

Index returns the Index of the object

func (*DataStore) IssuedAt

func (b *DataStore) IssuedAt() (uint32, error)

IssuedAt returns the IssuedAt of the object

func (*DataStore) MakeTxIn

func (b *DataStore) MakeTxIn() (*TXIn, error)

MakeTxIn constructs a TXIn object for the current object

func (*DataStore) MarshalBinary

func (b *DataStore) MarshalBinary() ([]byte, error)

MarshalBinary takes the DataStore object and returns the canonical byte slice

func (*DataStore) MarshalCapn

func (b *DataStore) MarshalCapn(seg *capnp.Segment) (mdefs.DataStore, error)

MarshalCapn marshals the object into its capnproto definition

func (*DataStore) Owner

func (b *DataStore) Owner() (*DataStoreOwner, error)

Owner returns the DataStoreOwner of the DataStore

func (*DataStore) PreHash

func (b *DataStore) PreHash() ([]byte, error)

PreHash returns the PreHash of the object

func (*DataStore) PreSign

func (b *DataStore) PreSign(s Signer) error

PreSign generates the signature for a DataStore at the time of creation

func (*DataStore) RawData

func (b *DataStore) RawData() ([]byte, error)

RawData returns the RawData field of the sub object

func (*DataStore) RemainingValue

func (b *DataStore) RemainingValue(currentHeight uint32) (*uint256.Uint256, error)

RemainingValue returns remaining value at the time of consumption

func (*DataStore) SetTXOutIdx

func (b *DataStore) SetTXOutIdx(idx uint32) error

SetTXOutIdx sets the TXOutIdx of the object

func (*DataStore) SetTxHash

func (b *DataStore) SetTxHash(txHash []byte) error

SetTxHash sets the TxHash of the object

func (*DataStore) Sign

func (b *DataStore) Sign(txIn *TXIn, s Signer) error

Sign generates the signature for a DataStore at the time of consumption

func (*DataStore) TXOutIdx

func (b *DataStore) TXOutIdx() (uint32, error)

TXOutIdx returns the TXOutIdx of the object

func (*DataStore) TxHash

func (b *DataStore) TxHash() ([]byte, error)

TxHash returns the TxHash of the object

func (*DataStore) UTXOID

func (b *DataStore) UTXOID() ([]byte, error)

UTXOID returns the UTXOID of the object

func (*DataStore) UnmarshalBinary

func (b *DataStore) UnmarshalBinary(data []byte) error

UnmarshalBinary takes a byte slice and returns the corresponding DataStore object

func (*DataStore) UnmarshalCapn

func (b *DataStore) UnmarshalCapn(bc mdefs.DataStore) error

UnmarshalCapn unmarshals the capnproto definition of the object

func (*DataStore) ValidatePreSignature

func (b *DataStore) ValidatePreSignature() error

ValidatePreSignature validates the signature of the datastore at the time of creation

func (*DataStore) ValidateSignature

func (b *DataStore) ValidateSignature(currentHeight uint32, txIn *TXIn) error

ValidateSignature validates the signature of the datastore at the time of consumption

func (*DataStore) Value

func (b *DataStore) Value() (*uint256.Uint256, error)

Value returns the value stored in the object at the time of creation

type DataStoreOwner

type DataStoreOwner struct {
	SVA       SVA
	CurveSpec constants.CurveSpec
	Account   []byte
}

DataStoreOwner is the struct which specifies the owner of the DataStore

func (*DataStoreOwner) MarshalBinary

func (dso *DataStoreOwner) MarshalBinary() ([]byte, error)

MarshalBinary takes the DataStoreOwner object and returns the canonical byte slice

func (*DataStoreOwner) New

func (dso *DataStoreOwner) New(acct []byte, curveSpec constants.CurveSpec)

New makes a new DataStoreOwner

func (*DataStoreOwner) NewFromOwner

func (dso *DataStoreOwner) NewFromOwner(o *Owner) error

NewFromOwner takes an Owner object and creates the corresponding DataStoreOwner

func (*DataStoreOwner) Sign

func (dso *DataStoreOwner) Sign(msg []byte, s Signer) (*DataStoreSignature, error)

Sign allows has the DataStoreOwner sign the message msg with signer s

func (*DataStoreOwner) UnmarshalBinary

func (dso *DataStoreOwner) UnmarshalBinary(o []byte) error

UnmarshalBinary takes a byte slice and returns the corresponding DataStoreOwner object

func (*DataStoreOwner) Validate

func (dso *DataStoreOwner) Validate() error

Validate validates the DataStoreOwner

func (*DataStoreOwner) ValidateSignature

func (dso *DataStoreOwner) ValidateSignature(msg []byte, sig *DataStoreSignature, isExpired bool) error

ValidateSignature validates the DataStoreSignature

type DataStoreSignature

type DataStoreSignature struct {
	SVA       SVA
	CurveSpec constants.CurveSpec
	Signature []byte
}

DataStoreSignature ...

func (*DataStoreSignature) MarshalBinary

func (dss *DataStoreSignature) MarshalBinary() ([]byte, error)

MarshalBinary takes the DataStoreSignature object and returns the canonical byte slice

func (*DataStoreSignature) UnmarshalBinary

func (dss *DataStoreSignature) UnmarshalBinary(signature []byte) error

UnmarshalBinary takes a byte slice and returns the corresponding DataStoreSignature object

func (*DataStoreSignature) Validate

func (dss *DataStoreSignature) Validate() error

Validate validates the DataStoreSignature object

type Owner

type Owner struct {
	CurveSpec constants.CurveSpec
	Account   []byte
}

Owner contains information related to a general owner object

func (*Owner) MarshalBinary

func (onr *Owner) MarshalBinary() ([]byte, error)

MarshalBinary takes the Owner object and returns the canonical byte slice

func (*Owner) New

func (onr *Owner) New(acct []byte, curveSpec constants.CurveSpec) error

New makes a new Owner

func (*Owner) NewFromAtomicSwapOwner

func (onr *Owner) NewFromAtomicSwapOwner(aso *AtomicSwapOwner) error

NewFromAtomicSwapOwner makes a new Owner from an AtomicSwapOwner (PrimaryOwner)

func (*Owner) NewFromAtomicSwapSubOwner

func (onr *Owner) NewFromAtomicSwapSubOwner(asso *AtomicSwapSubOwner) error

NewFromAtomicSwapSubOwner makes a new Owner from an AtomicSwapSubOwner

func (*Owner) NewFromDataStoreOwner

func (onr *Owner) NewFromDataStoreOwner(dso *DataStoreOwner) error

NewFromDataStoreOwner makes a new Owner from a DataStoreOwner

func (*Owner) NewFromValueStoreOwner

func (onr *Owner) NewFromValueStoreOwner(vso *ValueStoreOwner) error

NewFromValueStoreOwner makes a new Owner from a ValueStoreOwner

func (*Owner) UnmarshalBinary

func (onr *Owner) UnmarshalBinary(o []byte) error

UnmarshalBinary takes a byte slice and returns the corresponding Owner object

func (*Owner) Validate

func (onr *Owner) Validate() error

Validate validates the Owner object

type PaginationResponse

type PaginationResponse struct {
	UTXOID []byte
	Index  []byte
}

type SVA

type SVA uint8

SVA is the defined type utilized for designation of a Signature Verification Algorithm

const (
	// ValueStoreSVA is the constant which specifies the
	// Signature Verification Algorithm used for ValueStore objects
	ValueStoreSVA SVA = iota + 1

	// HashedTimelockSVA is the constant which specifies the
	// Signature Verification Algorithm used for AtomicSwap objects
	HashedTimelockSVA

	// DataStoreSVA is the constant which specifies the
	// Signature Verification Algorithm used for DataStore objects
	DataStoreSVA
)

type Signer

type Signer interface {
	Sign(msg []byte) (sig []byte, err error)
	Pubkey() ([]byte, error)
}

Signer is the interface for a signature generation struct.

type SignerRole

type SignerRole uint8
const (
	// PrimarySignerRole is the constant which specifies the role of the
	// primary account owner in the AtomicSwap object
	PrimarySignerRole SignerRole = iota + 1

	// AlternateSignerRole is the constant which specifies the role of the
	// alternate account owner in the AtomicSwap object
	AlternateSignerRole
)

type TXIn

type TXIn struct {
	TXInLinker *TXInLinker
	Signature  []byte
}

TXIn is a tx input object that acts as a reference to a UTXO

func (*TXIn) ChainID

func (b *TXIn) ChainID() (uint32, error)

ChainID returns the chain ID

func (*TXIn) ConsumedTxHash

func (b *TXIn) ConsumedTxHash() ([]byte, error)

ConsumedTxHash returns the consumed TxHash

func (*TXIn) ConsumedTxIdx

func (b *TXIn) ConsumedTxIdx() (uint32, error)

ConsumedTxIdx returns the consumed TxIdx

func (*TXIn) IsDeposit

func (b *TXIn) IsDeposit() bool

IsDeposit returns true if TXIn is a deposit; otherwise, returns false.

func (*TXIn) MarshalBinary

func (b *TXIn) MarshalBinary() ([]byte, error)

MarshalBinary takes the TXIn object and returns the canonical byte slice

func (*TXIn) MarshalCapn

func (b *TXIn) MarshalCapn(seg *capnp.Segment) (mdefs.TXIn, error)

MarshalCapn marshals the object into its capnproto definition

func (*TXIn) PreHash

func (b *TXIn) PreHash() ([]byte, error)

PreHash returns the PreHash of the object

func (*TXIn) SetTxHash

func (b *TXIn) SetTxHash(txHash []byte) error

SetTxHash sets the TxHash of the TXIn object

func (*TXIn) TxHash

func (b *TXIn) TxHash() ([]byte, error)

TxHash returns the TxHash of the TXIn object

func (*TXIn) UTXOID

func (b *TXIn) UTXOID() ([]byte, error)

UTXOID returns the UTXOID of the object

func (*TXIn) UnmarshalBinary

func (b *TXIn) UnmarshalBinary(data []byte) error

UnmarshalBinary takes a byte slice and returns the corresponding TXIn object

func (*TXIn) UnmarshalCapn

func (b *TXIn) UnmarshalCapn(bc mdefs.TXIn) error

UnmarshalCapn unmarshals the capnproto definition of the object

type TXInLinker

type TXInLinker struct {
	TXInPreImage *TXInPreImage
	TxHash       []byte
}

TXInLinker ...

func (*TXInLinker) ChainID

func (b *TXInLinker) ChainID() (uint32, error)

ChainID returns the chain ID

func (*TXInLinker) ConsumedTxHash

func (b *TXInLinker) ConsumedTxHash() ([]byte, error)

ConsumedTxHash returns the consumed TxHash

func (*TXInLinker) ConsumedTxIdx

func (b *TXInLinker) ConsumedTxIdx() (uint32, error)

ConsumedTxIdx returns the consumed TxIdx

func (*TXInLinker) IsDeposit

func (b *TXInLinker) IsDeposit() bool

IsDeposit returns true if TXInLinker is a deposit; otherwise, returns false.

func (*TXInLinker) MarshalBinary

func (b *TXInLinker) MarshalBinary() ([]byte, error)

MarshalBinary takes the TXInLinker object and returns the canonical byte slice

func (*TXInLinker) MarshalCapn

func (b *TXInLinker) MarshalCapn(seg *capnp.Segment) (mdefs.TXInLinker, error)

MarshalCapn marshals the object into its capnproto definition

func (*TXInLinker) PreHash

func (b *TXInLinker) PreHash() ([]byte, error)

PreHash returns the PreHash of the object

func (*TXInLinker) SetTxHash

func (b *TXInLinker) SetTxHash(txHash []byte) error

SetTxHash sets TxHash

func (*TXInLinker) UTXOID

func (b *TXInLinker) UTXOID() ([]byte, error)

UTXOID returns the UTXOID of the object

func (*TXInLinker) UnmarshalBinary

func (b *TXInLinker) UnmarshalBinary(data []byte) error

UnmarshalBinary takes a byte slice and returns the corresponding TXInLinker object

func (*TXInLinker) UnmarshalCapn

func (b *TXInLinker) UnmarshalCapn(bc mdefs.TXInLinker) error

UnmarshalCapn unmarshals the capnproto definition of the object

type TXInPreImage

type TXInPreImage struct {
	ChainID        uint32
	ConsumedTxIdx  uint32
	ConsumedTxHash []byte
}

TXInPreImage is the tx input preimage

func (*TXInPreImage) IsDeposit

func (b *TXInPreImage) IsDeposit() bool

IsDeposit returns true if TXInPreImage is a deposit; otherwise, returns false.

func (*TXInPreImage) MarshalBinary

func (b *TXInPreImage) MarshalBinary() ([]byte, error)

MarshalBinary takes the TXInPreImage object and returns the canonical byte slice

func (*TXInPreImage) MarshalCapn

func (b *TXInPreImage) MarshalCapn(seg *capnp.Segment) (mdefs.TXInPreImage, error)

MarshalCapn marshals the object into its capnproto definition

func (*TXInPreImage) PreHash

func (b *TXInPreImage) PreHash() ([]byte, error)

PreHash returns the PreHash of the object

func (*TXInPreImage) UTXOID

func (b *TXInPreImage) UTXOID() ([]byte, error)

UTXOID returns the UTXOID of the object

func (*TXInPreImage) UnmarshalBinary

func (b *TXInPreImage) UnmarshalBinary(data []byte) error

UnmarshalBinary takes a byte slice and returns the corresponding TXInPreImage object

func (*TXInPreImage) UnmarshalCapn

func (b *TXInPreImage) UnmarshalCapn(bc mdefs.TXInPreImage) error

UnmarshalCapn unmarshals the capnproto definition of the object

type TXOut

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

TXOut is a UTXO object

func (*TXOut) Account

func (b *TXOut) Account() ([]byte, error)

Account returns the account from the TXOut

func (*TXOut) AtomicSwap

func (b *TXOut) AtomicSwap() (*AtomicSwap, error)

AtomicSwap returns the AtomicSwap of the TXOut object if it exists

func (*TXOut) CannotBeMinedBeforeHeight

func (b *TXOut) CannotBeMinedBeforeHeight() (uint32, error)

CannotBeMinedBeforeHeight ...

func (*TXOut) ChainID

func (b *TXOut) ChainID() (uint32, error)

ChainID returns the ChainID of the object

func (*TXOut) CreateValueStore

func (b *TXOut) CreateValueStore(chainID uint32, value *uint256.Uint256, acct []byte, curveSpec constants.CurveSpec, txHash []byte) error

CreateValueStore makes a new ValueStore

func (*TXOut) CreateValueStoreFromDeposit

func (b *TXOut) CreateValueStoreFromDeposit(chainID uint32, value *uint256.Uint256, acct []byte, nonce []byte) error

CreateValueStoreFromDeposit makes a new ValueStore from a deposit

func (*TXOut) DataStore

func (b *TXOut) DataStore() (*DataStore, error)

DataStore returns the DataStore of the TXOut object if it exists

func (*TXOut) GenericOwner

func (b *TXOut) GenericOwner() (*Owner, error)

GenericOwner returns the Owner from the TXOut

func (*TXOut) HasAtomicSwap

func (b *TXOut) HasAtomicSwap() bool

HasAtomicSwap specifies if the TXOut object has an AtomicSwap

func (*TXOut) HasDataStore

func (b *TXOut) HasDataStore() bool

HasDataStore specifies if the TXOut object has a DataStore

func (*TXOut) HasValueStore

func (b *TXOut) HasValueStore() bool

HasValueStore specifies if the TXOut object has a ValueStore

func (*TXOut) IsDeposit

func (b *TXOut) IsDeposit() bool

IsDeposit returns true if it is a valid ValueStore with deposit. All other instances return false.

func (*TXOut) MakeTxIn

func (b *TXOut) MakeTxIn() (*TXIn, error)

MakeTxIn returns a TXIn for the object

func (*TXOut) MarshalBinary

func (b *TXOut) MarshalBinary() ([]byte, error)

MarshalBinary takes the TXOut object and returns the canonical byte slice

func (*TXOut) MarshalCapn

func (b *TXOut) MarshalCapn(seg *capnp.Segment) (mdefs.TXOut, error)

MarshalCapn marshals the object into its capnproto definition

func (*TXOut) MustBeMinedBeforeHeight

func (b *TXOut) MustBeMinedBeforeHeight() (uint32, error)

MustBeMinedBeforeHeight ...

func (*TXOut) NewAtomicSwap

func (b *TXOut) NewAtomicSwap(v *AtomicSwap) error

NewAtomicSwap makes a TXOut object which with the specified AtomicSwap

func (*TXOut) NewDataStore

func (b *TXOut) NewDataStore(v *DataStore) error

NewDataStore makes a TXOut object which with the specified DataStore

func (*TXOut) NewValueStore

func (b *TXOut) NewValueStore(v *ValueStore) error

NewValueStore makes a TXOut object which with the specified ValueStore

func (*TXOut) PreHash

func (b *TXOut) PreHash() ([]byte, error)

PreHash returns the PreHash of the object

func (*TXOut) RemainingValue

func (b *TXOut) RemainingValue(currentHeight uint32) (*uint256.Uint256, error)

RemainingValue returns the remaining value after discount

func (*TXOut) SetTXOutIdx

func (b *TXOut) SetTXOutIdx(idx uint32) error

SetTXOutIdx sets the TXOutIdx of the object

func (*TXOut) SetTxHash

func (b *TXOut) SetTxHash(txHash []byte) error

SetTxHash sets the txHash of the object

func (*TXOut) TXOutIdx

func (b *TXOut) TXOutIdx() (uint32, error)

TXOutIdx returns the TXOutIdx of the object

func (*TXOut) TxHash

func (b *TXOut) TxHash() ([]byte, error)

TxHash returns the txHash from the object

func (*TXOut) UTXOID

func (b *TXOut) UTXOID() ([]byte, error)

UTXOID returns the UTXOID of the object

func (*TXOut) UnmarshalBinary

func (b *TXOut) UnmarshalBinary(data []byte) error

UnmarshalBinary takes a byte slice and returns the corresponding TXOut object

func (*TXOut) UnmarshalCapn

func (b *TXOut) UnmarshalCapn(bc mdefs.TXOut) error

UnmarshalCapn unmarshals the capnproto definition of the object

func (*TXOut) ValidatePreSignature

func (b *TXOut) ValidatePreSignature() error

ValidatePreSignature validates the PreSignature of the object

func (*TXOut) ValidateSignature

func (b *TXOut) ValidateSignature(currentHeight uint32, txIn *TXIn) error

ValidateSignature validates the signature of the txIn against the UTXO

func (*TXOut) Value

func (b *TXOut) Value() (*uint256.Uint256, error)

Value returns the Value of the object

func (*TXOut) ValueStore

func (b *TXOut) ValueStore() (*ValueStore, error)

ValueStore returns the ValueStore of the TXOut object if it exists

type Tx

type Tx struct {
	Vin  Vin
	Vout Vout
	// contains filtered or unexported fields
}

Tx is a transaction object

func (*Tx) CannotBeMinedUntil

func (b *Tx) CannotBeMinedUntil() (uint32, error)

CannotBeMinedUntil ...

func (*Tx) ConsumedIsDeposit

func (b *Tx) ConsumedIsDeposit() []bool

ConsumedIsDeposit returns the list of IsDeposit bools from Vin

func (*Tx) ConsumedPreHash

func (b *Tx) ConsumedPreHash() ([][]byte, error)

ConsumedPreHash returns the list of PreHashs from Vin

func (*Tx) ConsumedUTXOID

func (b *Tx) ConsumedUTXOID() ([][]byte, error)

ConsumedUTXOID returns the list of UTXOIDs from Vin

func (*Tx) EpochOfExpirationForMining

func (b *Tx) EpochOfExpirationForMining() (uint32, error)

EpochOfExpirationForMining ...

func (*Tx) GeneratedPreHash

func (b *Tx) GeneratedPreHash() ([][]byte, error)

GeneratedPreHash returns the list of PreHashs from Vout

func (*Tx) GeneratedUTXOID

func (b *Tx) GeneratedUTXOID() ([][]byte, error)

GeneratedUTXOID returns the list of UTXOIDs from Vout

func (*Tx) MarshalBinary

func (b *Tx) MarshalBinary() ([]byte, error)

MarshalBinary takes the Tx object and returns the canonical byte slice

func (*Tx) MarshalCapn

func (b *Tx) MarshalCapn(seg *capnp.Segment) (mdefs.Tx, error)

MarshalCapn marshals the object into its capnproto definition

func (*Tx) PostValidatePending

func (b *Tx) PostValidatePending(currentHeight uint32, consumedUTXOs Vout) error

PostValidatePending ...

func (*Tx) PreValidatePending

func (b *Tx) PreValidatePending(chainID uint32) error

PreValidatePending ...

func (*Tx) SetTxHash

func (b *Tx) SetTxHash() error

SetTxHash calculates the TxHash and sets it on all UTXOs and TXIns

func (*Tx) TxHash

func (b *Tx) TxHash() ([]byte, error)

TxHash calculates the TxHash of the transaction

func (*Tx) UnmarshalBinary

func (b *Tx) UnmarshalBinary(data []byte) error

UnmarshalBinary takes a byte slice and returns the corresponding Tx object

func (*Tx) UnmarshalCapn

func (b *Tx) UnmarshalCapn(bc mdefs.Tx) error

UnmarshalCapn unmarshals the capnproto definition of the object

func (*Tx) Validate

func (b *Tx) Validate(set map[string]bool, currentHeight uint32, consumedUTXOs Vout) (map[string]bool, error)

Validate ...

func (*Tx) ValidateChainID

func (b *Tx) ValidateChainID(chainID uint32) error

ValidateChainID validates that all elements have the correct ChainID

func (*Tx) ValidateDataStoreIndexes

func (b *Tx) ValidateDataStoreIndexes(opset map[string]bool) (map[string]bool, error)

ValidateDataStoreIndexes ensures there are no duplicate output indices for DataStore objects

func (*Tx) ValidateEqualVinVout

func (b *Tx) ValidateEqualVinVout(refUTXOs Vout, currentHeight uint32) error

ValidateEqualVinVout checks the following calc sum on inputs from utxos and currentHeight sum inputs must equal sum outputs

func (*Tx) ValidateIssuedAtForMining

func (b *Tx) ValidateIssuedAtForMining(currentHeight uint32) error

ValidateIssuedAtForMining ...

func (*Tx) ValidatePreSignature

func (b *Tx) ValidatePreSignature() error

ValidatePreSignature validates the presignatures of the objects

func (*Tx) ValidateSignature

func (b *Tx) ValidateSignature(currentHeight uint32, refUTXOs Vout) error

ValidateSignature validates the signatures of the objects

func (*Tx) ValidateTxHash

func (b *Tx) ValidateTxHash() error

ValidateTxHash validates the txHash is correct on all objects

func (*Tx) ValidateUnique

func (b *Tx) ValidateUnique(opset map[string]bool) (map[string]bool, error)

ValidateUnique checks that all inputs and outputs are unique

func (*Tx) XXXIsTx

func (b *Tx) XXXIsTx()

XXXIsTx allows compile time type checking for transaction interfaces

type TxVec

type TxVec []*Tx

TxVec is a vector of transactions Tx

func (TxVec) ConsumedIsDeposit

func (txv TxVec) ConsumedIsDeposit() []bool

ConsumedIsDeposit returns list of bools to specify which Txs in txv are deposits

func (TxVec) ConsumedPreHash

func (txv TxVec) ConsumedPreHash() ([][]byte, error)

ConsumedPreHash returns the list of consumed PreHashs from TxVec

func (TxVec) ConsumedPreHashOnlyDeposits

func (txv TxVec) ConsumedPreHashOnlyDeposits() ([][]byte, error)

ConsumedPreHashOnlyDeposits returns list of PreHashs from txv only for transactions which are deposits

func (TxVec) ConsumedTxIns

func (txv TxVec) ConsumedTxIns() (Vin, error)

ConsumedTxIns returns list of TxIns consumed by TxVec

func (TxVec) ConsumedUTXOID

func (txv TxVec) ConsumedUTXOID() ([][]byte, error)

ConsumedUTXOID returns the list of consumed UTXOIDs in TxVec

func (TxVec) ConsumedUTXOIDNoDeposits

func (txv TxVec) ConsumedUTXOIDNoDeposits() ([][]byte, error)

ConsumedUTXOIDNoDeposits returns list of UTXOIDs from txv only for transactions which are not deposits

func (TxVec) ConsumedUTXOIDOnlyDeposits

func (txv TxVec) ConsumedUTXOIDOnlyDeposits() ([][]byte, error)

ConsumedUTXOIDOnlyDeposits returns list of UTXOIDs from txv only for transactions which are deposits

func (TxVec) GeneratedPreHash

func (txv TxVec) GeneratedPreHash() ([][]byte, error)

GeneratedPreHash returns list of PreHashs for Tx in txv

func (TxVec) GeneratedUTXOID

func (txv TxVec) GeneratedUTXOID() ([][]byte, error)

GeneratedUTXOID returns list of UTXOIDs for Tx in txv

func (TxVec) GeneratedUTXOs

func (txv TxVec) GeneratedUTXOs() (Vout, error)

GeneratedUTXOs returns list of TXOuts from Txs in txv

func (TxVec) MarshalBinary

func (txv TxVec) MarshalBinary() ([][]byte, error)

MarshalBinary takes the TxVec object and returns the canonical byte slice

func (TxVec) PostValidatePending

func (txv TxVec) PostValidatePending(currentHeight uint32, consumedUTXOs Vout) error

PostValidatePending ...

func (TxVec) PreValidateApplyState

func (txv TxVec) PreValidateApplyState(chainID uint32) error

PreValidateApplyState ...

func (TxVec) PreValidatePending

func (txv TxVec) PreValidatePending(chainID uint32) error

PreValidatePending ...

func (TxVec) TxHash

func (txv TxVec) TxHash() ([][]byte, error)

TxHash returns the list of TxHashs from TxVec

func (TxVec) Validate

func (txv TxVec) Validate(currentHeight uint32, consumedUTXOs Vout) error

Validate ...

func (TxVec) ValidateChainID

func (txv TxVec) ValidateChainID(chainID uint32) error

ValidateChainID validates the chain ID in all transactions

func (TxVec) ValidateDataStoreIndexes

func (txv TxVec) ValidateDataStoreIndexes(exclSet map[string]bool) (map[string]bool, error)

func (TxVec) ValidateUnique

func (txv TxVec) ValidateUnique(exclSet map[string]bool) (map[string]bool, error)

ValidateUnique checks that all inputs and outputs are unique

type VSPreImage

type VSPreImage struct {
	ChainID  uint32
	Value    *uint256.Uint256
	TXOutIdx uint32
	Owner    *ValueStoreOwner
	// contains filtered or unexported fields
}

VSPreImage is a value store preimage

func (*VSPreImage) MarshalBinary

func (b *VSPreImage) MarshalBinary() ([]byte, error)

MarshalBinary takes the VSPreImage object and returns the canonical byte slice

func (*VSPreImage) MarshalCapn

func (b *VSPreImage) MarshalCapn(seg *capnp.Segment) (mdefs.VSPreImage, error)

MarshalCapn marshals the object into its capnproto definition

func (*VSPreImage) PreHash

func (b *VSPreImage) PreHash() ([]byte, error)

PreHash calculates the PreHash of the object

func (*VSPreImage) UnmarshalBinary

func (b *VSPreImage) UnmarshalBinary(data []byte) error

UnmarshalBinary takes a byte slice and returns the corresponding VSPreImage object

func (*VSPreImage) UnmarshalCapn

func (b *VSPreImage) UnmarshalCapn(bc mdefs.VSPreImage) error

UnmarshalCapn unmarshals the capnproto definition of the object

func (*VSPreImage) ValidateSignature

func (b *VSPreImage) ValidateSignature(msg []byte, sig *ValueStoreSignature) error

ValidateSignature validates the signature for VSPreImage

type ValueStore

type ValueStore struct {
	VSPreImage *VSPreImage
	TxHash     []byte
	// contains filtered or unexported fields
}

ValueStore stores value in a UTXO

func (*ValueStore) ChainID

func (b *ValueStore) ChainID() (uint32, error)

ChainID returns the ChainID of the object

func (*ValueStore) GenericOwner

func (b *ValueStore) GenericOwner() (*Owner, error)

GenericOwner returns the Owner of the ValueStore

func (*ValueStore) IsDeposit

func (b *ValueStore) IsDeposit() bool

IsDeposit returns true if the object is a deposit

func (*ValueStore) MakeTxIn

func (b *ValueStore) MakeTxIn() (*TXIn, error)

MakeTxIn constructs a TXIn object for the current object

func (*ValueStore) MarshalBinary

func (b *ValueStore) MarshalBinary() ([]byte, error)

MarshalBinary takes the ValueStore object and returns the canonical byte slice

func (*ValueStore) MarshalCapn

func (b *ValueStore) MarshalCapn(seg *capnp.Segment) (mdefs.ValueStore, error)

MarshalCapn marshals the object into its capnproto definition

func (*ValueStore) New

func (b *ValueStore) New(chainID uint32, value *uint256.Uint256, acct []byte, curveSpec constants.CurveSpec, txHash []byte) error

New creates a new ValueStore

func (*ValueStore) NewFromDeposit

func (b *ValueStore) NewFromDeposit(chainID uint32, value *uint256.Uint256, acct []byte, nonce []byte) error

NewFromDeposit creates a new ValueStore from a deposit event

func (*ValueStore) Owner

func (b *ValueStore) Owner() (*ValueStoreOwner, error)

Owner returns the ValueStoreOwner of the ValueStore

func (*ValueStore) PreHash

func (b *ValueStore) PreHash() ([]byte, error)

PreHash calculates the PreHash of the object

func (*ValueStore) SetTXOutIdx

func (b *ValueStore) SetTXOutIdx(idx uint32) error

SetTXOutIdx sets the TXOutIdx of the object

func (*ValueStore) SetTxHash

func (b *ValueStore) SetTxHash(txHash []byte) error

SetTxHash sets the TxHash of the object

func (*ValueStore) Sign

func (b *ValueStore) Sign(txIn *TXIn, s Signer) error

Sign generates the signature for a ValueStore at the time of consumption

func (*ValueStore) TXOutIdx

func (b *ValueStore) TXOutIdx() (uint32, error)

TXOutIdx returns the TXOutIdx of the object

func (*ValueStore) UTXOID

func (b *ValueStore) UTXOID() ([]byte, error)

UTXOID calculates the UTXOID of the object

func (*ValueStore) UnmarshalBinary

func (b *ValueStore) UnmarshalBinary(data []byte) error

UnmarshalBinary takes a byte slice and returns the corresponding ValueStore object

func (*ValueStore) UnmarshalCapn

func (b *ValueStore) UnmarshalCapn(bc mdefs.ValueStore) error

UnmarshalCapn unmarshals the capnproto definition of the object

func (*ValueStore) ValidateSignature

func (b *ValueStore) ValidateSignature(txIn *TXIn) error

ValidateSignature validates the signature of the ValueStore at the time of consumption

func (*ValueStore) Value

func (b *ValueStore) Value() (*uint256.Uint256, error)

Value returns the Value of the object

type ValueStoreOwner

type ValueStoreOwner struct {
	SVA       SVA
	CurveSpec constants.CurveSpec
	Account   []byte
}

ValueStoreOwner contains information related to the owner of the ValueStore

func (*ValueStoreOwner) MarshalBinary

func (vso *ValueStoreOwner) MarshalBinary() ([]byte, error)

MarshalBinary takes the ValueStoreOwner object and returns the canonical byte slice

func (*ValueStoreOwner) New

func (vso *ValueStoreOwner) New(acct []byte, curveSpec constants.CurveSpec)

New makes a new ValueStoreOwner

func (*ValueStoreOwner) NewFromOwner

func (vso *ValueStoreOwner) NewFromOwner(o *Owner) error

NewFromOwner takes an Owner object and creates the corresponding ValueStoreOwner

func (*ValueStoreOwner) Sign

func (vso *ValueStoreOwner) Sign(msg []byte, s Signer) (*ValueStoreSignature, error)

Sign signs message msg with signer s

func (*ValueStoreOwner) UnmarshalBinary

func (vso *ValueStoreOwner) UnmarshalBinary(o []byte) error

UnmarshalBinary takes a byte slice and returns the corresponding ValueStoreOwner object

func (*ValueStoreOwner) Validate

func (vso *ValueStoreOwner) Validate() error

Validate validates the ValueStoreOwner object

func (*ValueStoreOwner) ValidateSignature

func (vso *ValueStoreOwner) ValidateSignature(msg []byte, sig *ValueStoreSignature) error

ValidateSignature validates ValueStoreSignature sig for message msg

type ValueStoreSignature

type ValueStoreSignature struct {
	SVA       SVA
	CurveSpec constants.CurveSpec
	Signature []byte
}

ValueStoreSignature is a struct which the necessary information for signing a ValueStore

func (*ValueStoreSignature) MarshalBinary

func (vss *ValueStoreSignature) MarshalBinary() ([]byte, error)

MarshalBinary takes the ValueStoreSignature object and returns the canonical byte slice

func (*ValueStoreSignature) UnmarshalBinary

func (vss *ValueStoreSignature) UnmarshalBinary(signature []byte) error

UnmarshalBinary takes a byte slice and returns the corresponding ValueStoreSignature object

func (*ValueStoreSignature) Validate

func (vss *ValueStoreSignature) Validate() error

Validate validates the ValueStoreSignature object

type Vin

type Vin []*TXIn

Vin is a vector of TxIn objects

func (Vin) IsDeposit

func (vin Vin) IsDeposit() []bool

IsDeposit returns a list of bools specifying if each TXTn in Vin is a deposit

func (Vin) PreHash

func (vin Vin) PreHash() ([][]byte, error)

PreHash returns the list of PreHashs from each TXIn in Vin

func (Vin) UTXOID

func (vin Vin) UTXOID() ([][]byte, error)

UTXOID returns the list of UTXOIDs from each TXIn in Vin

type Vout

type Vout []*TXOut

Vout is a vector of TXOut objects

func (Vout) MakeTxIn

func (vout Vout) MakeTxIn() (Vin, error)

MakeTxIn converts Vout to Vin

func (Vout) PreHash

func (vout Vout) PreHash() ([][]byte, error)

PreHash returns the list of PreHashs from each TXOut in Vout

func (Vout) RemainingValue

func (vout Vout) RemainingValue(currentHeight uint32) (*uint256.Uint256, error)

RemainingValue sums the total value of the UTXOs with discount

func (Vout) SetTxOutIdx

func (vout Vout) SetTxOutIdx() error

SetTxOutIdx sets the TxOutIdx of each utxo

func (Vout) UTXOID

func (vout Vout) UTXOID() ([][]byte, error)

UTXOID returns the list of UTXOIDs from each TXOut in Vout

func (Vout) ValidatePreSignature

func (vout Vout) ValidatePreSignature() error

ValidatePreSignature validates the PreSignature from each TXOut in Vout

func (Vout) ValidateSignature

func (vout Vout) ValidateSignature(currentHeight uint32, txIn []*TXIn) error

ValidateSignature validates the Signature from each TXOut in Vout

func (Vout) ValidateTxOutIdx

func (vout Vout) ValidateTxOutIdx() error

ValidateTxOutIdx validates the TxOutIdx of each utxo

func (Vout) Value

func (vout Vout) Value() (*uint256.Uint256, error)

Value sums the total value of the UTXOs without any discount

Jump to

Keyboard shortcuts

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