Documentation
¶
Index ¶
- Constants
- type Action
- func (t *Action) Deserialize(raw []byte) error
- func (t *Action) ExtraSigners() []driver.Identity
- func (t *Action) GetInputs() []*token2.ID
- func (t *Action) GetIssuer() driver.Identity
- func (t *Action) GetMetadata() map[string][]byte
- func (t *Action) GetOutputCommitments() []*math.G1
- func (t *Action) GetOutputs() []driver.Output
- func (t *Action) GetProof() []byte
- func (t *Action) GetSerialNumbers() []string
- func (t *Action) GetSerializedInputs() ([][]byte, error)
- func (t *Action) GetSerializedOutputs() ([][]byte, error)
- func (t *Action) InputTokens() []*token.Token
- func (t *Action) IsGraphHiding() bool
- func (t *Action) IsRedeem() bool
- func (t *Action) IsRedeemAt(index int) bool
- func (t *Action) NumInputs() int
- func (t *Action) NumOutputs() int
- func (t *Action) Serialize() ([]byte, error)
- func (t *Action) SerializeOutputAt(index int) ([]byte, error)
- func (t *Action) Validate() error
- type ActionInput
- type Proof
- type Prover
- type Sender
- type SigningIdentity
- type TypeAndSumProof
- type TypeAndSumProofCommitments
- type TypeAndSumProofRandomness
- type TypeAndSumProver
- type TypeAndSumVerifier
- type TypeAndSumWitness
- type Verifier
Constants ¶
const ProtocolV1 = 1
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct {
// Inputs specify the identifiers in of the tokens to be spent
Inputs []*ActionInput
// Outputs are the new tokens resulting from the transfer
Outputs []*token.Token
// ZK Proof that shows that the transfer is correct
Proof []byte
// Metadata contains the transfer action's metadata
Metadata map[string][]byte
// Issuer contains the identity of the issuer to sign the transfer action
Issuer driver.Identity
}
Action specifies a transfer of one or more tokens
func NewTransfer ¶
func NewTransfer(tokenIDs []*token2.ID, inputToken []*token.Token, commitments []*math.G1, owners [][]byte, proof []byte) (*Action, error)
NewTransfer returns the Action that matches the passed arguments
func (*Action) Deserialize ¶
Deserialize un-marshals TransferAction
func (*Action) ExtraSigners ¶
func (*Action) GetMetadata ¶
GetMetadata returns metadata of the Action
func (*Action) GetOutputCommitments ¶
GetOutputCommitments returns the Pedersen commitments in the Action
func (*Action) GetOutputs ¶
GetOutputs returns the outputs in the Action
func (*Action) GetSerialNumbers ¶
func (*Action) GetSerializedInputs ¶
func (*Action) GetSerializedOutputs ¶
GetSerializedOutputs returns the outputs in the Action serialized
func (*Action) InputTokens ¶
func (*Action) IsGraphHiding ¶
IsGraphHiding returns false zkatdlog is not graph hiding
func (*Action) IsRedeemAt ¶
IsRedeemAt checks if output in the Action at the passed index is redeemed
func (*Action) NumOutputs ¶
NumOutputs returns the number of outputs in the Action
func (*Action) SerializeOutputAt ¶
SerializeOutputAt marshals the output in the Action at the passed index
type ActionInput ¶
func (*ActionInput) FromProtos ¶
func (a *ActionInput) FromProtos(input *actions.TransferActionInput) error
func (*ActionInput) ToProtos ¶
func (a *ActionInput) ToProtos() (*actions.TransferActionInput, error)
type Proof ¶
type Proof struct {
// proof that inputs and outputs in a Transfer Action are well-formed
// inputs and outputs have the same total value
// inputs and outputs have the same type
TypeAndSum *TypeAndSumProof
// Proof that the outputs have value in the authorized range
RangeCorrectness *rp.RangeCorrectness
}
Proof is a zero-knowledge proof that shows that a Action is valid
func (*Proof) Deserialize ¶
Deserialize unmarshals Proof
type Prover ¶
type Prover struct {
TypeAndSum *TypeAndSumProver
RangeCorrectness *rp.RangeCorrectnessProver
}
Prover produces a proof that a Action is valid
type Sender ¶
type Sender struct {
// Signers is an array of Signer that matches the owners of the inputs
// to be spent in the transfer action
Signers []driver.Signer
// Inputs to be spent in the transfer
Inputs []*token.Token
// InputIDs is the identifiers of the Inputs to be spent
InputIDs []*token2.ID
// contains the opening of the inputs to be spent
InputInformation []*token.Metadata
// PublicParams refers to the public cryptographic parameters to be used
// to produce the TokenRequest
PublicParams *v1.PublicParams
}
Sender produces a signed TokenRequest
func NewSender ¶
func NewSender(signers []driver.Signer, tokens []*token.Token, ids []*token2.ID, inf []*token.Metadata, pp *v1.PublicParams) (*Sender, error)
NewSender returns a Sender
type SigningIdentity ¶
type SigningIdentity interface {
driver.SigningIdentity
}
SigningIdentity signs TokenRequest
type TypeAndSumProof ¶
type TypeAndSumProof struct {
// a pedersen commitment to the type of the inputs and the outputs
CommitmentToType *math.G1
// proof of knowledge of the randomness used in Pedersen commitments in the inputs
InputBlindingFactors []*math.Zr
// proof of knowledge of the values encoded in the Pedersen commitments in the inputs
InputValues []*math.Zr
// proof of knowledge of the token type encoded in both inputs and outputs
Type *math.Zr
// proof of knowledge of blinding factor used to compute the commitment to type
TypeBlindingFactor *math.Zr
// proof of knowledge of equality of sum
EqualityOfSum *math.Zr
// challenge used in proof
Challenge *math.Zr
}
TypeAndSumProof is zero-knowledge proof that shows that the inputs of a transaction have the same total value and the same type as its outputs
func (*TypeAndSumProof) Deserialize ¶
func (p *TypeAndSumProof) Deserialize(bytes []byte) error
Deserialize un-marshals TypeAndSumProof
func (*TypeAndSumProof) Serialize ¶
func (p *TypeAndSumProof) Serialize() ([]byte, error)
Serialize marshals TypeAndSumProof
type TypeAndSumProofCommitments ¶
TypeAndSumProofCommitments are commitments to the randomness used in TypeAndSumProof
type TypeAndSumProofRandomness ¶
type TypeAndSumProofRandomness struct {
// contains filtered or unexported fields
}
TypeAndSumProofRandomness is the randomness used in the generation of TypeAndSumProof
type TypeAndSumProver ¶
type TypeAndSumProver struct {
// PedParams corresponds to the generators used to compute Pedersen commitments
// (g_1, g_2, h)
PedParams []*math.G1
// Inputs are Pedersen commitments to (Type, Value) of the inputs to be spent
Inputs []*math.G1
// Outputs are Pedersen commitments to (Type, Value) of the outputs to be created
// after the transfer
Outputs []*math.G1
// CommitmentToType is a Pedersen commitment to Type
CommitmentToType *math.G1
// Curve is the elliptic curve in which Pedersen commitments are computed
Curve *math.Curve
// contains filtered or unexported fields
}
TypeAndSumProver produces a TypeAndSumProof proof
func NewTypeAndSumProver ¶
func NewTypeAndSumProver(witness *TypeAndSumWitness, pp []*math.G1, inputs []*math.G1, outputs []*math.G1, comType *math.G1, c *math.Curve) *TypeAndSumProver
NewTypeAndSumProver returns a NewTypeAndSumProver as a function of the passed arguments
func (*TypeAndSumProver) Prove ¶
func (p *TypeAndSumProver) Prove() (*TypeAndSumProof, error)
Prove returns a serialized TypeAndSumProof proof
type TypeAndSumVerifier ¶
type TypeAndSumVerifier struct {
// PedParams corresponds to the generators used to compute Pedersen commitments
// (g_1, g_2, h)
PedParams []*math.G1
// Curve is the elliptic curve in which Pedersen commitments are computed
Curve *math.Curve
// Inputs are Pedersen commitments to (Type, Value) of the inputs to be spent
Inputs []*math.G1
// Outputs are Pedersen commitments to (Type, Value) of the outputs to be created
// after the transfer
Outputs []*math.G1
}
TypeAndSumVerifier checks the validity of TypeAndSumProof
func NewTypeAndSumVerifier ¶
func NewTypeAndSumVerifier(pp []*math.G1, inputs []*math.G1, outputs []*math.G1, c *math.Curve) *TypeAndSumVerifier
NewTypeAndSumVerifier returns a TypeAndSumVerifier as a function of the passed arguments
func (*TypeAndSumVerifier) Verify ¶
func (v *TypeAndSumVerifier) Verify(stp *TypeAndSumProof) error
Verify returns an error when TypeAndSumProof is not a valid
type TypeAndSumWitness ¶
type TypeAndSumWitness struct {
// Type is the token type of inputs and outputs
Type *math.Zr
// contains filtered or unexported fields
}
TypeAndSumWitness contains the secret information used to produce TypeAndSumProof
func NewTypeAndSumWitness ¶
NewTypeAndSumWitness returns a TypeAndSumWitness as a function of the passed arguments
type Verifier ¶
type Verifier struct {
PP *v1.PublicParams
TypeAndSum *TypeAndSumVerifier
RangeCorrectness *rp.RangeCorrectnessVerifier
}
Verifier verifies if a Action is valid
func NewVerifier ¶
func NewVerifier(inputs, outputs []*math.G1, pp *v1.PublicParams) *Verifier
NewVerifier returns a Action Verifier as a function of the passed parameters