zkp

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: 21 Imported by: 0

Documentation

Index

Constants

View Source
const FixedRandomnessString = "fixedrandomness"

Variables

View Source
var FixedRandomnessShardID = new(operation.Scalar).FromBytesS([]byte{0x60, 0xa2, 0xab, 0x35, 0x26, 0x9, 0x97, 0x7c, 0x6b, 0xe1, 0xba, 0xec, 0xbf, 0x64, 0x27, 0x2, 0x6a, 0x9c, 0xe8, 0x10, 0x9e, 0x93, 0x4a, 0x0, 0x47, 0x83, 0x15, 0x48, 0x63, 0xeb, 0xda, 0x6})

FixedRandomnessShardID is fixed randomness for shardID commitment from param.BCHeightBreakPointFixRandShardCM is result from HashToScalar([]byte(privacy.FixedRandomnessString))

View Source
var Logger = PaymentV1Logger{}

Global instant to use

Functions

func GetFixedRandomnessShardID

func GetFixedRandomnessShardID() operation.Scalar

func InitCheckpoint

func InitCheckpoint(
	bcHeightNewZKP uint64,
) error

func IsNewOneOfManyProof

func IsNewOneOfManyProof(lockTime int64) bool

func IsNewZKP

func IsNewZKP(bcHeight uint64) bool

Types

type PaymentProof

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

PaymentProof contains all of PoK for spending coin

func (PaymentProof) Bytes

func (proof PaymentProof) Bytes() []byte

func (*PaymentProof) CheckCommitmentWithStateDB

func (proof *PaymentProof) CheckCommitmentWithStateDB(commitmentsList [][]byte, db *statedb.StateDB, tokenID *common.Hash, shardID byte) error

func (PaymentProof) GetAggregatedRangeProof

func (proof PaymentProof) GetAggregatedRangeProof() agg_interface.AggregatedRangeProof

func (PaymentProof) GetCommitmentIndices

func (proof PaymentProof) GetCommitmentIndices() []uint64

func (PaymentProof) GetCommitmentInputSND

func (proof PaymentProof) GetCommitmentInputSND() []*operation.Point

func (PaymentProof) GetCommitmentInputSecretKey

func (proof PaymentProof) GetCommitmentInputSecretKey() *operation.Point

func (PaymentProof) GetCommitmentInputShardID

func (proof PaymentProof) GetCommitmentInputShardID() *operation.Point

func (PaymentProof) GetCommitmentInputValue

func (proof PaymentProof) GetCommitmentInputValue() []*operation.Point

func (PaymentProof) GetCommitmentOutputSND

func (proof PaymentProof) GetCommitmentOutputSND() []*operation.Point

func (PaymentProof) GetCommitmentOutputShardID

func (proof PaymentProof) GetCommitmentOutputShardID() []*operation.Point

func (PaymentProof) GetCommitmentOutputValue

func (proof PaymentProof) GetCommitmentOutputValue() []*operation.Point

func (PaymentProof) GetInputCoins

func (proof PaymentProof) GetInputCoins() []coin.PlainCoin

func (PaymentProof) GetOneOfManyProof

func (proof PaymentProof) GetOneOfManyProof() []*oneoutofmany.OneOutOfManyProof

GET/SET function

func (PaymentProof) GetOutputCoins

func (proof PaymentProof) GetOutputCoins() []coin.Coin

func (PaymentProof) GetSerialNumberNoPrivacyProof

func (proof PaymentProof) GetSerialNumberNoPrivacyProof() []*serialnumbernoprivacy.SNNoPrivacyProof

func (PaymentProof) GetSerialNumberProof

func (proof PaymentProof) GetSerialNumberProof() []*serialnumberprivacy.SNPrivacyProof

func (*PaymentProof) GetVersion

func (proof *PaymentProof) GetVersion() uint8

func (*PaymentProof) Init

func (proof *PaymentProof) Init()

Init

func (*PaymentProof) IsPrivacy

func (proof *PaymentProof) IsPrivacy() bool

func (*PaymentProof) LoadCommitmentFromStateDB

func (proof *PaymentProof) LoadCommitmentFromStateDB(db *statedb.StateDB, tokenID *common.Hash, shardID byte) error

func (*PaymentProof) LoadDataFromStateDB

func (proof *PaymentProof) LoadDataFromStateDB(db *statedb.StateDB, tokenID *common.Hash, shardID byte) ([][]byte, error)

