tx_ver1

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

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

Go to latest
Published: Aug 29, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCustomTokenPrivacyReceiverArrayV2

func CreateCustomTokenPrivacyReceiverArrayV2(dataReceiver interface{}) ([]*privacy.PaymentInfo, int64, error)

CreateCustomTokenReceiverArray - parse data frm rpc request to create a list vout for preparing to create a custom token tx data interface is a map[paymentt-address]{transferring-amount}

Types

type Tx

type Tx struct {
	tx_generic.TxBase
}

func (Tx) CheckCMExistence

func (tx Tx) CheckCMExistence(cm []byte, stateDB *statedb.StateDB, shardID byte, tokenID *common.Hash) (bool, error)

CheckCMExistence returns true if cm exists in cm list

func (*Tx) CheckData

func (tx *Tx) CheckData(
	db *statedb.StateDB,
) error

func (*Tx) GetReceiverData

func (tx *Tx) GetReceiverData() ([]privacy.Coin, error)

func (Tx) GetTxActualSize

func (tx Tx) GetTxActualSize() uint64

func (Tx) GetTxBurnData

func (tx Tx) GetTxBurnData() (bool, privacy.Coin, *common.Hash, error)

func (Tx) GetTxFullBurnData

func (tx Tx) GetTxFullBurnData() (bool, privacy.Coin, privacy.Coin, *common.Hash, error)

func (Tx) GetTxMintData

func (tx Tx) GetTxMintData() (bool, privacy.Coin, *common.Hash, error)

func (*Tx) Init

func (tx *Tx) Init(paramsInterface interface{}) error

func (*Tx) InitForASM

func (tx *Tx) InitForASM(params *TxPrivacyInitParamsForASM) error

TODO PRIVACY, WILL DO THIS LATER BECAUSE IT IS ASM

func (*Tx) InitTxSalary

func (tx *Tx) InitTxSalary(salary uint64, receiverAddr *privacy.PaymentAddress, privKey *privacy.PrivateKey, stateDB *statedb.StateDB, metaData metadata.Metadata,
) error

func (*Tx) LoadData

func (tx *Tx) LoadData(
	db *statedb.StateDB,
) error

func (*Tx) Sign

func (tx *Tx) Sign(sigPrivakey []byte) error

func (Tx) ValidateSanityData

func (tx Tx) ValidateSanityData(chainRetriever metadata.ChainRetriever, shardViewRetriever metadata.ShardViewRetriever, beaconViewRetriever metadata.BeaconViewRetriever, beaconHeight uint64) (bool, error)

func (*Tx) ValidateSanityDataByItSelf

func (tx *Tx) ValidateSanityDataByItSelf() (bool, error)

func (*Tx) ValidateSanityDataWithBlockchain

func (tx *Tx) ValidateSanityDataWithBlockchain(
	chainRetriever metadata.ChainRetriever,
	shardViewRetriever metadata.ShardViewRetriever,
	beaconViewRetriever metadata.BeaconViewRetriever,
	beaconHeight uint64,
) (
	bool,
	error,
)

func (Tx) ValidateTransaction

func (tx Tx) ValidateTransaction(boolParams map[string]bool, transactionStateDB *statedb.StateDB, bridgeStateDB *statedb.StateDB, shardID byte, tokenID *common.Hash) (bool, []privacy.Proof, error)

func (Tx) ValidateTxByItself

func (tx Tx) ValidateTxByItself(boolParams map[string]bool, transactionStateDB *statedb.StateDB, bridgeStateDB *statedb.StateDB, chainRetriever metadata.ChainRetriever, shardID byte, shardViewRetriever metadata.ShardViewRetriever, beaconViewRetriever metadata.BeaconViewRetriever) (bool, error)

func (*Tx) ValidateTxCorrectness

func (tx *Tx) ValidateTxCorrectness(
	transactionStateDB *statedb.StateDB,
) (
	bool,
	error,
)

func (Tx) ValidateTxSalary

func (tx Tx) ValidateTxSalary(
	db *statedb.StateDB,
) (bool, error)

ValidateTxSalary checks the following conditions for salary transactions (s, rs):

  • the signature is valid
  • the number of output coins is 1
  • all fields of the output coins are valid
  • the snd has not existed
  • the commitment has been calculated correctly

func (*Tx) ValidateTxWithBlockChain

func (tx *Tx) ValidateTxWithBlockChain(chainRetriever metadata.ChainRetriever, shardViewRetriever metadata.ShardViewRetriever, beaconViewRetriever metadata.BeaconViewRetriever, shardID byte, stateDB *statedb.StateDB) error

func (*Tx) Verify

func (tx *Tx) Verify(boolParams map[string]bool, transactionStateDB *statedb.StateDB, bridgeStateDB *statedb.StateDB, shardID byte, tokenID *common.Hash) (bool, error)

func (Tx) VerifyMinerCreatedTxBeforeGettingInBlock

