coin

package
v1.0.1-beta Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2021 License: MIT Imports: 10 Imported by: 8

Documentation

Index

Constants

View Source
const (
	MaxTriesOTA    int = 50000
	AssetTagString     = "assettag"
)
View Source
const (
	MaxSizeInfoCoin   = 255
	JsonMarshalFlag   = 34
	CoinVersion1      = 1
	CoinVersion2      = 2
	TxRandomGroupSize = 68
)
View Source
const (
	PedersenPrivateKeyIndex = crypto.PedersenPrivateKeyIndex
	PedersenValueIndex      = crypto.PedersenValueIndex
	PedersenSndIndex        = crypto.PedersenSndIndex
	PedersenShardIDIndex    = crypto.PedersenShardIDIndex
	PedersenRandomnessIndex = crypto.PedersenRandomnessIndex
)

Variables

This section is empty.

Functions

func ComputeAssetTagBlinder

func ComputeAssetTagBlinder(sharedSecret *crypto.Point) (*crypto.Scalar, error)

ComputeAssetTagBlinder returns the asset tag blinder from a shared secret.

func ComputeCommitmentCA

func ComputeCommitmentCA(assetTag *crypto.Point, r, v *crypto.Scalar) (*crypto.Point, error)

ComputeCommitmentCA computes a commitment based on the given assetTag, randomness r and value v.

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
	GetSharedRandom() *crypto.Scalar
	GetSharedConcealRandom() *crypto.Scalar
	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

func NewCoinFromByte(b []byte) (Coin, error)

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

func (c *CoinV1) Bytes() []byte

Bytes converts a CoinV1 into a slice of bytes.

This conversion is unique for each CoinV1.

func (*CoinV1) CheckCoinValid

func (c *CoinV1) CheckCoinValid(paymentAdd key.PaymentAddress, _ []byte, amount uint64) bool

CheckCoinValid checks if a CoinV1 is valid for its amount and payment address.

func (CoinV1) Decrypt

func (c CoinV1) Decrypt(keySet *key.KeySet) (PlainCoin, error)

Decrypt decrypts a CoinV1 into a PlainCoinV1 using the given key set.

func (*CoinV1) DoesCoinBelongToKeySet

func (c *CoinV1) DoesCoinBelongToKeySet(keySet *key.KeySet) (bool, *crypto.Point)

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

func (c CoinV1) GetAssetTag() *crypto.Point

GetAssetTag returns the asset tag of a CoinV1. For a CoinV1, this value is nil.

func (CoinV1) GetCoinDetailEncrypted

func (c CoinV1) GetCoinDetailEncrypted() []byte

GetCoinDetailEncrypted returns the encrypted detail of a CoinV1. For a non-private transaction, this value is always nil.

func (CoinV1) GetCommitment

func (c CoinV1) GetCommitment() *crypto.Point

GetCommitment returns the commitment of a CoinV1.

func (CoinV1) GetInfo

func (c CoinV1) GetInfo() []byte

GetInfo returns the info of a CoinV1.

func (CoinV1) GetKeyImage

func (c CoinV1) GetKeyImage() *crypto.Point

GetKeyImage returns the serial number of a CoinV1.

func (CoinV1) GetPublicKey

func (c CoinV1) GetPublicKey() *crypto.Point

GetPublicKey returns the public key of a CoinV1. For a CoinV1, its public key is the public key of the owner.

func (CoinV1) GetRandomness

func (c CoinV1) GetRandomness() *crypto.Scalar

GetRandomness returns the randomness of a CoinV1.

func (CoinV1) GetSNDerivator

func (c CoinV1) GetSNDerivator() *crypto.Scalar

GetSNDerivator returns the serial number derivator of a CoinV1.

func (CoinV1) GetShardID

func (c CoinV1) GetShardID() (uint8, error)

GetShardID returns the shardID in which a CoinV1 belongs to.

func (CoinV1) GetSharedConcealRandom

