tx

package
v0.0.0-...-bc7c564 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2020 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRipemd16Hash

func GetRipemd16Hash(tx CommonOperation) []byte

func GetTxId

func GetTxId(tx CommonOperation) []byte

func GetTxIdString

func GetTxIdString(tx CommonOperation) string

func Sign

func Sign(tx CommonOperation, private *crypto.Key) (txID string, raw []byte, err error)

func TxFromMetadata

func TxFromMetadata(metadataSerialized []byte) (*TxMetadata, CommonOperation, error)

func Validate

func Validate(tx CommonOperation, getAccount func(number uint32) *accounter.Account) (context interface{}, err error)

func ValidateSignature

func ValidateSignature(tx CommonOperation) error

Types

type ChangeKey

type ChangeKey struct {
	Source       uint32
	OperationId  uint32
	Fee          uint64
	Payload      []byte
	PublicKey    crypto.Public
	NewPublickey []byte
	Signature    crypto.SignatureSerialized
}

func (*ChangeKey) Apply

func (this *ChangeKey) Apply(index uint32, context interface{}, accounter *accounter.Accounter) ([]uint32, error)

func (*ChangeKey) GetAccount

func (this *ChangeKey) GetAccount() uint32

func (*ChangeKey) GetAmount

func (this *ChangeKey) GetAmount() uint64

func (*ChangeKey) GetDestAccount

func (this *ChangeKey) GetDestAccount() uint32

func (*ChangeKey) GetFee

func (this *ChangeKey) GetFee() uint64

func (*ChangeKey) GetPayload

func (this *ChangeKey) GetPayload() []byte

func (*ChangeKey) GetType

func (this *ChangeKey) GetType() txType

func (*ChangeKey) SerializeWithoutPrefix

func (this *ChangeKey) SerializeWithoutPrefix(w io.Writer) error

type CommonOperation

type CommonOperation interface {
	GetAmount() uint64
	GetAccount() uint32
	GetDestAccount() uint32
	GetFee() uint64
	GetPayload() []byte
	GetType() txType

	Apply(index uint32, context interface{}, accounter *accounter.Accounter) ([]uint32, error)

	SerializeWithoutPrefix(w io.Writer) error
	// contains filtered or unexported methods
}

type OperationsNetwork

type OperationsNetwork struct {
	Operations []CommonOperation
}

func (*OperationsNetwork) Deserialize

func (this *OperationsNetwork) Deserialize(r io.Reader) error

func (*OperationsNetwork) Serialize

func (this *OperationsNetwork) Serialize(w io.Writer) error

type Transfer

type Transfer struct {
	Source      uint32
	OperationId uint32
	Destination uint32
	Amount      uint64
	Fee         uint64
	Payload     []byte
	PublicKey   crypto.Public
	Signature   crypto.SignatureSerialized
}

func (*Transfer) Apply

func (this *Transfer) Apply(index uint32, context interface{}, accounter *accounter.Accounter) ([]uint32, error)

func (*Transfer) GetAccount

func (this *Transfer) GetAccount() uint32

func (*Transfer) GetAmount

func (this *Transfer) GetAmount() uint64

func (*Transfer) GetDestAccount

func (this *Transfer) GetDestAccount() uint32

func (*Transfer) GetFee

func (this *Transfer) GetFee() uint64

func (*Transfer) GetPayload

func (this *Transfer) GetPayload() []byte

func (*Transfer) GetType

func (this *Transfer) GetType() txType

func (*Transfer) SerializeWithoutPrefix

func (this *Transfer) SerializeWithoutPrefix(w io.Writer) error

type TxMetadata

type TxMetadata struct {
	BlockIndex uint32
	Index      uint32
	Time       uint32
	Type       uint8
	TxRaw      []byte
}

func GetMetadata

func GetMetadata(tx CommonOperation, txIndexInsideBlock uint32, blockIndex uint32, time uint32) TxMetadata

type TxSerialized

type TxSerialized struct {
	CommonOperation
}

func ToTxSerialized

func ToTxSerialized(txes []CommonOperation) []TxSerialized

func (*TxSerialized) Deserialize

func (this *TxSerialized) Deserialize(r io.Reader) error

func (*TxSerialized) Serialize

func (this *TxSerialized) Serialize(w io.Writer) error

Jump to

Keyboard shortcuts

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