Documentation
¶
Index ¶
- Constants
- type Action
- func (i *Action) Deserialize(raw []byte) error
- func (i *Action) ExtraSigners() []driver.Identity
- func (i *Action) GetCommitments() ([]*math.G1, error)
- func (i *Action) GetInputs() []*token2.ID
- func (i *Action) GetIssuer() []byte
- func (i *Action) GetMetadata() map[string][]byte
- func (i *Action) GetOutputs() []driver.Output
- func (i *Action) GetProof() []byte
- func (i *Action) GetSerialNumbers() []string
- func (i *Action) GetSerializedInputs() ([][]byte, error)
- func (i *Action) GetSerializedOutputs() ([][]byte, error)
- func (i *Action) IsAnonymous() bool
- func (i *Action) IsGraphHiding() bool
- func (i *Action) NumInputs() int
- func (i *Action) NumOutputs() int
- func (i *Action) Serialize() ([]byte, error)
- func (i *Action) Validate() error
- type ActionInput
- type Issuer
- type Proof
- type Prover
- type SameType
- type SameTypeProver
- type SameTypeRandomness
- type SameTypeVerifier
- type SigningIdentity
- type Verifier
Constants ¶
const ProtocolV1 = 1
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct {
// Issuer is the identity of issuer
Issuer driver.Identity
// Inputs are the tokens to be redeemed by this issue action
Inputs []*ActionInput
// Outputs are the newly issued tokens
Outputs []*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
}
Action specifies an issue of one or more tokens
func (*Action) Deserialize ¶
Deserialize un-marshals IssueAction
func (*Action) ExtraSigners ¶
func (*Action) GetCommitments ¶
GetCommitments return the Pedersen commitment of (type, value) in the Outputs
func (*Action) GetMetadata ¶
GetMetadata returns IssueAction metadata if there is any.
func (*Action) GetOutputs ¶
GetOutputs returns the Outputs in IssueAction
func (*Action) GetSerialNumbers ¶
func (*Action) GetSerializedInputs ¶
func (*Action) GetSerializedOutputs ¶
GetSerializedOutputs returns the serialization of Outputs
func (*Action) IsAnonymous ¶
IsAnonymous returns a Boolean. True if IssueAction is anonymous, and False otherwise.
func (*Action) IsGraphHiding ¶
IsGraphHiding returns false, this driver does not hide the transaction graph
func (*Action) NumOutputs ¶
NumOutputs returns the number of outputs in IssueAction
type ActionInput ¶
func (*ActionInput) FromProtos ¶
func (i *ActionInput) FromProtos(p *actions.IssueActionInput) error
func (*ActionInput) ToProtos ¶
func (i *ActionInput) ToProtos() (*actions.IssueActionInput, error)
type Issuer ¶
type Issuer struct {
Signer SigningIdentity
PublicParams *v1.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 *v1.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
type SameType ¶
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
// 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 ¶
Deserialize un-marshals SameType proof
type SameTypeProver ¶
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 ¶
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 ¶
func (p *SameTypeProver) Prove() (*SameType, error)
Prove returns a SameType proof
type SameTypeRandomness ¶
type SameTypeRandomness struct {
// contains filtered or unexported fields
}
SameTypeRandomness is the randomness used to generate the well-formedness proof
type SameTypeVerifier ¶
SameTypeVerifier checks the validity of SameType proof
func NewSameTypeVerifier ¶
NewSameTypeVerifier returns a SameTypeVerifier corresponding to the passed parameters
func (*SameTypeVerifier) Verify ¶
func (v *SameTypeVerifier) Verify(proof *SameType) error
Verify returns an error if the serialized proof is an invalid SameType proof
type SigningIdentity ¶
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 *v1.PublicParams) *Verifier