func (c CoinV1) GetSharedConcealRandom() *crypto.Scalar

GetSharedConcealRandom returns the shared random when concealing of a CoinV1. For a CoinV1, this value is nil.

func (CoinV1) GetSharedRandom

func (c CoinV1) GetSharedRandom() *crypto.Scalar

GetSharedRandom returns the shared random of a CoinV1. For a CoinV1, this value is nil.

func (CoinV1) GetTxRandom

func (c CoinV1) GetTxRandom() *TxRandom

GetTxRandom returns the transaction randomness of a CoinV1. For a CoinV1, this value is nil.

func (CoinV1) GetValue

func (c CoinV1) GetValue() uint64

GetValue returns the value of a CoinV1.

func (CoinV1) GetVersion

func (c CoinV1) GetVersion() uint8

GetVersion returns the version of a CoinV1.

func (*CoinV1) Init

func (c *CoinV1) Init() *CoinV1

Init initializes a new CoinV1.

func (CoinV1) IsEncrypted

func (c CoinV1) IsEncrypted() bool

IsEncrypted checks if whether a CoinV1 is encrypted.

func (CoinV1) MarshalJSON

func (c CoinV1) MarshalJSON() ([]byte, error)

MarshalJSON converts coin to a byte-array.

func (*CoinV1) SetBytes

func (c *CoinV1) SetBytes(bytes []byte) error

SetBytes parses a slice of bytes into a CoinV1.

func (CoinV1) SetValue

func (c CoinV1) SetValue(v uint64)

SetValue sets v as the value of a CoinV1.

func (*CoinV1) UnmarshalJSON

func (c *CoinV1) UnmarshalJSON(data []byte) error

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

func NewCoinCA(paymentInfo *key.PaymentInfo, tokenID *common.Hash) (*CoinV2, *crypto.Point, error)

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

func (c CoinV2) Bytes() []byte

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

func (c *CoinV2) ComputeCommitmentCA() (*crypto.Point, error)

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

func (c *CoinV2) ConcealOutputCoin(additionalData interface{}) error

ConcealOutputCoin conceals the amount of coin using the publicView of the receiver

  • AdditionalData: must be the publicView of the receiver.

func (*CoinV2) Decrypt

func (c *CoinV2) Decrypt(keySet *key.KeySet) (PlainCoin, error)

Decrypt decrypts a CoinV2 into a PlainCoin using the given key set.

func (*CoinV2) DoesCoinBelongToKeySet

func (c *CoinV2) DoesCoinBelongToKeySet(keySet *key.KeySet) (bool, *crypto.Point)

DoesCoinBelongToKeySet checks if a CoinV2 belongs to the given key set.

func (CoinV2) GetAmount

func (c CoinV2) GetAmount() *crypto.Scalar

func (CoinV2) GetAssetTag

func (c CoinV2) GetAssetTag() *crypto.Point

GetAssetTag returns the asset tag of a CoinV2. For a PRV CoinV2, this value is nil.

func (CoinV2) GetCoinDetailEncrypted

func (c CoinV2) GetCoinDetailEncrypted() []byte

GetCoinDetailEncrypted returns the encrypted detail of a CoinV2.

func (CoinV2) GetCommitment

func (c CoinV2) GetCommitment() *crypto.Point

GetCommitment returns the commitment of a CoinV2.

func (CoinV2) GetInfo

func (c CoinV2) GetInfo() []byte

GetInfo returns the info of a CoinV2.

func (CoinV2) GetKeyImage

func (c CoinV2) GetKeyImage() *crypto.Point

GetKeyImage returns the key image of a CoinV2.

func (CoinV2) GetPublicKey

func (c CoinV2) GetPublicKey() *crypto.Point

GetPublicKey returns the public key of a CoinV2.

func (CoinV2) GetRandomness

func (c CoinV2) GetRandomness() *crypto.Scalar

GetRandomness returns the randomness of a CoinV2.

func (CoinV2) GetSNDerivator

