transactions

package
v0.0.0-...-7bd4979 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2019 License: MIT Imports: 15 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcAllowedDecimals

func CalcAllowedDecimals(value uint64) (uint64, error)

func GetAddressAmount

func GetAddressAmount(qAddress string, amount uint64) *generated.AddressAmount

Types

type CoinBase

type CoinBase struct {
	Transaction
}

func CreateCoinBase

func CreateCoinBase(minerAddress []byte, blockNumber uint64, amount uint64) *CoinBase

func (*CoinBase) AddrTo

func (tx *CoinBase) AddrTo() []byte

func (*CoinBase) Amount

func (tx *CoinBase) Amount() uint64

func (*CoinBase) ApplyStateChanges

func (tx *CoinBase) ApplyStateChanges(addressesState map[string]*addressstate.AddressState)

func (*CoinBase) GetHashableBytes

func (tx *CoinBase) GetHashableBytes() []byte

func (*CoinBase) RevertStateChanges

func (tx *CoinBase) RevertStateChanges(addressesState map[string]*addressstate.AddressState)

func (*CoinBase) SetAffectedAddress

func (tx *CoinBase) SetAffectedAddress(addressesState map[string]*addressstate.AddressState)

func (*CoinBase) UpdateMiningAddress

func (tx *CoinBase) UpdateMiningAddress(miningAddress []byte)

func (*CoinBase) Validate

func (tx *CoinBase) Validate(verifySignature bool) bool

func (*CoinBase) ValidateExtendedCoinbase

func (tx *CoinBase) ValidateExtendedCoinbase(blockNumber uint64) bool

type JSONTransferTransactionRequest

type JSONTransferTransactionRequest struct {
	MasterAddress   string `json:"masterAddress"`
	Fee             string `json:"fee"`
	PublicKey       string `json:"publicKey"`
	Signature       string `json:"signature"`
	Nonce           string `json:"nonce"`
	TransactionHash string `json:"transactionHash"`
	TransactionType string `json:"transactionType"`

	AddressesTo []string `json:"addressesTo"`
	Amounts     []string `json:"amounts"`
}

func (*JSONTransferTransactionRequest) ToPlainTransferTransaction

func (j *JSONTransferTransactionRequest) ToPlainTransferTransaction() (*PlainTransferTransaction, error)

type MessageTransaction

type MessageTransaction struct {
	Transaction
}

func CreateMessageTransaction

func CreateMessageTransaction(message []byte, fee uint64, xmssPK []byte, masterAddr []byte) *MessageTransaction

func (*MessageTransaction) ApplyStateChanges

func (tx *MessageTransaction) ApplyStateChanges(addressesState map[string]*addressstate.AddressState)

func (*MessageTransaction) GetHashableBytes

func (tx *MessageTransaction) GetHashableBytes() []byte

func (*MessageTransaction) MessageHash

func (tx *MessageTransaction) MessageHash() []byte

func (*MessageTransaction) RevertStateChanges

func (tx *MessageTransaction) RevertStateChanges(addressesState map[string]*addressstate.AddressState)

func (*MessageTransaction) SetAffectedAddress

func (tx *MessageTransaction) SetAffectedAddress(addressesState map[string]*addressstate.AddressState)

func (*MessageTransaction) Validate

func (tx *MessageTransaction) Validate(verifySignature bool) bool

func (*MessageTransaction) ValidateExtended

func (tx *MessageTransaction) ValidateExtended(addrFromState *addressstate.AddressState, addrFromPKState *addressstate.AddressState) bool

type PlainCoinBaseTransaction

type PlainCoinBaseTransaction struct {
	Fee             uint64 `json:"fee"`
	PublicKey       string `json:"publicKey"`
	Signature       string `json:"signature"`
	Nonce           uint64 `json:"nonce"`
	TransactionHash string `json:"transactionHash"`
	TransactionType string `json:"transactionType"`

	AddressTo string `json:"addressTo"`
	Amount    uint64 `json:"amount"`
}

func (*PlainCoinBaseTransaction) TransactionFromPBData

func (t *PlainCoinBaseTransaction) TransactionFromPBData(tx *generated.Transaction)

type PlainMessageTransaction

type PlainMessageTransaction struct {
	MasterAddress   string `json:"masterAddress"`
	Fee             uint64 `json:"fee"`
	PublicKey       string `json:"publicKey"`
	Signature       string `json:"signature"`
	Nonce           uint64 `json:"nonce"`
	TransactionHash string `json:"transactionHash"`
	TransactionType string `json:"transactionType"`

	MessageHash string `json:"messageHash"`
}

func (*PlainMessageTransaction) TransactionFromPBData

func (t *PlainMessageTransaction) TransactionFromPBData(tx *generated.Transaction)

