Documentation ¶
Index ¶
- Constants
- func ComputeAssetTagBlinder(sharedSecret *crypto.Point) (*crypto.Scalar, error)
- func ComputeCommitmentCA(assetTag *crypto.Point, r, v *crypto.Scalar) (*crypto.Point, error)
- type Coin
- type CoinV1
- func (c *CoinV1) Bytes() []byte
- func (c *CoinV1) CheckCoinValid(paymentAdd key.PaymentAddress, _ []byte, amount uint64) bool
- func (c CoinV1) Decrypt(keySet *key.KeySet) (PlainCoin, error)
- func (c *CoinV1) DoesCoinBelongToKeySet(keySet *key.KeySet) (bool, *crypto.Point)
- func (c *CoinV1) Encrypt(recipientTK key.TransmissionKey) error
- func (c CoinV1) GetAssetTag() *crypto.Point
- func (c CoinV1) GetCoinDetailEncrypted() []byte
- func (c CoinV1) GetCommitment() *crypto.Point
- func (c CoinV1) GetInfo() []byte
- func (c CoinV1) GetKeyImage() *crypto.Point
- func (c CoinV1) GetPublicKey() *crypto.Point
- func (c CoinV1) GetRandomness() *crypto.Scalar
- func (c CoinV1) GetSNDerivator() *crypto.Scalar
- func (c CoinV1) GetShardID() (uint8, error)
- func (c CoinV1) GetSharedConcealRandom() *crypto.Scalar
- func (c CoinV1) GetSharedRandom() *crypto.Scalar
- func (c CoinV1) GetTxRandom() *TxRandom
- func (c CoinV1) GetValue() uint64
- func (c CoinV1) GetVersion() uint8
- func (c *CoinV1) Init() *CoinV1
- func (c CoinV1) IsEncrypted() bool
- func (c CoinV1) MarshalJSON() ([]byte, error)
- func (c *CoinV1) SetBytes(bytes []byte) error
- func (c CoinV1) SetValue(v uint64)
- func (c *CoinV1) UnmarshalJSON(data []byte) error
- type CoinV2
- func (c CoinV2) Bytes() []byte
- func (c *CoinV2) CheckCoinValid(paymentAdd key.PaymentAddress, sharedRandom []byte, amount uint64) bool
- func (c *CoinV2) ComputeCommitmentCA() (*crypto.Point, error)
- func (c *CoinV2) ConcealInputCoin()
- func (c *CoinV2) ConcealOutputCoin(additionalData interface{}) error
- func (c *CoinV2) Decrypt(keySet *key.KeySet) (PlainCoin, error)
- func (c *CoinV2) DoesCoinBelongToKeySet(keySet *key.KeySet) (bool, *crypto.Point)
- func (c CoinV2) GetAmount() *crypto.Scalar
- func (c CoinV2) GetAssetTag() *crypto.Point
- func (c CoinV2) GetCoinDetailEncrypted() []byte
- func (c CoinV2) GetCommitment() *crypto.Point
- func (c CoinV2) GetInfo() []byte
- func (c CoinV2) GetKeyImage() *crypto.Point
- func (c CoinV2) GetPublicKey() *crypto.Point
- func (c CoinV2) GetRandomness() *crypto.Scalar
- func (c CoinV2) GetSNDerivator() *crypto.Scalar
- func (c CoinV2) GetShardID() (uint8, error)
- func (c CoinV2) GetSharedConcealRandom() *crypto.Scalar
- func (c CoinV2) GetSharedRandom() *crypto.Scalar
- func (c *CoinV2) GetTokenId(keySet *key.KeySet, rawAssetTags map[string]*common.Hash) (*common.Hash, error)
- func (c CoinV2) GetTxRandom() *TxRandom
- func (c CoinV2) GetTxRandomDetail() (*crypto.Point, *crypto.Point, uint32, error)
- func (c CoinV2) GetValue() uint64
- func (c CoinV2) GetVersion() uint8
- func (c *CoinV2) HashH() *common.Hash
- func (c *CoinV2) Init() *CoinV2
- func (c CoinV2) IsEncrypted() bool
- func (c CoinV2) MarshalJSON() ([]byte, error)
- func (c CoinV2) ParseKeyImageWithPrivateKey(privateKey key.PrivateKey) (*crypto.Point, error)
- func (c CoinV2) ParsePrivateKeyOfCoin(privateKey key.PrivateKey) (*crypto.Scalar, error)
- func (c *CoinV2) RecomputeSharedSecret(privateKey []byte) (*crypto.Point, error)
- func (c *CoinV2) SetAmount(v *crypto.Scalar)
- func (c *CoinV2) SetAssetTag(v *crypto.Point)
- func (c *CoinV2) SetBytes(coinBytes []byte) error
- func (c *CoinV2) SetCommitment(v *crypto.Point)
- func (c *CoinV2) SetInfo(b []byte)
- func (c *CoinV2) SetKeyImage(keyImage *crypto.Point)
- func (c *CoinV2) SetPlainTokenID(tokenID *common.Hash) error
- func (c *CoinV2) SetPublicKey(v *crypto.Point)
- func (c *CoinV2) SetRandomness(v *crypto.Scalar)
- func (c *CoinV2) SetSharedConcealRandom(v *crypto.Scalar)
- func (c *CoinV2) SetSharedRandom(v *crypto.Scalar)
- func (c *CoinV2) SetTxRandom(v *TxRandom)
- func (c *CoinV2) SetTxRandomDetail(txConcealRandomPoint, txRandomPoint *crypto.Point, index uint32)
- func (c *CoinV2) SetValue(value uint64)
- func (c *CoinV2) SetVersion(uint8)
- func (c *CoinV2) UnmarshalJSON(data []byte) error
- func (c *CoinV2) ValidateAssetTag(sharedSecret *crypto.Point, tokenID *common.Hash) (bool, error)
- type PlainCoin
- type PlainCoinV1
- func (pc *PlainCoinV1) Bytes() []byte
- func (pc *PlainCoinV1) CommitAll() error
- func (pc *PlainCoinV1) ConcealOutputCoin(_ interface{}) error
- func (pc *PlainCoinV1) DoesCoinBelongToKeySet(keySet *key.KeySet) (bool, *crypto.Point)
- func (pc PlainCoinV1) GetAssetTag() *crypto.Point
- func (pc PlainCoinV1) GetCoinDetailEncrypted() []byte
- func (pc PlainCoinV1) GetCommitment() *crypto.Point
- func (pc PlainCoinV1) GetInfo() []byte
- func (pc PlainCoinV1) GetKeyImage() *crypto.Point
- func (pc PlainCoinV1) GetPublicKey() *crypto.Point
- func (pc PlainCoinV1) GetRandomness() *crypto.Scalar
- func (pc PlainCoinV1) GetSNDerivator() *crypto.Scalar
- func (pc *PlainCoinV1) GetShardID() (uint8, error)
- func (pc PlainCoinV1) GetSharedConcealRandom() *crypto.Scalar
- func (pc PlainCoinV1) GetSharedRandom() *crypto.Scalar
- func (pc PlainCoinV1) GetTxRandom() *TxRandom
- func (pc PlainCoinV1) GetValue() uint64
- func (*PlainCoinV1) GetVersion() uint8
- func (pc *PlainCoinV1) HashH() *common.Hash
- func (pc *PlainCoinV1) Init() *PlainCoinV1
- func (pc PlainCoinV1) IsEncrypted() bool
- func (pc PlainCoinV1) MarshalJSON() ([]byte, error)
- func (pc PlainCoinV1) ParseKeyImageWithPrivateKey(privateKey key.PrivateKey) (*crypto.Point, error)
- func (pc PlainCoinV1) ParsePrivateKeyOfCoin(privateKey key.PrivateKey) (*crypto.Scalar, error)
- func (pc *PlainCoinV1) SetBytes(coinBytes []byte) error
- func (pc *PlainCoinV1) SetCommitment(v *crypto.Point)
- func (pc *PlainCoinV1) SetInfo(v []byte)
- func (pc *PlainCoinV1) SetKeyImage(v *crypto.Point)
- func (pc *PlainCoinV1) SetPublicKey(v *crypto.Point)
- func (pc *PlainCoinV1) SetRandomness(v *crypto.Scalar)
- func (pc *PlainCoinV1) SetSNDerivator(v *crypto.Scalar)
- func (pc *PlainCoinV1) SetValue(v uint64)
- func (pc *PlainCoinV1) UnmarshalJSON(data []byte) error
- type TxRandom
- func (t TxRandom) Bytes() []byte
- func (t TxRandom) GetIndex() (uint32, error)
- func (t TxRandom) GetTxConcealRandomPoint() (*crypto.Point, error)
- func (t TxRandom) GetTxOTARandomPoint() (*crypto.Point, error)
- func (t *TxRandom) SetBytes(v []byte) error
- func (t *TxRandom) SetIndex(v uint32)
- func (t *TxRandom) SetTxConcealRandomPoint(v *crypto.Point)
- func (t *TxRandom) SetTxOTARandomPoint(v *crypto.Point)
Constants ¶
const ( MaxTriesOTA int = 50000 AssetTagString = "assettag" )
const ( MaxSizeInfoCoin = 255 JsonMarshalFlag = 34 CoinVersion1 = 1 CoinVersion2 = 2 TxRandomGroupSize = 68 )
const ( PedersenPrivateKeyIndex = crypto.PedersenPrivateKeyIndex PedersenValueIndex = crypto.PedersenValueIndex PedersenSndIndex = crypto.PedersenSndIndex PedersenShardIDIndex = crypto.PedersenShardIDIndex PedersenRandomnessIndex = crypto.PedersenRandomnessIndex )
Variables ¶
This section is empty.
Functions ¶
func ComputeAssetTagBlinder ¶
ComputeAssetTagBlinder returns the asset tag blinder from a shared secret.
Types ¶
type Coin ¶
type Coin interface { GetVersion() uint8 GetCommitment() *crypto.Point GetInfo() []byte GetPublicKey() *crypto.Point GetKeyImage() *crypto.Point GetValue() uint64 GetRandomness() *crypto.Scalar GetShardID() (uint8, error) GetSNDerivator() *crypto.Scalar GetCoinDetailEncrypted() []byte IsEncrypted() bool GetTxRandom() *TxRandom GetAssetTag() *crypto.Point SetValue(v uint64) Decrypt(*key.KeySet) (PlainCoin, error) Bytes() []byte SetBytes([]byte) error CheckCoinValid(key.PaymentAddress, []byte, uint64) bool DoesCoinBelongToKeySet(keySet *key.KeySet) (bool, *crypto.Point) }
Coin represents a input or output coin of a transaction.
func NewCoinFromByte ¶
NewCoinFromByte creates a new Coin from its bytes.
The first byte should determine the coin version or json marshal "34".
func ParseCoinsFromBytes ¶
func ParseCoinsFromBytes(data []json.RawMessage) ([]Coin, error)
ParseCoinsFromBytes parses a list of raw bytes into a list of corresponding Coin objects.
type CoinV1 ¶
type CoinV1 struct { CoinDetails *PlainCoinV1 CoinDetailsEncrypted *hybridencryption.HybridCipherText }
CoinV1 implements the Coin interface. It is mainly used as an output coin of a transaction v1.
It contains CoinDetails and CoinDetailsEncrypted (encrypted value and randomness). CoinDetailsEncrypted is nil when you send tx without privacy.
func (*CoinV1) Bytes ¶
Bytes converts a CoinV1 into a slice of bytes.
This conversion is unique for each CoinV1.
func (*CoinV1) CheckCoinValid ¶
CheckCoinValid checks if a CoinV1 is valid for its amount and payment address.
func (*CoinV1) DoesCoinBelongToKeySet ¶
DoesCoinBelongToKeySet checks if a CoinV1 belongs to the given key set.
func (*CoinV1) Encrypt ¶
func (c *CoinV1) Encrypt(recipientTK key.TransmissionKey) error
Encrypt returns a ciphertext encrypting for a coin using a hybrid crypto-system, in which the AES encryption scheme is used as a data encapsulation scheme, and the ElGamal crypto system is used as a key encapsulation scheme.
func (CoinV1) GetAssetTag ¶
GetAssetTag returns the asset tag of a CoinV1. For a CoinV1, this value is nil.
func (CoinV1) GetCoinDetailEncrypted ¶
GetCoinDetailEncrypted returns the encrypted detail of a CoinV1. For a non-private transaction, this value is always nil.
func (CoinV1) GetCommitment ¶
GetCommitment returns the commitment of a CoinV1.
func (CoinV1) GetKeyImage ¶
GetKeyImage returns the serial number of a CoinV1.
func (CoinV1) GetPublicKey ¶
GetPublicKey returns the public key of a CoinV1. For a CoinV1, its public key is the public key of the owner.
func (CoinV1) GetRandomness ¶
GetRandomness returns the randomness of a CoinV1.
func (CoinV1) GetSNDerivator ¶
GetSNDerivator returns the serial number derivator of a CoinV1.
func (CoinV1) GetShardID ¶
GetShardID returns the shardID in which a CoinV1 belongs to.
func (CoinV1) GetSharedConcealRandom ¶
GetSharedConcealRandom returns the shared random when concealing of a CoinV1. For a CoinV1, this value is nil.
func (CoinV1) GetSharedRandom ¶
GetSharedRandom returns the shared random of a CoinV1. For a CoinV1, this value is nil.
func (CoinV1) GetTxRandom ¶
GetTxRandom returns the transaction randomness of a CoinV1. For a CoinV1, this value is nil.
func (CoinV1) GetVersion ¶
GetVersion returns the version of a CoinV1.
func (CoinV1) IsEncrypted ¶
IsEncrypted checks if whether a CoinV1 is encrypted.
func (CoinV1) MarshalJSON ¶
MarshalJSON converts coin to a byte-array.
func (*CoinV1) UnmarshalJSON ¶
UnmarshalJSON converts a slice of bytes (was Marshalled before) into a CoinV1 objects.
type CoinV2 ¶
type CoinV2 struct {
// contains filtered or unexported fields
}
CoinV2 implements both the PlainCoin and Coin interfaces. It is mainly used as inputs and outputs of a transaction v2.
If not privacy, mask and amount will be the original randomness and value If has privacy, mask and amount will be as described in the Monero paper.
func NewCoinCA ¶
NewCoinCA creates a new CoinV2 for the paymentInfo with asset tag for the given tokenID. It is used in the case of confidential assets only
func NewCoinFromPaymentInfo ¶
func NewCoinFromPaymentInfo(info *key.PaymentInfo) (*CoinV2, error)
NewCoinFromPaymentInfo creates a new CoinV2 from the given payment info.
func (CoinV2) Bytes ¶
Bytes converts a CoinV2 into a slice of bytes.
This conversion is unique for each CoinV2.
func (*CoinV2) CheckCoinValid ¶
func (c *CoinV2) CheckCoinValid(paymentAdd key.PaymentAddress, sharedRandom []byte, amount uint64) bool
CheckCoinValid checks if a CoinV2 is valid for its amount and payment address.
func (*CoinV2) ComputeCommitmentCA ¶
ComputeCommitmentCA computes the commitment of a CoinV2 with its asset token.
This function is used to provide confidential assets of a token transaction V2.
func (*CoinV2) ConcealInputCoin ¶
func (c *CoinV2) ConcealInputCoin()
ConcealInputCoin conceals the true value of a CoinV2, leaving only the serial number unchanged (mainly when the coin is used as an input of a transaction).
func (*CoinV2) ConcealOutputCoin ¶
ConcealOutputCoin conceals the amount of coin using the publicView of the receiver
- AdditionalData: must be the publicView of the receiver.
func (*CoinV2) DoesCoinBelongToKeySet ¶
DoesCoinBelongToKeySet checks if a CoinV2 belongs to the given key set.
func (CoinV2) GetAssetTag ¶
GetAssetTag returns the asset tag of a CoinV2. For a PRV CoinV2, this value is nil.
func (CoinV2) GetCoinDetailEncrypted ¶
GetCoinDetailEncrypted returns the encrypted detail of a CoinV2.
func (CoinV2) GetCommitment ¶
GetCommitment returns the commitment of a CoinV2.
func (CoinV2) GetKeyImage ¶
GetKeyImage returns the key image of a CoinV2.
func (CoinV2) GetPublicKey ¶
GetPublicKey returns the public key of a CoinV2.
func (CoinV2) GetRandomness ¶
GetRandomness returns the randomness of a CoinV2.
func (CoinV2) GetSNDerivator ¶
GetSNDerivator returns the serial number derivator of a CoinV2. For a CoinV2, this value is always nil.
func (CoinV2) GetShardID ¶
GetShardID returns the shardID in which a CoinV2 belongs to.
func (CoinV2) GetSharedConcealRandom ¶
GetSharedConcealRandom returns the shared random when concealing of a CoinV2.
func (CoinV2) GetSharedRandom ¶
GetSharedRandom returns the shared random of a CoinV2.
func (*CoinV2) GetTokenId ¶
func (c *CoinV2) GetTokenId(keySet *key.KeySet, rawAssetTags map[string]*common.Hash) (*common.Hash, error)
GetTokenId attempts to retrieve the asset a CoinV2. Parameters:
- keySet: the key set of the user, must contain an OTAKey
- rawAssetTags: a pre-computed mapping from a raw assetTag to the tokenId (e.g, HashToPoint(PRV) => PRV).
func (CoinV2) GetTxRandom ¶
GetTxRandom returns the transaction randomness of a CoinV2.
func (CoinV2) GetTxRandomDetail ¶
GetTxRandomDetail returns the transaction randomness detail of a CoinV2.
func (CoinV2) GetVersion ¶
GetVersion returns the version of a CoinV2.
func (CoinV2) IsEncrypted ¶
IsEncrypted checks if whether a CoinV2 is encrypted.
func (CoinV2) MarshalJSON ¶
MarshalJSON converts coin to a byte-array.
func (CoinV2) ParseKeyImageWithPrivateKey ¶
ParseKeyImageWithPrivateKey derives the key image of a CoinV2 from its private key.
func (CoinV2) ParsePrivateKeyOfCoin ¶
ParsePrivateKeyOfCoin sets privateKey as the private key of a CoinV2.
func (*CoinV2) RecomputeSharedSecret ¶
RecomputeSharedSecret uses the privateKey to re-compute the shared OTA secret of a CoinV2.
func (*CoinV2) SetAssetTag ¶
SetAssetTag sets v as the asset tag of a CoinV2.
func (*CoinV2) SetCommitment ¶
SetCommitment sets v as the randomness of a CoinV2.
func (*CoinV2) SetKeyImage ¶
SetKeyImage sets v as the key-image (a.k.a serial number) of a CoinV2.
func (*CoinV2) SetPlainTokenID ¶
SetPlainTokenID sets the given tokenID as the tokenID of a CoinV2 (in raw value, not blinded).
func (*CoinV2) SetPublicKey ¶
SetPublicKey sets v as the public key of a CoinV2. Each CoinV2 of a user will now have different public keys.
func (*CoinV2) SetRandomness ¶
SetRandomness sets v as the randomness of a CoinV2.
func (*CoinV2) SetSharedConcealRandom ¶
SetSharedConcealRandom sets v as the shared conceal random of a CoinV2.
func (*CoinV2) SetSharedRandom ¶
SetSharedRandom sets v as the OTA shared random of a CoinV2.
func (*CoinV2) SetTxRandom ¶
SetTxRandom sets v as the TxRandom of a CoinV2.
func (*CoinV2) SetTxRandomDetail ¶
SetTxRandomDetail creates the TxRandom of a CoinV2 based on the three provided parameters.
func (*CoinV2) SetVersion ¶
SetVersion sets the version of a CoinV2 to 2.
func (*CoinV2) UnmarshalJSON ¶
UnmarshalJSON converts a slice of bytes (was Marshalled before) into a CoinV2 objects.
type PlainCoin ¶
type PlainCoin interface { MarshalJSON() ([]byte, error) UnmarshalJSON(data []byte) error GetVersion() uint8 GetCommitment() *crypto.Point GetInfo() []byte GetPublicKey() *crypto.Point GetValue() uint64 GetKeyImage() *crypto.Point GetRandomness() *crypto.Scalar GetShardID() (uint8, error) GetSNDerivator() *crypto.Scalar GetCoinDetailEncrypted() []byte IsEncrypted() bool GetTxRandom() *TxRandom GetAssetTag() *crypto.Point SetKeyImage(*crypto.Point) SetPublicKey(*crypto.Point) SetCommitment(*crypto.Point) SetInfo([]byte) SetValue(uint64) SetRandomness(*crypto.Scalar) ParseKeyImageWithPrivateKey(key.PrivateKey) (*crypto.Point, error) ParsePrivateKeyOfCoin(key.PrivateKey) (*crypto.Scalar, error) ConcealOutputCoin(additionalData interface{}) error Bytes() []byte SetBytes([]byte) error DoesCoinBelongToKeySet(keySet *key.KeySet) (bool, *crypto.Point) }
PlainCoin represents an un-encrypted coin of a transaction.
func NewPlainCoinFromByte ¶
NewPlainCoinFromByte parse a new PlainCoin from its bytes.
The first byte should determine the coin version.
type PlainCoinV1 ¶
type PlainCoinV1 struct {
// contains filtered or unexported fields
}
PlainCoinV1 represents a decrypted CoinV1. It is mainly used as the input of a transaction v1 or a conversion transaction.
This struct implements the PlainCoin interface.
func (*PlainCoinV1) Bytes ¶
func (pc *PlainCoinV1) Bytes() []byte
Bytes converts a PlainCoinV1 into a slice of bytes.
This conversion is unique for each PlainCoinV1.
func (*PlainCoinV1) CommitAll ¶
func (pc *PlainCoinV1) CommitAll() error
CommitAll calculates the Pedersen commitment of a PlainCoinV1 from its attributes.
The commitment includes 5 attributes with 5 different bases:
- The public key
- The value
- The serial number derivator
- The shardID
- The randomness.
func (*PlainCoinV1) ConcealOutputCoin ¶
func (pc *PlainCoinV1) ConcealOutputCoin(_ interface{}) error
ConcealOutputCoin conceals the true value of a PlainCoinV1, leaving only the serial number unchanged.
func (*PlainCoinV1) DoesCoinBelongToKeySet ¶
DoesCoinBelongToKeySet checks if a PlainCoinV1 belongs to the given key set.
func (PlainCoinV1) GetAssetTag ¶
func (pc PlainCoinV1) GetAssetTag() *crypto.Point
GetAssetTag returns the asset tag of a PlainCoinV1. For a PlainCoinV1, this value is nil.
func (PlainCoinV1) GetCoinDetailEncrypted ¶
func (pc PlainCoinV1) GetCoinDetailEncrypted() []byte
GetCoinDetailEncrypted returns the encrypted detail of a PlainCoinV1. For a PlainCoinV1, this value is always nil.
func (PlainCoinV1) GetCommitment ¶
func (pc PlainCoinV1) GetCommitment() *crypto.Point
GetCommitment returns the commitment of a PlainCoinV1.
func (PlainCoinV1) GetInfo ¶
func (pc PlainCoinV1) GetInfo() []byte
GetInfo returns the info of a PlainCoinV1.
func (PlainCoinV1) GetKeyImage ¶
func (pc PlainCoinV1) GetKeyImage() *crypto.Point
GetKeyImage returns the serial number of a PlainCoinV1.
func (PlainCoinV1) GetPublicKey ¶
func (pc PlainCoinV1) GetPublicKey() *crypto.Point
GetPublicKey returns the public key of a PlainCoinV1. For a PlainCoinV1, its public key is the public key of the owner.
func (PlainCoinV1) GetRandomness ¶
func (pc PlainCoinV1) GetRandomness() *crypto.Scalar
GetRandomness returns the randomness of a PlainCoinV1.
func (PlainCoinV1) GetSNDerivator ¶
func (pc PlainCoinV1) GetSNDerivator() *crypto.Scalar
GetSNDerivator returns the serial number derivator of a PlainCoinV1.
func (*PlainCoinV1) GetShardID ¶
func (pc *PlainCoinV1) GetShardID() (uint8, error)
GetShardID returns the shardID in which a PlainCoinV1 belongs to.
func (PlainCoinV1) GetSharedConcealRandom ¶
func (pc PlainCoinV1) GetSharedConcealRandom() *crypto.Scalar
GetSharedConcealRandom returns the shared random when concealing of a PlainCoinV1. For a PlainCoinV1, this value is nil.
func (PlainCoinV1) GetSharedRandom ¶
func (pc PlainCoinV1) GetSharedRandom() *crypto.Scalar
GetSharedRandom returns the shared random of a PlainCoinV1. For a PlainCoinV1, this value is nil.
func (PlainCoinV1) GetTxRandom ¶
func (pc PlainCoinV1) GetTxRandom() *TxRandom
GetTxRandom returns the transaction randomness of a PlainCoinV1. For a PlainCoinV1, this value is nil.
func (PlainCoinV1) GetValue ¶
func (pc PlainCoinV1) GetValue() uint64
GetValue returns the value of a PlainCoinV1.
func (*PlainCoinV1) GetVersion ¶
func (*PlainCoinV1) GetVersion() uint8
GetVersion returns the version of a PlainCoinV1.
func (*PlainCoinV1) HashH ¶
func (pc *PlainCoinV1) HashH() *common.Hash
HashH returns the SHA3-256 hashing of a PlainCoinV1.
func (*PlainCoinV1) Init ¶
func (pc *PlainCoinV1) Init() *PlainCoinV1
Init initializes an empty PlainCoinV1 object.
func (PlainCoinV1) IsEncrypted ¶
func (pc PlainCoinV1) IsEncrypted() bool
IsEncrypted checks if whether a PlainCoinV1 is encrypted. This value is always false.
func (PlainCoinV1) MarshalJSON ¶
func (pc PlainCoinV1) MarshalJSON() ([]byte, error)
MarshalJSON converts coin to a byte-array.
func (PlainCoinV1) ParseKeyImageWithPrivateKey ¶
func (pc PlainCoinV1) ParseKeyImageWithPrivateKey(privateKey key.PrivateKey) (*crypto.Point, error)
ParseKeyImageWithPrivateKey derives the key image of a PlainCoinV1 from its private key.
func (PlainCoinV1) ParsePrivateKeyOfCoin ¶
func (pc PlainCoinV1) ParsePrivateKeyOfCoin(privateKey key.PrivateKey) (*crypto.Scalar, error)
ParsePrivateKeyOfCoin sets privateKey as the private key of a PlainCoinV1.
func (*PlainCoinV1) SetBytes ¶
func (pc *PlainCoinV1) SetBytes(coinBytes []byte) error
SetBytes parses a slice of bytes into a PlainCoinV1.
func (*PlainCoinV1) SetCommitment ¶
func (pc *PlainCoinV1) SetCommitment(v *crypto.Point)
SetCommitment sets v as the commitment of a PlainCoinV1.
func (*PlainCoinV1) SetInfo ¶
func (pc *PlainCoinV1) SetInfo(v []byte)
SetInfo sets v as the info of a PlainCoinV1.
func (*PlainCoinV1) SetKeyImage ¶
func (pc *PlainCoinV1) SetKeyImage(v *crypto.Point)
SetKeyImage sets v as the serial number of a PlainCoinV1.
func (*PlainCoinV1) SetPublicKey ¶
func (pc *PlainCoinV1) SetPublicKey(v *crypto.Point)
SetPublicKey sets v as the public key of a PlainCoinV1.
func (*PlainCoinV1) SetRandomness ¶
func (pc *PlainCoinV1) SetRandomness(v *crypto.Scalar)
SetRandomness sets v as the randomness of a PlainCoinV1.
func (*PlainCoinV1) SetSNDerivator ¶
func (pc *PlainCoinV1) SetSNDerivator(v *crypto.Scalar)
SetSNDerivator sets v as the serial number derivator of a PlainCoinV1.
func (*PlainCoinV1) SetValue ¶
func (pc *PlainCoinV1) SetValue(v uint64)
SetValue sets v as the value of a PlainCoinV1.
func (*PlainCoinV1) UnmarshalJSON ¶
func (pc *PlainCoinV1) UnmarshalJSON(data []byte) error
UnmarshalJSON converts a slice of bytes (was Marshalled before) into a PlainCoinV1 objects.
type TxRandom ¶
type TxRandom [TxRandomGroupSize]byte
TxRandom is a struct implementing for transactions of version 2.
A TxRandom consists of 3 elements, represented a an array of TxRandomGroupSize bytes:
- An OTA random point
- A conceal random point
- An index
func (TxRandom) GetTxConcealRandomPoint ¶
GetTxConcealRandomPoint returns the conceal random point of a TxRandom.
func (TxRandom) GetTxOTARandomPoint ¶
GetTxOTARandomPoint returns the OTA random point of a TxRandom.
func (*TxRandom) SetTxConcealRandomPoint ¶
SetTxConcealRandomPoint sets v as the conceal random point of a TxRandom.
func (*TxRandom) SetTxOTARandomPoint ¶
SetTxOTARandomPoint sets v as the OTA random point of a TxRandom.