func (c CoinV2) GetSNDerivator() *crypto.Scalar

GetSNDerivator returns the serial number derivator of a CoinV2. For a CoinV2, this value is always nil.

func (CoinV2) GetShardID

func (c CoinV2) GetShardID() (uint8, error)

GetShardID returns the shardID in which a CoinV2 belongs to.

func (CoinV2) GetSharedConcealRandom

func (c CoinV2) GetSharedConcealRandom() *crypto.Scalar

GetSharedConcealRandom returns the shared random when concealing of a CoinV2.

func (CoinV2) GetSharedRandom

func (c CoinV2) GetSharedRandom() *crypto.Scalar

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

func (c CoinV2) GetTxRandom() *TxRandom

GetTxRandom returns the transaction randomness of a CoinV2.

func (CoinV2) GetTxRandomDetail

func (c CoinV2) GetTxRandomDetail() (*crypto.Point, *crypto.Point, uint32, error)

GetTxRandomDetail returns the transaction randomness detail of a CoinV2.

func (CoinV2) GetValue

func (c CoinV2) GetValue() uint64

GetValue returns the value of a CoinV2.

func (CoinV2) GetVersion

func (c CoinV2) GetVersion() uint8

GetVersion returns the version of a CoinV2.

func (*CoinV2) HashH

func (c *CoinV2) HashH() *common.Hash

HashH returns the SHA3-256 hashing of coin bytes array

func (*CoinV2) Init

func (c *CoinV2) Init() *CoinV2

Init (OutputCoin) initializes a output coin

func (CoinV2) IsEncrypted

func (c CoinV2) IsEncrypted() bool

IsEncrypted checks if whether a CoinV2 is encrypted.

func (CoinV2) MarshalJSON

func (c CoinV2) MarshalJSON() ([]byte, error)

MarshalJSON converts coin to a byte-array.

func (CoinV2) ParseKeyImageWithPrivateKey

func (c CoinV2) ParseKeyImageWithPrivateKey(privateKey key.PrivateKey) (*crypto.Point, error)

ParseKeyImageWithPrivateKey derives the key image of a CoinV2 from its private key.

func (CoinV2) ParsePrivateKeyOfCoin

func (c CoinV2) ParsePrivateKeyOfCoin(privateKey key.PrivateKey) (*crypto.Scalar, error)

ParsePrivateKeyOfCoin sets privateKey as the private key of a CoinV2.

func (*CoinV2) RecomputeSharedSecret

func (c *CoinV2) RecomputeSharedSecret(privateKey []byte) (*crypto.Point, error)

RecomputeSharedSecret uses the privateKey to re-compute the shared OTA secret of a CoinV2.

func (*CoinV2) SetAmount

func (c *CoinV2) SetAmount(v *crypto.Scalar)

SetAmount sets v as the amount of a CoinV2.

func (*CoinV2) SetAssetTag

func (c *CoinV2) SetAssetTag(v *crypto.Point)

SetAssetTag sets v as the asset tag of a CoinV2.

func (*CoinV2) SetBytes

func (c *CoinV2) SetBytes(coinBytes []byte) error

SetBytes parses a slice of bytes into a CoinV2.

func (*CoinV2) SetCommitment

func (c *CoinV2) SetCommitment(v *crypto.Point)

SetCommitment sets v as the randomness of a CoinV2.

func (*CoinV2) SetInfo

func (c *CoinV2) SetInfo(b []byte)

SetInfo sets v as the info of a CoinV2.

func (*CoinV2) SetKeyImage

func (c *CoinV2) SetKeyImage(keyImage *crypto.Point)

SetKeyImage sets v as the key-image (a.k.a serial number) of a CoinV2.

func (*CoinV2) SetPlainTokenID

func (c *CoinV2) SetPlainTokenID(tokenID *common.Hash) error

SetPlainTokenID sets the given tokenID as the tokenID of a CoinV2 (in raw value, not blinded).

func (*CoinV2) SetPublicKey