type PlainSlaveTransaction

type PlainSlaveTransaction struct {
	MasterAddress   string `json:"masterAddress"`
	Fee             uint64 `json:"fee"`
	PublicKey       string `json:"publicKey"`
	Signature       string `json:"signature"`
	Nonce           uint64 `json:"nonce"`
	TransactionHash string `json:"transactionHash"`
	TransactionType string `json:"transactionType"`

	SlavePKs    []string `json:"slavePublicKeys"`
	AccessTypes []uint32 `json:"accessTypes"`
}

func (*PlainSlaveTransaction) TransactionFromPBData

func (t *PlainSlaveTransaction) TransactionFromPBData(tx *generated.Transaction)

type PlainTokenTransaction

type PlainTokenTransaction struct {
	MasterAddress   string `json:"masterAddress"`
	Fee             uint64 `json:"fee"`
	PublicKey       string `json:"publicKey"`
	Signature       string `json:"signature"`
	Nonce           uint64 `json:"nonce"`
	TransactionHash string `json:"transactionHash"`
	TransactionType string `json:"transactionType"`

	Symbol      string   `json:"symbol"`
	Name        string   `json:"name"`
	Owner       string   `json:"owner"`
	Decimals    uint64   `json:"decimals"`
	AddressesTo []string `json:"addressesTo"`
	Amounts     []uint64 `json:"amounts"`
}

func (*PlainTokenTransaction) TransactionFromPBData

func (t *PlainTokenTransaction) TransactionFromPBData(tx *generated.Transaction)

type PlainTransactionInterface

type PlainTransactionInterface interface {
	TransactionFromPBData(tx *generated.Transaction)
}

func ProtoToPlainTransaction

func ProtoToPlainTransaction(protoTX *generated.Transaction) PlainTransactionInterface

type PlainTransferTokenTransaction

type PlainTransferTokenTransaction struct {
	MasterAddress   string `json:"masterAddress"`
	Fee             uint64 `json:"fee"`
	PublicKey       string `json:"publicKey"`
	Signature       string `json:"signature"`
	Nonce           uint64 `json:"nonce"`
	TransactionHash string `json:"transactionHash"`
	TransactionType string `json:"transactionType"`

	TokenTxnHash string   `json:"tokenTxnHash"`
	AddressesTo  []string `json:"addressesTo"`
	Amounts      []uint64 `json:"amounts"`
}

func (*PlainTransferTokenTransaction) TransactionFromPBData

func (t *PlainTransferTokenTransaction) TransactionFromPBData(tx *generated.Transaction)

type PlainTransferTransaction

type PlainTransferTransaction struct {
	MasterAddress   string `json:"masterAddress"`
	Fee             uint64 `json:"fee"`
	PublicKey       string `json:"publicKey"`
	Signature       string `json:"signature"`
	Nonce           uint64 `json:"nonce"`
	TransactionHash string `json:"transactionHash"`
	TransactionType string `json:"transactionType"`

	AddressesTo []string `json:"addressesTo"`
	Amounts     []uint64 `json:"amounts"`
}

func (*PlainTransferTransaction) ToTransferTransactionObject

func (t *PlainTransferTransaction) ToTransferTransactionObject() (*TransferTransaction, error)

func (*PlainTransferTransaction) TransactionFromPBData

func (t *PlainTransferTransaction) TransactionFromPBData(tx *generated.Transaction)

type SlaveTransaction

type SlaveTransaction struct {
	Transaction
}

func CreateSlaveTransaction

func CreateSlaveTransaction(slavePKs [][]byte, accessTypes []uint32, fee uint64, xmssPK []byte, masterAddr []byte) *SlaveTransaction

func (*SlaveTransaction) AccessTypes

func (tx *SlaveTransaction) AccessTypes() []uint32

func (*SlaveTransaction) ApplyStateChanges

func (tx *SlaveTransaction) ApplyStateChanges(addressesState map[string]*addressstate.AddressState)

func (*SlaveTransaction) GetHashableBytes

func (tx *SlaveTransaction) GetHashableBytes() []byte

func (*SlaveTransaction) RevertStateChanges

func (tx *SlaveTransaction) RevertStateChanges(addressesState map[string]*addressstate.AddressState)

func (*SlaveTransaction) SetAffectedAddress

func (tx *SlaveTransaction) SetAffectedAddress(addressesState map[string]*addressstate.AddressState)

func (*SlaveTransaction) SlavePKs

func (tx *SlaveTransaction) SlavePKs() [][]byte

func (*SlaveTransaction) Validate

func (tx *SlaveTransaction) Validate(verifySignature bool) bool

func (*SlaveTransaction) ValidateExtended

func (tx *SlaveTransaction) ValidateExtended(addrFromState *addressstate.AddressState, addrFromPkState *addressstate.AddressState) bool