func (tx Tx) VerifyMinerCreatedTxBeforeGettingInBlock(mintdata *metadata.MintData,
	shardID byte, bcr metadata.ChainRetriever,
	accumulatedValues *metadata.AccumulatedValues,
	retriever metadata.ShardViewRetriever,
	viewRetriever metadata.BeaconViewRetriever) (bool, error)

func (*Tx) VerifySigTx

func (tx *Tx) VerifySigTx() (bool, error)

VerifySigTx - verify signature on tx

type TxPrivacyInitParamsForASM

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

func NewTxPrivacyInitParamsForASM

func NewTxPrivacyInitParamsForASM(
	senderSK *privacy.PrivateKey,
	paymentInfo []*privacy.PaymentInfo,
	inputCoins []privacy.PlainCoin,
	fee uint64,
	hasPrivacy bool,
	tokenID *common.Hash,
	metaData metadata.Metadata,
	info []byte,
	commitmentIndices []uint64,
	commitmentBytes [][]byte,
	myCommitmentIndices []uint64,
	sndOutputs []*privacy.Scalar) *TxPrivacyInitParamsForASM

func (*TxPrivacyInitParamsForASM) SetMetaData

func (param *TxPrivacyInitParamsForASM) SetMetaData(meta metadata.Metadata)

type TxPrivacyTokenInitParamsForASM

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

func NewTxPrivacyTokenInitParamsForASM

func NewTxPrivacyTokenInitParamsForASM(
	senderKey *privacy.PrivateKey,
	paymentInfo []*privacy.PaymentInfo,
	inputCoin []privacy.PlainCoin,
	feeNativeCoin uint64,
	tokenParams *tx_generic.TokenParam,
	metaData metadata.Metadata,
	hasPrivacyCoin bool,
	hasPrivacyToken bool,
	shardID byte,
	info []byte,
	commitmentIndicesForNativeToken []uint64,
	commitmentBytesForNativeToken [][]byte,
	myCommitmentIndicesForNativeToken []uint64,
	sndOutputsForNativeToken []*privacy.Scalar,

	commitmentIndicesForPToken []uint64,
	commitmentBytesForPToken [][]byte,
	myCommitmentIndicesForPToken []uint64,
	sndOutputsForPToken []*privacy.Scalar) *TxPrivacyTokenInitParamsForASM

func (*TxPrivacyTokenInitParamsForASM) SetMetaData

func (param *TxPrivacyTokenInitParamsForASM) SetMetaData(meta metadata.Metadata)

type TxToken

type TxToken struct {
	tx_generic.TxTokenBase
}

func (*TxToken) CheckData

func (tx *TxToken) CheckData(
	db *statedb.StateDB,
) error

func (TxToken) GetTxActualSize

func (tx TxToken) GetTxActualSize() uint64

func (*TxToken) Init

func (tx *TxToken) Init(paramsInterface interface{}) error

func (*TxToken) InitForASM

func (tx *TxToken) InitForASM(params *TxPrivacyTokenInitParamsForASM, serverTime int64) error

TODO Privacy, WILL DO THIS LATER BECAUSE IT IS ASM Init - build normal tx component and privacy custom token data

func (TxToken) ListOTAHashH

func (tx TxToken) ListOTAHashH() []common.Hash

func (*TxToken) LoadData

func (tx *TxToken) LoadData(
	db *statedb.StateDB,
) error

func (*TxToken) UnmarshalJSON

func (tx *TxToken) UnmarshalJSON(data []byte) error

func (TxToken) ValidateSanityData

func (tx TxToken) ValidateSanityData(chainRetriever metadata.ChainRetriever, shardViewRetriever metadata.ShardViewRetriever, beaconViewRetriever metadata.BeaconViewRetriever, beaconHeight uint64) (bool, error)

func (*TxToken) ValidateSanityDataByItSelf

func (tx *TxToken) ValidateSanityDataByItSelf() (bool, error)

func (*TxToken) ValidateSanityDataWithBlockchain

func (tx *TxToken) ValidateSanityDataWithBlockchain(
	chainRetriever metadata.ChainRetriever,
	shardViewRetriever metadata.ShardViewRetriever,
	beaconViewRetriever metadata.BeaconViewRetriever,
	beaconHeight uint64,
) (
	bool,
	error,
)

func (TxToken) ValidateTransaction

func (tx TxToken) ValidateTransaction(boolParams map[string]bool, transactionStateDB *statedb.StateDB, bridgeStateDB *statedb.StateDB, shardID byte, tokenID *common.Hash) (bool, []privacy.Proof, error)

func (TxToken) ValidateTxByItself

func (tx TxToken) ValidateTxByItself(boolParams map[string]bool, transactionStateDB *statedb.StateDB, bridgeStateDB *statedb.StateDB, chainRetriever metadata.ChainRetriever, shardID byte, shardViewRetriever metadata.ShardViewRetriever, beaconViewRetriever metadata.BeaconViewRetriever) (bool, error)

func (*TxToken) ValidateTxCorrectness

func (tx *TxToken) ValidateTxCorrectness(
	transactionStateDB *statedb.StateDB,
) (
	bool,
	error,
)

Jump to

Keyboard shortcuts

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