func (c *CoinV2) SetPublicKey(v *crypto.Point)

SetPublicKey sets v as the public key of a CoinV2. Each CoinV2 of a user will now have different public keys.

func (*CoinV2) SetRandomness

func (c *CoinV2) SetRandomness(v *crypto.Scalar)

SetRandomness sets v as the randomness of a CoinV2.

func (*CoinV2) SetSharedConcealRandom

func (c *CoinV2) SetSharedConcealRandom(v *crypto.Scalar)

SetSharedConcealRandom sets v as the shared conceal random of a CoinV2.

func (*CoinV2) SetSharedRandom

func (c *CoinV2) SetSharedRandom(v *crypto.Scalar)

SetSharedRandom sets v as the OTA shared random of a CoinV2.

func (*CoinV2) SetTxRandom

func (c *CoinV2) SetTxRandom(v *TxRandom)

SetTxRandom sets v as the TxRandom of a CoinV2.

func (*CoinV2) SetTxRandomDetail

func (c *CoinV2) SetTxRandomDetail(txConcealRandomPoint, txRandomPoint *crypto.Point, index uint32)

SetTxRandomDetail creates the TxRandom of a CoinV2 based on the three provided parameters.

func (*CoinV2) SetValue

func (c *CoinV2) SetValue(value uint64)

SetValue sets v as the value of a CoinV2.

func (*CoinV2) SetVersion

func (c *CoinV2) SetVersion(uint8)

SetVersion sets the version of a CoinV2 to 2.

func (*CoinV2) UnmarshalJSON

func (c *CoinV2) UnmarshalJSON(data []byte) error

UnmarshalJSON converts a slice of bytes (was Marshalled before) into a CoinV2 objects.

func (*CoinV2) ValidateAssetTag

func (c *CoinV2) ValidateAssetTag(sharedSecret *crypto.Point, tokenID *common.Hash) (bool, error)

ValidateAssetTag checks if the asset tag of a CoinV2 is valid for the given shared secret and tokenID.

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
	GetSharedRandom() *crypto.Scalar
	GetSharedConcealRandom() *crypto.Scalar
	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

func NewPlainCoinFromByte(b []byte) (PlainCoin, error)

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

func (pc *PlainCoinV1) DoesCoinBelongToKeySet(keySet *key.KeySet) (bool, *crypto.Point)

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 NewTxRandom

func NewTxRandom() *TxRandom

NewTxRandom initializes a new TxRandom.

func (TxRandom) Bytes

func (t TxRandom) Bytes() []byte

Bytes converts a TxRandom into a slice of bytes.

func (TxRandom) GetIndex

func (t TxRandom) GetIndex() (uint32, error)

GetIndex returns the index of a TxRandom.

func (TxRandom) GetTxConcealRandomPoint

func (t TxRandom) GetTxConcealRandomPoint() (*crypto.Point, error)

GetTxConcealRandomPoint returns the conceal random point of a TxRandom.

func (TxRandom) GetTxOTARandomPoint

func (t TxRandom) GetTxOTARandomPoint() (*crypto.Point, error)

GetTxOTARandomPoint returns the OTA random point of a TxRandom.

func (*TxRandom) SetBytes

func (t *TxRandom) SetBytes(v []byte) error

SetBytes sets the content of a slice of bytes b to a TxRandom.

func (*TxRandom) SetIndex

func (t *TxRandom) SetIndex(v uint32)

SetIndex sets v as the index of a TxRandom.

func (*TxRandom) SetTxConcealRandomPoint

func (t *TxRandom) SetTxConcealRandomPoint(v *crypto.Point)

SetTxConcealRandomPoint sets v as the conceal random point of a TxRandom.

func (*TxRandom) SetTxOTARandomPoint

func (t *TxRandom) SetTxOTARandomPoint(v *crypto.Point)

SetTxOTARandomPoint sets v as the OTA random point of a TxRandom.

Jump to

Keyboard shortcuts

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