Documentation
¶
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) IsGraphHiding() bool
- func (i *IssueAction) NumOutputs() int
- func (i *IssueAction) Serialize() ([]byte, error)
- type Issuer
- type Proof
- type Prover
- type SameType
- type SameTypeProver
- type SameTypeRandomness
- type SameTypeVerifier
- type SigningIdentity
- type Verifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IssueAction ¶
type IssueAction struct {
// Issuer is the 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
// Metadata of the issue action
Metadata map[string][]byte
}
IssueAction specifies an issue of one or more tokens
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) IsGraphHiding ¶ added in v0.4.0
func (i *IssueAction) IsGraphHiding() bool
IsGraphHiding returns false, indicating that fabtoken does not hide the transaction graph
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 struct {
Signer SigningIdentity
PublicParams *crypto.PublicParams
Type token2.Type
}
Issuer is the entity that issues tokens
func (*Issuer) GenerateZKIssue ¶
func (*Issuer) New ¶
func (i *Issuer) New(ttype token2.Type, signer common.SigningIdentity, pp *crypto.PublicParams)
New returns an Issuer as a function of the passed parameters
type Proof ¶
type Proof struct {
// SameType is the proof that a bridge commitment is of type G_0^typeH^r
SameType *SameType
// RangeCorrectness is the proof that issued tokens have value in the authorized range
RangeCorrectness *rp.RangeCorrectness
}
Proof proves that an IssueAction is valid
func (*Proof) Deserialize ¶
Deserialize un-marshals Proof
type Prover ¶
type Prover struct {
// SameType encodes the SameType Prover
SameType *SameTypeProver
// RangeCorrectness encodes the range proof Prover
RangeCorrectness *rp.RangeCorrectnessProver
}
Prover produces a proof of validity of an IssueAction
func NewProver ¶
func NewProver(tw []*token.TokenDataWitness, tokens []*math.G1, pp *crypto.PublicParams) (*Prover, error)
type SameType ¶ added in v0.4.0
type SameType struct {
// Proof of type
Type *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
BlindingFactor *math.Zr
// only when the type is not hidden
TypeInTheClear string
// Challenge computed using the Fiat-Shamir Heuristic
Challenge *math.Zr
// CommitmentToType is a commitment to the type being issued
CommitmentToType *math.G1
}
SameType shows that issued tokens contains Pedersen commitments to (type, value) SameType also shows that all the issued tokens contain the same type
func (*SameType) Deserialize ¶ added in v0.4.0
Deserialize un-marshals SameType proof
type SameTypeProver ¶ added in v0.4.0
type SameTypeProver struct {
PedParams []*math.G1
Curve *math.Curve
// CommitmentToType is a commitment to tokenType using blindingFactor
CommitmentToType *math.G1
// contains filtered or unexported fields
}
SameTypeProver contains information that allows an Issuer to prove that issued tokens are have the same type
func NewSameTypeProver ¶ added in v0.4.0
func NewSameTypeProver(ttype token2.Type, bf *math.Zr, com *math.G1, pp []*math.G1, c *math.Curve) *SameTypeProver
NewSameTypeProver returns a SameTypeProver for the passed parameters
func (*SameTypeProver) Prove ¶ added in v0.4.0
func (p *SameTypeProver) Prove() (*SameType, error)
Prove returns a SameType proof
type SameTypeRandomness ¶ added in v0.4.0
type SameTypeRandomness struct {
// contains filtered or unexported fields
}
SameTypeRandomness is the randomness used to generate the well-formedness proof
type SameTypeVerifier ¶ added in v0.4.0
SameTypeVerifier checks the validity of SameType proof
func NewSameTypeVerifier ¶ added in v0.4.0
NewSameTypeVerifier returns a SameTypeVerifier corresponding to the passed parameters
func (*SameTypeVerifier) Verify ¶ added in v0.4.0
func (v *SameTypeVerifier) Verify(proof *SameType) error
Verify returns an error if the serialized proof is an invalid SameType proof
type SigningIdentity ¶ added in v0.4.0
type SigningIdentity interface {
driver.SigningIdentity
}
type Verifier ¶
type Verifier struct {
// SameType encodes the SameType Verifier
SameType *SameTypeVerifier
// RangeCorrectness encodes the range proof verifier
RangeCorrectness *rp.RangeCorrectnessVerifier
}
Verifier checks if Proof is valid
func NewVerifier ¶
func NewVerifier(tokens []*math.G1, pp *crypto.PublicParams) *Verifier