func (PaymentProof) MarshalJSON

func (proof PaymentProof) MarshalJSON() ([]byte, error)

func (*PaymentProof) SetAggregatedRangeProof

func (proof *PaymentProof) SetAggregatedRangeProof(aggregatedRangeProof *aggregatedrange.AggregatedRangeProof)

func (*PaymentProof) SetBytes

func (proof *PaymentProof) SetBytes(proofbytes []byte) *errhandler.PrivacyError

func (*PaymentProof) SetCommitment

func (proof *PaymentProof) SetCommitment(commitmentsList [][]byte, tokenID *common.Hash, shardID byte) error

func (*PaymentProof) SetCommitmentInputSND

func (proof *PaymentProof) SetCommitmentInputSND(commitmentInputSND []*operation.Point)

func (*PaymentProof) SetCommitmentInputValue

func (proof *PaymentProof) SetCommitmentInputValue(commitmentInputValue []*operation.Point)

func (*PaymentProof) SetCommitmentShardID

func (proof *PaymentProof) SetCommitmentShardID(commitmentShardID *operation.Point)

func (*PaymentProof) SetInputCoins

func (proof *PaymentProof) SetInputCoins(v []coin.PlainCoin) error

func (*PaymentProof) SetOneOfManyProof

func (proof *PaymentProof) SetOneOfManyProof(oneOfManyProof []*oneoutofmany.OneOutOfManyProof)

func (*PaymentProof) SetOutputCoins

func (proof *PaymentProof) SetOutputCoins(v []coin.Coin) error

SetOutputCoins's input should be all coinv1

func (*PaymentProof) SetSerialNumberNoPrivacyProof

func (proof *PaymentProof) SetSerialNumberNoPrivacyProof(serialNumberNoPrivacyProof []*serialnumbernoprivacy.SNNoPrivacyProof)

func (*PaymentProof) SetSerialNumberProof

func (proof *PaymentProof) SetSerialNumberProof(serialNumberProof []*serialnumberprivacy.SNPrivacyProof)

func (*PaymentProof) UnmarshalJSON

func (proof *PaymentProof) UnmarshalJSON(data []byte) error

func (PaymentProof) ValidateSanity

func (proof PaymentProof) ValidateSanity(vEnv env.ValidationEnviroment) (bool, error)

func (PaymentProof) Verify

func (proof PaymentProof) Verify(boolParams map[string]bool, pubKey key.PublicKey, fee uint64, shardID byte, tokenID *common.Hash, additionalData interface{}) (bool, error)

func (PaymentProof) VerifySanityData

func (proof PaymentProof) VerifySanityData(
	vEnv env.ValidationEnviroment,
) (
	bool,
	error,
)

Validate all of conditions

func (PaymentProof) VerifyV2

func (proof PaymentProof) VerifyV2(
	vEnv env.ValidationEnviroment,
	fee uint64,
) (
	bool,
	error,
)

type PaymentV1Logger

type PaymentV1Logger struct {
	Log common.Logger
}

func (*PaymentV1Logger) Init

func (logger *PaymentV1Logger) Init(inst common.Logger)

type PaymentWitness

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

PaymentWitness contains all of witness for proving when spending coins

func (PaymentWitness) GetRandSecretKey

func (paymentWitness PaymentWitness) GetRandSecretKey() *operation.Scalar

func (*PaymentWitness) Init

func (wit *PaymentWitness) Init(PaymentWitnessParam PaymentWitnessParam) *errhandler.PrivacyError

Build prepares witnesses for all protocol need to be proved when create tx if hashPrivacy = false, witness includes spending key, input coins, output coins otherwise, witness includes all attributes in PaymentWitness struct

func (*PaymentWitness) Prove

func (wit *PaymentWitness) Prove(hasPrivacy bool, paymentInfo []*key.PaymentInfo) (*PaymentProof, *errhandler.PrivacyError)

Prove creates big proof

type PaymentWitnessParam

type PaymentWitnessParam struct {
	HasPrivacy              bool
	PrivateKey              *operation.Scalar
	InputCoins              []coin.PlainCoin
	OutputCoins             []*coin.CoinV1
	PublicKeyLastByteSender byte
	Commitments             []*operation.Point
	CommitmentIndices       []uint64
	MyCommitmentIndices     []uint64
	Fee                     uint64
}

Jump to

Keyboard shortcuts

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