Documentation
¶
Index ¶
- func InitConversion(tx *Tx, params *TxConvertVer1ToVer2InitParams) error
- func InitTokenConversion(txToken *TxToken, params *TxTokenConvertVer1ToVer2InitParams) error
- type CustomTokenConversionParams
- type SigPubKey
- type Tx
- func (tx *Tx) GetReceiverData() ([]coin.Coin, error)
- func (tx Tx) GetTxActualSize() uint64
- func (tx Tx) GetTxBurnData() (bool, coin.Coin, *common.Hash, error)
- func (tx Tx) GetTxFullBurnData() (bool, coin.Coin, coin.Coin, *common.Hash, error)
- func (tx Tx) GetTxMintData() (bool, coin.Coin, *common.Hash, error)
- func (tx Tx) Hash() *common.Hash
- func (tx Tx) HashWithoutMetadataSig() *common.Hash
- func (tx *Tx) Init(txParams interface{}) error
- func (tx *Tx) InitTxSalary(otaCoin *coin.CoinV2, privateKey *key.PrivateKey, metaData metadata.Metadata) error
- func (tx Tx) ListOTAHashH() []common.Hash
- type TxConvertVer1ToVer2InitParams
- type TxToken
- func (txToken *TxToken) CalculateTxValue() uint64
- func (txToken TxToken) CheckTxVersion(maxTxVersion int8) bool
- func (txToken TxToken) GetInfo() []byte
- func (txToken TxToken) GetLockTime() int64
- func (txToken TxToken) GetMetadata() metadata.Metadata
- func (txToken TxToken) GetMetadataType() int
- func (txToken TxToken) GetPrivateKey() []byte
- func (txToken TxToken) GetProof() privacy.Proof
- func (txToken *TxToken) GetReceiverData() ([]coin.Coin, error)
- func (txToken TxToken) GetReceivers() ([][]byte, []uint64)
- func (txToken TxToken) GetSenderAddrLastByte() byte
- func (txToken TxToken) GetSig() []byte
- func (txToken TxToken) GetSigPubKey() []byte
- func (txToken TxToken) GetTokenID() *common.Hash
- func (txToken *TxToken) GetTransferData() (bool, []byte, uint64, *common.Hash)
- func (txToken TxToken) GetTxActualSize() uint64
- func (txToken *TxToken) GetTxBase() metadata.Transaction
- func (txToken *TxToken) GetTxBurnData() (bool, coin.Coin, *common.Hash, error)
- func (txToken TxToken) GetTxFee() uint64
- func (txToken TxToken) GetTxFeeToken() uint64
- func (txToken *TxToken) GetTxFullBurnData() (bool, coin.Coin, coin.Coin, *common.Hash, error)
- func (txToken *TxToken) GetTxMintData() (bool, coin.Coin, *common.Hash, error)
- func (txToken *TxToken) GetTxNormal() metadata.Transaction
- func (txToken *TxToken) GetTxTokenData() tx_generic.TxTokenData
- func (txToken TxToken) GetType() string
- func (txToken TxToken) GetVersion() int8
- func (txToken *TxToken) Hash() *common.Hash
- func (txToken TxToken) HashWithoutMetadataSig() *common.Hash
- func (txToken *TxToken) Init(txTokenParams interface{}) error
- func (txToken TxToken) IsPrivacy() bool
- func (txToken TxToken) IsSalaryTx() bool
- func (txToken TxToken) ListOTAHashH() []common.Hash
- func (txToken TxToken) ListSerialNumbersHashH() []common.Hash
- func (txToken *TxToken) SetGetSenderAddrLastByte(v byte)
- func (txToken *TxToken) SetInfo(v []byte)
- func (txToken *TxToken) SetLockTime(v int64)
- func (txToken *TxToken) SetMetadata(v metadata.Metadata)
- func (txToken *TxToken) SetPrivateKey(v []byte)
- func (txToken *TxToken) SetProof(privacy.Proof)
- func (txToken *TxToken) SetSig([]byte)
- func (txToken *TxToken) SetSigPubKey([]byte)
- func (txToken *TxToken) SetTxBase(v metadata.Transaction) error
- func (txToken *TxToken) SetTxFee(v uint64)
- func (txToken *TxToken) SetTxNormal(v metadata.Transaction) error
- func (txToken *TxToken) SetTxTokenData(v tx_generic.TxTokenData) error
- func (txToken *TxToken) SetType(v string)
- func (txToken *TxToken) SetVersion(v int8)
- func (txToken TxToken) String() string
- func (txToken *TxToken) UnmarshalJSON(data []byte) error
- type TxTokenConvertVer1ToVer2InitParams
- type TxTokenDataVersion2
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitConversion ¶
func InitConversion(tx *Tx, params *TxConvertVer1ToVer2InitParams) error
InitConversion creates a conversion transaction that converts PRV UTXOs v1 to v2. A conversion transaction is a special PRV transaction of version 2. It is non-private, meaning that all details of the transaction are publicly visible.
- InputCoins: PlainCoin V1
- OutputCoins: CoinV2
- Signature: Schnorr signature with no privacy.
func InitTokenConversion ¶
func InitTokenConversion(txToken *TxToken, params *TxTokenConvertVer1ToVer2InitParams) error
InitTokenConversion creates a token conversion transaction that converts token UTXOs v1 to v2. A token conversion transaction is a special token transaction of version 2. It pays the transaction fee in PRV and it is required that the account has enough PRV v2 to pay the fee. This transaction is non-private, meaning that all details of the transaction are publicly visible.
- TxBase: A PRV transaction V2
- TxNormal:
- InputCoins: PlainCoin V1
- OutputCoins: CoinV2
- Signature: Schnorr signature with no privacy.
Types ¶
type CustomTokenConversionParams ¶
type CustomTokenConversionParams struct {
// contains filtered or unexported fields
}
CustomTokenConversionParams describes the parameters needed to create a token conversion transaction.
type SigPubKey ¶
SigPubKey represents the sigPubKey of a Tx. Unlike a transaction v1, a SigPubKey of a transaction v2 is the list of indices of input coins and the decoys used in the transaction.
type Tx ¶
type Tx struct {
tx_generic.TxBase
}
Tx implements a PRV transaction v2. It is a embedded TxBase with some overridden functions. A transaction v2 is mainly composed of
- OTA: different output coins have different public key, even if they belong to the same user.
- MLSAG: a ring signature scheme used to anonymize the true sender.
- BulletProofs: a range proof used to prove that a value lies within an interval without revealing it.
By default, a transaction v2 is private, meaning that most of the stuff is hidden to public observers.
func (*Tx) GetReceiverData ¶
GetReceiverData returns a list of output coins of a Tx. Unlike the case of a transaction v1, we do not know which coins are the sent-back coins, therefore, we return all of them.
func (Tx) GetTxActualSize ¶
GetTxActualSize returns the size of a Tx in kb.
func (Tx) GetTxBurnData ¶
GetTxBurnData returns the burning data (token only) of a Tx.
func (Tx) GetTxFullBurnData ¶
GetTxFullBurnData is the same as GetTxBurnData.
func (Tx) GetTxMintData ¶
GetTxMintData returns the minting data of a Tx.
func (Tx) HashWithoutMetadataSig ¶
HashWithoutMetadataSig calculates the hash of a Tx with out adding the signature of its metadata.
func (*Tx) Init ¶
Init creates a PRV transaction version 2 from the given parameter. The input parameter should be a *tx_generic.TxPrivacyInitParams.
func (*Tx) InitTxSalary ¶
func (tx *Tx) InitTxSalary(otaCoin *coin.CoinV2, privateKey *key.PrivateKey, metaData metadata.Metadata) error
InitTxSalary creates a PRV salary transaction to an OTA address.
func (Tx) ListOTAHashH ¶
ListOTAHashH returns the hash list of all OTA keys in a Tx.
type TxConvertVer1ToVer2InitParams ¶
type TxConvertVer1ToVer2InitParams struct {
// contains filtered or unexported fields
}
TxConvertVer1ToVer2InitParams consists of parameters used to create a new PRV conversion transaction.
func NewTxConvertVer1ToVer2InitParams ¶
func NewTxConvertVer1ToVer2InitParams(senderSK *key.PrivateKey, paymentInfo []*key.PaymentInfo, inputCoins []coin.PlainCoin, fee uint64, tokenID *common.Hash, metaData metadata.Metadata, info []byte, kvArgs map[string]interface{}) *TxConvertVer1ToVer2InitParams
NewTxConvertVer1ToVer2InitParams creates a new TxConvertVer1ToVer2InitParams from the given parameters.
type TxToken ¶
type TxToken struct { Tx Tx `json:"Tx"` TokenData TxTokenDataVersion2 `json:"TxTokenPrivacyData"` // contains filtered or unexported fields }
TxToken represents a token transaction of version 2. A token transaction v2 consists of 2 sub-transactions
- TxBase: PRV sub-transaction for paying the transaction fee. All transactions v2 pay fees in PRV.
- TxNormal: the token sub-transaction to transfer token.
func (*TxToken) CalculateTxValue ¶
CalculateTxValue calculates total output values.
func (TxToken) CheckTxVersion ¶
CheckTxVersion checks if the version of a TxToken is valid.
func (TxToken) GetLockTime ¶
GetLockTime returns the lock-time of a TxToken.
func (TxToken) GetMetadata ¶
GetMetadata returns the metadata of a TxToken.
func (TxToken) GetMetadataType ¶
GetMetadataType returns the metadata type of a TxToken.
func (TxToken) GetPrivateKey ¶
GetPrivateKey returns the sender's private key.
func (*TxToken) GetReceiverData ¶
GetReceiverData returns the output coins of a TxToken.
func (TxToken) GetReceivers ¶
GetReceivers not supported.
func (TxToken) GetSenderAddrLastByte ¶
GetSenderAddrLastByte returns the last byte of the sender of a TxToken.
func (TxToken) GetSigPubKey ¶
GetSigPubKey not supported.
func (TxToken) GetTokenID ¶
GetTokenID returns the tokenID of a TxToken.
func (*TxToken) GetTransferData ¶
GetTransferData returns the transferred data of a TxToken.
func (TxToken) GetTxActualSize ¶
GetTxActualSize returns the size of a TxToken in kb.
func (*TxToken) GetTxBase ¶
func (txToken *TxToken) GetTxBase() metadata.Transaction
GetTxBase returns the PRV sub-transaction of a TxToken.
func (*TxToken) GetTxBurnData ¶
GetTxBurnData returns the burning (token only) of a TxToken.
func (TxToken) GetTxFeeToken ¶
GetTxFeeToken returns the token fee of a TxToken. All transactions v2 pay fees in PRV, so it returns 0.
func (*TxToken) GetTxFullBurnData ¶
GetTxFullBurnData returns the full burning data (both PRV and token) of a TxToken.
func (*TxToken) GetTxMintData ¶
GetTxMintData returns the minting data of a TxToken.
func (*TxToken) GetTxNormal ¶
func (txToken *TxToken) GetTxNormal() metadata.Transaction
GetTxNormal returns the token sub-transaction of a TxToken.
func (*TxToken) GetTxTokenData ¶
func (txToken *TxToken) GetTxTokenData() tx_generic.TxTokenData
GetTxTokenData returns the token data of a TxToken.
func (TxToken) GetVersion ¶
GetVersion returns the version of a TxToken.
func (TxToken) HashWithoutMetadataSig ¶
HashWithoutMetadataSig calculates the hash of a TxToken with out adding the signature of its metadata.
func (*TxToken) Init ¶
Init creates a token transaction version 2 from the given parameter. The input parameter should be a *tx_generic.TxTokenParams.
func (TxToken) IsSalaryTx ¶
IsSalaryTx checks if a TxToken is a salary transaction.
func (TxToken) ListOTAHashH ¶
ListOTAHashH returns the hash list of all OTA keys in a TxToken.
func (TxToken) ListSerialNumbersHashH ¶
ListSerialNumbersHashH returns the hash list of all serial numbers in a TxToken.
func (*TxToken) SetGetSenderAddrLastByte ¶
SetGetSenderAddrLastByte sets v as the sender's last byte of a TxToken.
func (*TxToken) SetLockTime ¶
SetLockTime sets v as the lock-time of a TxToken.
func (*TxToken) SetMetadata ¶
SetMetadata sets v the metadata of a TxToken.
func (*TxToken) SetPrivateKey ¶
SetPrivateKey sets v as the private key of a TxToken.
func (*TxToken) SetSigPubKey ¶
SetSigPubKey not supported.
func (*TxToken) SetTxBase ¶
func (txToken *TxToken) SetTxBase(v metadata.Transaction) error
SetTxBase sets v as the TxBase of a TxToken.
func (*TxToken) SetTxNormal ¶
func (txToken *TxToken) SetTxNormal(v metadata.Transaction) error
SetTxNormal sets v as the TxNormal of a TxToken.
func (*TxToken) SetTxTokenData ¶
func (txToken *TxToken) SetTxTokenData(v tx_generic.TxTokenData) error
SetTxTokenData sets v as the token data of a TxToken.
func (*TxToken) SetVersion ¶
SetVersion sets v as the version of a TxToken.
func (*TxToken) UnmarshalJSON ¶
UnmarshalJSON does the JSON-unmarshalling operation for a TxToken.
type TxTokenConvertVer1ToVer2InitParams ¶
type TxTokenConvertVer1ToVer2InitParams struct {
// contains filtered or unexported fields
}
TxTokenConvertVer1ToVer2InitParams consists of parameters used to create a new token conversion transaction.
func NewTxTokenConvertVer1ToVer2InitParams ¶
func NewTxTokenConvertVer1ToVer2InitParams(senderSK *key.PrivateKey, feeInputs []coin.PlainCoin, feePayments []*key.PaymentInfo, tokenInputs []coin.PlainCoin, tokenPayments []*key.PaymentInfo, fee uint64, tokenID *common.Hash, metaData metadata.Metadata, info []byte, kvArgs map[string]interface{}) *TxTokenConvertVer1ToVer2InitParams
NewTxTokenConvertVer1ToVer2InitParams creates a new TxTokenConvertVer1ToVer2InitParams from the given parameters.
type TxTokenDataVersion2 ¶
type TxTokenDataVersion2 struct { PropertyID common.Hash PropertyName string PropertySymbol string SigPubKey []byte `json:"SigPubKey,omitempty"` // 33 bytes Sig []byte `json:"Sig,omitempty"` // Proof privacy.Proof Type int Mintable bool }
TxTokenDataVersion2 represents all data of a token transaction v2.
func (TxTokenDataVersion2) Hash ¶
func (td TxTokenDataVersion2) Hash() (*common.Hash, error)
Hash calculates the hash of a TxTokenDataVersion2.
func (TxTokenDataVersion2) ToCompatTokenData ¶
func (td TxTokenDataVersion2) ToCompatTokenData(ttx metadata.Transaction) tx_generic.TxTokenData
ToCompatTokenData creates a TxTokenData from a TxTokenDataVersion2 and the given transaction.