Documentation ¶
Index ¶
- Constants
- Variables
- type ConversionProofVer1ToVer2
- func (proof ConversionProofVer1ToVer2) Bytes() []byte
- func (proof ConversionProofVer1ToVer2) GetAggregatedRangeProof() agg_interface.AggregatedRangeProof
- func (proof ConversionProofVer1ToVer2) GetInputCoins() []coin.PlainCoin
- func (proof ConversionProofVer1ToVer2) GetOutputCoins() []coin.Coin
- func (proof ConversionProofVer1ToVer2) GetVersion() uint8
- func (proof *ConversionProofVer1ToVer2) Init()
- func (proof *ConversionProofVer1ToVer2) IsPrivacy() bool
- func (proof ConversionProofVer1ToVer2) MarshalJSON() ([]byte, error)
- func (proof *ConversionProofVer1ToVer2) SetBytes(proofBytes []byte) *errhandler.PrivacyError
- func (proof *ConversionProofVer1ToVer2) SetInputCoins(v []coin.PlainCoin) error
- func (proof *ConversionProofVer1ToVer2) SetOutputCoins(v []coin.Coin) error
- func (proof *ConversionProofVer1ToVer2) SetVersion(uint8)
- func (proof *ConversionProofVer1ToVer2) UnmarshalJSON(data []byte) error
- func (proof *ConversionProofVer1ToVer2) ValidateSanity(vEnv env.ValidationEnviroment) (bool, error)
- func (proof ConversionProofVer1ToVer2) Verify(boolParams map[string]bool, pubKey key.PublicKey, fee uint64, shardID byte, ...) (bool, error)
- func (proof ConversionProofVer1ToVer2) VerifyV2(vEnv env.ValidationEnviroment, fee uint64) (bool, error)
- type PaymentProofV2
- func (proof PaymentProofV2) Bytes() []byte
- func (proof PaymentProofV2) GetAggregatedRangeProof() agg_interface.AggregatedRangeProof
- func (proof PaymentProofV2) GetInputCoins() []coin.PlainCoin
- func (proof PaymentProofV2) GetOutputCoins() []coin.Coin
- func (proof *PaymentProofV2) GetVersion() uint8
- func (proof *PaymentProofV2) Init()
- func (proof *PaymentProofV2) IsConfidentialAsset() (bool, error)
- func (proof *PaymentProofV2) IsPrivacy() bool
- func (proof PaymentProofV2) MarshalJSON() ([]byte, error)
- func (proof *PaymentProofV2) SetAggregatedRangeProof(aggregatedRangeProof *bulletproofs.AggregatedRangeProof)
- func (proof *PaymentProofV2) SetBytes(proofbytes []byte) *errhandler.PrivacyError
- func (proof *PaymentProofV2) SetInputCoins(v []coin.PlainCoin) error
- func (proof *PaymentProofV2) SetOutputCoins(v []coin.Coin) error
- func (proof *PaymentProofV2) SetOutputCoinsV2(v []*coin.CoinV2) error
- func (proof *PaymentProofV2) SetVersion()
- func (proof *PaymentProofV2) UnmarshalJSON(data []byte) error
- func (proof PaymentProofV2) ValidateSanity(vEnv env.ValidationEnviroment) (bool, error)
- func (proof PaymentProofV2) Verify(boolParams map[string]bool, _ key.PublicKey, _ uint64, _ byte, _ *common.Hash, ...) (bool, error)
- func (proof PaymentProofV2) VerifyV2(vEnv env.ValidationEnviroment, fee uint64) (bool, error)
- type PaymentV2Logger
Constants ¶
const (
ConversionProofVersion = 255
)
Variables ¶
var Logger = PaymentV2Logger{}
Global instant to use
Functions ¶
This section is empty.
Types ¶
type ConversionProofVer1ToVer2 ¶
type ConversionProofVer1ToVer2 struct { Version uint8 // contains filtered or unexported fields }
For conversion proof, its version will be counted down from 255 -> 0 It should contain inputCoins of v1 and outputCoins of v2 because it convert v1 to v2
func ProveConversion ¶
func ProveConversion(inputCoins []coin.PlainCoin, outputCoins []*coin.CoinV2, serialnumberWitness []*serialnumbernoprivacy.SNNoPrivacyWitness) (*ConversionProofVer1ToVer2, error)
func (ConversionProofVer1ToVer2) Bytes ¶
func (proof ConversionProofVer1ToVer2) Bytes() []byte
func (ConversionProofVer1ToVer2) GetAggregatedRangeProof ¶
func (proof ConversionProofVer1ToVer2) GetAggregatedRangeProof() agg_interface.AggregatedRangeProof
Conversion does not have range proof, everything is nonPrivacy
func (ConversionProofVer1ToVer2) GetInputCoins ¶
func (proof ConversionProofVer1ToVer2) GetInputCoins() []coin.PlainCoin
func (ConversionProofVer1ToVer2) GetOutputCoins ¶
func (proof ConversionProofVer1ToVer2) GetOutputCoins() []coin.Coin
func (ConversionProofVer1ToVer2) GetVersion ¶
func (proof ConversionProofVer1ToVer2) GetVersion() uint8
func (*ConversionProofVer1ToVer2) Init ¶
func (proof *ConversionProofVer1ToVer2) Init()
func (*ConversionProofVer1ToVer2) IsPrivacy ¶
func (proof *ConversionProofVer1ToVer2) IsPrivacy() bool
func (ConversionProofVer1ToVer2) MarshalJSON ¶
func (proof ConversionProofVer1ToVer2) MarshalJSON() ([]byte, error)
func (*ConversionProofVer1ToVer2) SetBytes ¶
func (proof *ConversionProofVer1ToVer2) SetBytes(proofBytes []byte) *errhandler.PrivacyError
func (*ConversionProofVer1ToVer2) SetInputCoins ¶
func (proof *ConversionProofVer1ToVer2) SetInputCoins(v []coin.PlainCoin) error
InputCoins should be all ver1, else it would crash
func (*ConversionProofVer1ToVer2) SetOutputCoins ¶
func (proof *ConversionProofVer1ToVer2) SetOutputCoins(v []coin.Coin) error
v should be all coinv2 or else it would crash
func (*ConversionProofVer1ToVer2) SetVersion ¶
func (proof *ConversionProofVer1ToVer2) SetVersion(uint8)
func (*ConversionProofVer1ToVer2) UnmarshalJSON ¶
func (proof *ConversionProofVer1ToVer2) UnmarshalJSON(data []byte) error
func (*ConversionProofVer1ToVer2) ValidateSanity ¶
func (proof *ConversionProofVer1ToVer2) ValidateSanity(vEnv env.ValidationEnviroment) (bool, error)
func (ConversionProofVer1ToVer2) VerifyV2 ¶
func (proof ConversionProofVer1ToVer2) VerifyV2(vEnv env.ValidationEnviroment, fee uint64) (bool, error)
type PaymentProofV2 ¶
type PaymentProofV2 struct { Version uint8 // contains filtered or unexported fields }
PaymentProofV2 contains the input & output coins, along with the Bulletproofs for output coin range. This is what shows up in a transaction's Proof field.
func Prove ¶
func Prove(inputCoins []coin.PlainCoin, outputCoins []*coin.CoinV2, sharedSecrets []*operation.Point, hasConfidentialAsset bool, paymentInfo []*key.PaymentInfo) (*PaymentProofV2, error)
Prove returns the payment proof object. It generates Bulletproofs for output commitments, then conceals sensitive information in the coins. The parameter hasConfidentialAsset will determine the type of Bulletproof prover to use.
func (PaymentProofV2) Bytes ¶
func (proof PaymentProofV2) Bytes() []byte
Bytes does byte serialization for this payment proof
func (PaymentProofV2) GetAggregatedRangeProof ¶
func (proof PaymentProofV2) GetAggregatedRangeProof() agg_interface.AggregatedRangeProof
GetAggregatedRangeProof returns the Bulletproof in this, but as a generic range proof object.
func (PaymentProofV2) GetInputCoins ¶
func (proof PaymentProofV2) GetInputCoins() []coin.PlainCoin
GetInputCoins is the getter for input coins.
func (PaymentProofV2) GetOutputCoins ¶
func (proof PaymentProofV2) GetOutputCoins() []coin.Coin
GetOutputCoins is the getter for output coins.
func (*PaymentProofV2) GetVersion ¶
func (proof *PaymentProofV2) GetVersion() uint8
func (*PaymentProofV2) Init ¶
func (proof *PaymentProofV2) Init()
Init allocates and zeroes all fields in this proof.
func (*PaymentProofV2) IsConfidentialAsset ¶
func (proof *PaymentProofV2) IsConfidentialAsset() (bool, error)
IsConfidentialAsset returns true if this is a Confidential Asset transaction (all coins in it must have asset tag field). An error means the proof is simply invalid. After this function returns, check the error first.
func (*PaymentProofV2) IsPrivacy ¶
func (proof *PaymentProofV2) IsPrivacy() bool
IsPrivacy is a helper that returns true when an output is encrypted, which means the transaction is of "privacy" type. It says nothing about the validity of this proof.
This is not a tight classifier between "privacy" and "non-privacy", and should not be called before sanity check.
func (PaymentProofV2) MarshalJSON ¶
func (proof PaymentProofV2) MarshalJSON() ([]byte, error)
MarshalJSON implements JSON Marshaller
func (*PaymentProofV2) SetAggregatedRangeProof ¶
func (proof *PaymentProofV2) SetAggregatedRangeProof(aggregatedRangeProof *bulletproofs.AggregatedRangeProof)
func (*PaymentProofV2) SetBytes ¶
func (proof *PaymentProofV2) SetBytes(proofbytes []byte) *errhandler.PrivacyError
SetBytes does byte deserialization for this payment proof
func (*PaymentProofV2) SetInputCoins ¶
func (proof *PaymentProofV2) SetInputCoins(v []coin.PlainCoin) error
func (*PaymentProofV2) SetOutputCoins ¶
func (proof *PaymentProofV2) SetOutputCoins(v []coin.Coin) error
v should be all coinv2 or else it would crash
func (*PaymentProofV2) SetOutputCoinsV2 ¶
func (proof *PaymentProofV2) SetOutputCoinsV2(v []*coin.CoinV2) error
func (*PaymentProofV2) SetVersion ¶
func (proof *PaymentProofV2) SetVersion()
func (*PaymentProofV2) UnmarshalJSON ¶
func (proof *PaymentProofV2) UnmarshalJSON(data []byte) error
UnmarshalJSON implements JSON Unmarshaller
func (PaymentProofV2) ValidateSanity ¶
func (proof PaymentProofV2) ValidateSanity(vEnv env.ValidationEnviroment) (bool, error)
ValidateSanity performs sanity check for this proof. The input parameter is ingored.
func (PaymentProofV2) Verify ¶
func (proof PaymentProofV2) Verify(boolParams map[string]bool, _ key.PublicKey, _ uint64, _ byte, _ *common.Hash, _ interface{}) (bool, error)
Verify performs verification on this payment proof. It verifies the Bulletproof inside & checks for duplicates among outputs. It works with Bulletproof batching (in which case it skips that verification, since that is handled in batchTransaction struct).
func (PaymentProofV2) VerifyV2 ¶
func (proof PaymentProofV2) VerifyV2(vEnv env.ValidationEnviroment, fee uint64) (bool, error)
type PaymentV2Logger ¶
func (*PaymentV2Logger) Init ¶
func (logger *PaymentV2Logger) Init(inst common.Logger)
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package bulletproofs manages the creation, proving & verification of Bulletproofs.
|
Package bulletproofs manages the creation, proving & verification of Bulletproofs. |
v1
Package bulletproofs manages the creation, proving & verification of Bulletproofs.
|
Package bulletproofs manages the creation, proving & verification of Bulletproofs. |
variable names to match names in the crypto protocol Package mlsag contains the implementation of MLSAG, a ring signature scheme.
|
variable names to match names in the crypto protocol Package mlsag contains the implementation of MLSAG, a ring signature scheme. |