type TokenTransaction

type TokenTransaction struct {
	Transaction
}

func CreateTokenTransaction

func CreateTokenTransaction(
	symbol []byte,
	name []byte,
	owner []byte,
	decimals uint64,
	initialBalances []*generated.AddressAmount,
	fee uint64,
	xmssPK []byte,
	masterAddr []byte) *TokenTransaction

func (*TokenTransaction) ApplyStateChanges

func (tx *TokenTransaction) ApplyStateChanges(addressesState map[string]*addressstate.AddressState)

func (*TokenTransaction) Decimals

func (tx *TokenTransaction) Decimals() uint64

func (*TokenTransaction) GetHashableBytes

func (tx *TokenTransaction) GetHashableBytes() []byte

func (*TokenTransaction) InitialBalances

func (tx *TokenTransaction) InitialBalances() []*generated.AddressAmount

func (*TokenTransaction) Name

func (tx *TokenTransaction) Name() []byte

func (*TokenTransaction) Owner

func (tx *TokenTransaction) Owner() []byte

func (*TokenTransaction) RevertStateChanges

func (tx *TokenTransaction) RevertStateChanges(addressesState map[string]*addressstate.AddressState)

func (*TokenTransaction) SetAffectedAddress

func (tx *TokenTransaction) SetAffectedAddress(addressesState map[string]*addressstate.AddressState)

func (*TokenTransaction) Symbol

func (tx *TokenTransaction) Symbol() []byte

func (*TokenTransaction) Validate

func (tx *TokenTransaction) Validate(verifySignature bool) bool

func (*TokenTransaction) ValidateExtended

func (tx *TokenTransaction) ValidateExtended(addrFromState *addressstate.AddressState, addrFromPKState *addressstate.AddressState) bool

type Transaction

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

func (*Transaction) AddrFrom

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

func (*Transaction) AddrFromPK

func (tx *Transaction) AddrFromPK() string

func (*Transaction) ApplyStateChanges

func (tx *Transaction) ApplyStateChanges(addressesState map[string]*addressstate.AddressState)

func (*Transaction) Fee

func (tx *Transaction) Fee() uint64

func (*Transaction) FromJSON

func (tx *Transaction) FromJSON(jsonData string) *Transaction

func (*Transaction) FromPBdata

func (tx *Transaction) FromPBdata(pbdata generated.Transaction)

func (*Transaction) GenerateTxHash

func (tx *Transaction) GenerateTxHash(hashableBytes []byte) []byte

func (*Transaction) GetHashableBytes

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

func (*Transaction) GetOtsFromSignature

func (tx *Transaction) GetOtsFromSignature(signature []byte) uint64

func (*Transaction) GetSlave

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

func (*Transaction) JSON

func (tx *Transaction) JSON() (string, error)

func (*Transaction) MasterAddr

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

func (*Transaction) Nonce

func (tx *Transaction) Nonce() uint64

func (*Transaction) OtsKey

func (tx *Transaction) OtsKey() uint64

func (*Transaction) PBData

func (tx *Transaction) PBData() *generated.Transaction

func (*Transaction) PK

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

func (*Transaction) RevertStateChanges

func (tx *Transaction) RevertStateChanges(addressesState map[string]*addressstate.AddressState)

func (*Transaction) SetAffectedAddress

func (tx *Transaction) SetAffectedAddress(addressesState map[string]*addressstate.AddressState)

func (*Transaction) SetNonce

func (tx *Transaction) SetNonce(n uint64)

func (*Transaction) SetPBData

func (tx *Transaction) SetPBData(pbData *generated.Transaction)

func (*Transaction) Sign

func (tx *Transaction) Sign(xmss *crypto.XMSS, message goqrllib.UcharVector)

func (*Transaction) Signature

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

func (*Transaction) Size

func (tx *Transaction) Size() int

func (*Transaction) Txhash

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

func (*Transaction) Type

func (tx *Transaction) Type()

func (*Transaction) UpdateTxhash

func (tx *Transaction) UpdateTxhash(hashableBytes []byte)

func (*Transaction) Validate

func (tx *Transaction) Validate(verifySignature bool) bool

func (*Transaction) ValidateExtended

func (tx *Transaction) ValidateExtended(addrFromState *addressstate.AddressState, addrFromPkState *addressstate.AddressState) bool

func (*Transaction) ValidateExtendedCoinbase

func (tx *Transaction) ValidateExtendedCoinbase(blockNumber uint64) bool

func (*Transaction) ValidateSlave

func (tx *Transaction) ValidateSlave(addrFromState *addressstate.AddressState, addrFromPKState *addressstate.AddressState) bool

type TransactionInterface

