Documentation ¶
Overview ¶
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
Index ¶
- type IssueAction
- func (i *IssueAction) Deserialize(raw []byte) error
- func (i *IssueAction) GetCommitments() ([]*math.G1, error)
- func (i *IssueAction) GetIssuer() []byte
- func (i *IssueAction) GetMetadata() map[string][]byte
- func (i *IssueAction) GetOutputs() []driver.Output
- func (i *IssueAction) GetProof() []byte
- func (i *IssueAction) GetSerializedOutputs() ([][]byte, error)
- func (i *IssueAction) IsAnonymous() bool
- func (i *IssueAction) NumOutputs() int
- func (i *IssueAction) Serialize() ([]byte, error)
- type Issuer
- type Proof
- type Prover
- type Verifier
- type WellFormedness
- type WellFormednessProver
- type WellFormednessRandomness
- type WellFormednessVerifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IssueAction ¶
type IssueAction struct { // Identity of issuer Issuer []byte // OutputTokens are the newly issued tokens OutputTokens []*token.Token `protobuf:"bytes,1,rep,name=outputs,proto3" json:"outputs,omitempty"` // Proof carries the ZKP of IssueAction validity Proof []byte // flag to indicate whether the Issuer is anonymous or not Anonymous bool // Metadata of the issue action Metadata map[string][]byte }
IssueAction specifies an issue of one or more tokens
func NewIssue ¶
func NewIssue(issuer []byte, coms []*math.G1, owners [][]byte, proof []byte, anonymous bool) (*IssueAction, error)
NewIssue instantiates an IssueAction given the passed arguments
func (*IssueAction) Deserialize ¶
func (i *IssueAction) Deserialize(raw []byte) error
Deserialize un-marshals IssueAction
func (*IssueAction) GetCommitments ¶
func (i *IssueAction) GetCommitments() ([]*math.G1, error)
GetCommitments return the Pedersen commitment of (type, value) in the OutputTokens
func (*IssueAction) GetIssuer ¶
func (i *IssueAction) GetIssuer() []byte
GetIssuer returns the Issuer of IssueAction
func (*IssueAction) GetMetadata ¶
func (i *IssueAction) GetMetadata() map[string][]byte
GetMetadata returns IssueAction metadata if there is any.
func (*IssueAction) GetOutputs ¶
func (i *IssueAction) GetOutputs() []driver.Output
GetOutputs returns the OutputTokens in IssueAction
func (*IssueAction) GetProof ¶
func (i *IssueAction) GetProof() []byte
GetProof returns IssueAction ZKP
func (*IssueAction) GetSerializedOutputs ¶
func (i *IssueAction) GetSerializedOutputs() ([][]byte, error)
GetSerializedOutputs returns the serialization of OutputTokens
func (*IssueAction) IsAnonymous ¶
func (i *IssueAction) IsAnonymous() bool
IsAnonymous returns a Boolean. True if IssueAction is anonymous, and False otherwise.
func (*IssueAction) NumOutputs ¶
func (i *IssueAction) NumOutputs() int
NumOutputs returns the number of outputs in IssueAction
func (*IssueAction) Serialize ¶
func (i *IssueAction) Serialize() ([]byte, error)
Serialize marshal IssueAction
type Issuer ¶
type Issuer interface { GenerateZKIssue(values []uint64, owners [][]byte) (*IssueAction, []*token.Metadata, error) SignTokenActions(raw []byte, txID string) ([]byte, error) New(ttype string, signer common.SigningIdentity, pp *crypto.PublicParams) }
type Proof ¶
type Proof struct { // proof that issued tokens are well-formed // tokens contain a commitment to type and value WellFormedness []byte // proof that issued tokens have value in the authorized range RangeCorrectness []byte }
Proof poves that an IssueAction is valid
func (*Proof) Deserialize ¶
Deserialize unmarshals Proof
type Prover ¶
type Prover struct { // WellFormedness encodes the WellFormedness Prover WellFormedness *WellFormednessProver // RangeCorrectness encodes the range proof Prover RangeCorrectness *rp.Prover }
Prover produces a proof of validity of an IssueAction
func NewProver ¶
func NewProver(tw []*token.TokenDataWitness, tokens []*math.G1, anonymous bool, pp *crypto.PublicParams) *Prover
type Verifier ¶
type Verifier struct { // WellFormedness encodes the WellFormedness Verifier WellFormedness *WellFormednessVerifier // RangeCorrectness encodes the range proof verifier RangeCorrectness *rp.Verifier }
Verifier checks if Proof is valid
func NewVerifier ¶
type WellFormedness ¶
type WellFormedness struct { // Proof of type Type *math.Zr // Proof of values of tokens to be issued // i^th proof for the value of the i^th token Values []*math.Zr // Proof of randomness used to compute the commitment to type and value in the issued tokens // i^th proof is for the randomness used to compute the i^th token BlindingFactors []*math.Zr // only when issue is not anonymous TypeInTheClear string // Challenge computed using the Fiat-Shamir Heuristic Challenge *math.Zr }
WellFormedness shows that issued tokens contains Pedersen commitments to (type, value) WellFormedness also shows that all the issued tokens contain the same type
func (*WellFormedness) Deserialize ¶
func (wf *WellFormedness) Deserialize(bytes []byte) error
Deserialize un-marshals WellFormedness proof
func (*WellFormedness) Serialize ¶
func (wf *WellFormedness) Serialize() ([]byte, error)
Serialize marshals WellFormedness proof
type WellFormednessProver ¶
type WellFormednessProver struct { *WellFormednessVerifier // Commitments is the commitment to the randomness used to generate the proof Commitments []*math.G1 // contains filtered or unexported fields }
WellFormednessProver contains information that allows an Issuer to prove that issued tokens are well formed
func NewWellFormednessProver ¶
func NewWellFormednessProver(witness []*token.TokenDataWitness, tokens []*math.G1, anonymous bool, pp []*math.G1, c *math.Curve) *WellFormednessProver
NewWellFormednessProver returns a WellFormednessProver for the passed parameters
func (*WellFormednessProver) Prove ¶
func (p *WellFormednessProver) Prove() ([]byte, error)
Prove returns a serialized wellformedness proof
type WellFormednessRandomness ¶
type WellFormednessRandomness struct {
// contains filtered or unexported fields
}
WellFormednessRandomness is the randomness used to generate the well-formedness proof
type WellFormednessVerifier ¶
type WellFormednessVerifier struct { PedParams []*math.G1 Curve *math.Curve Tokens []*math.G1 // Anonymous indicates if the issuance is anonymous Anonymous bool }
WellFormednessVerifier checks the validity of WellFormedness proof
func NewWellFormednessVerifier ¶
func NewWellFormednessVerifier(tokens []*math.G1, anonymous bool, pp []*math.G1, c *math.Curve) *WellFormednessVerifier
NewWellFormednessVerifier returns a WellFormednessVerifier corresponding to the passed parameters
func (*WellFormednessVerifier) Verify ¶
func (v *WellFormednessVerifier) Verify(proof []byte) error
Verify returns an error if the serialized proof is an invalid WellFormedness proof