type TransactionInterface interface {
	Size() int

	PBData() *generated.Transaction

	SetPBData(*generated.Transaction)

	Type()

	Fee() uint64

	Nonce() uint64

	MasterAddr() []byte

	AddrFrom() []byte

	AddrFromPK() string

	OtsKey() uint64

	GetOtsFromSignature(signature []byte) uint64

	PK() []byte

	Signature() []byte

	FromPBdata(pbdata generated.Transaction) //Set return type

	GetSlave() []byte

	Txhash() []byte

	UpdateTxhash(hashableBytes []byte)

	GetHashableBytes() []byte

	Sign(xmss *crypto.XMSS, message goqrllib.UcharVector)

	ApplyStateChanges(addressesState map[string]*addressstate.AddressState)

	RevertStateChanges(addressesState map[string]*addressstate.AddressState)

	SetAffectedAddress(addressesState map[string]*addressstate.AddressState)

	Validate(verifySignature bool) bool

	ValidateSlave(addrFromState *addressstate.AddressState, addrFromPKState *addressstate.AddressState) bool

	ValidateExtended(addrFromState *addressstate.AddressState, addrFromPkState *addressstate.AddressState) bool

	ValidateExtendedCoinbase(blockNumber uint64) bool

	FromJSON(jsonData string) *Transaction

	JSON() (string, error)
	// contains filtered or unexported methods
}

func ProtoToTransaction

func ProtoToTransaction(protoTX *generated.Transaction) TransactionInterface

type TransferTokenTransaction

type TransferTokenTransaction struct {
	Transaction
}

func CreateTransferTokenTransaction

func CreateTransferTokenTransaction(tokenTxhash []byte, addrsTo [][]byte, amounts []uint64, fee uint64, xmssPK []byte, masterAddr []byte) *TransferTokenTransaction

func (*TransferTokenTransaction) AddrsTo

func (tx *TransferTokenTransaction) AddrsTo() [][]byte

func (*TransferTokenTransaction) Amounts

func (tx *TransferTokenTransaction) Amounts() []uint64

func (*TransferTokenTransaction) ApplyStateChanges

func (tx *TransferTokenTransaction) ApplyStateChanges(addressesState map[string]*addressstate.AddressState)

func (*TransferTokenTransaction) GetHashableBytes

func (tx *TransferTokenTransaction) GetHashableBytes() []byte

func (*TransferTokenTransaction) RevertStateChanges

func (tx *TransferTokenTransaction) RevertStateChanges(addressesState map[string]*addressstate.AddressState)

func (*TransferTokenTransaction) SetAffectedAddress

func (tx *TransferTokenTransaction) SetAffectedAddress(addressesState map[string]*addressstate.AddressState)

func (*TransferTokenTransaction) TokenTxhash

func (tx *TransferTokenTransaction) TokenTxhash() []byte

func (*TransferTokenTransaction) TotalAmount

func (tx *TransferTokenTransaction) TotalAmount() uint64

func (*TransferTokenTransaction) Validate

func (tx *TransferTokenTransaction) Validate(verifySignature bool) bool

func (*TransferTokenTransaction) ValidateExtended

func (tx *TransferTokenTransaction) ValidateExtended(addrFromState *addressstate.AddressState, addrFromPkState *addressstate.AddressState) bool

type TransferTransaction

type TransferTransaction struct {
	Transaction
}

func CreateTransferTransaction

func CreateTransferTransaction(addrsTo [][]byte, amounts []uint64, fee uint64, xmssPK []byte, masterAddr []byte) *TransferTransaction

func (*TransferTransaction) AddrsTo

func (tx *TransferTransaction) AddrsTo() [][]byte

func (*TransferTransaction) Amounts

func (tx *TransferTransaction) Amounts() []uint64

func (*TransferTransaction) ApplyStateChanges

func (tx *TransferTransaction) ApplyStateChanges(addressesState map[string]*addressstate.AddressState)

func (*TransferTransaction) GetHashableBytes

func (tx *TransferTransaction) GetHashableBytes() []byte

func (*TransferTransaction) RevertStateChanges

func (tx *TransferTransaction) RevertStateChanges(addressesState map[string]*addressstate.AddressState)

func (*TransferTransaction) SetAffectedAddress

func (tx *TransferTransaction) SetAffectedAddress(addressesState map[string]*addressstate.AddressState)

func (*TransferTransaction) TotalAmounts

func (tx *TransferTransaction) TotalAmounts() uint64

func (*TransferTransaction) Validate

func (tx *TransferTransaction) Validate(verifySignature bool) bool

func (*TransferTransaction) ValidateExtended

func (tx *TransferTransaction) ValidateExtended(
	addrFromState *addressstate.AddressState,
	addrFromPkState *addressstate.AddressState) bool

Jump to

Keyboard shortcuts

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