Documentation ¶
Overview ¶
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
Index ¶
- type Proof
- type Prover
- type Sender
- type SigningIdentity
- type TransferAction
- func (t *TransferAction) Deserialize(raw []byte) error
- func (t *TransferAction) GetInputs() ([]string, error)
- func (t *TransferAction) GetMetadata() map[string][]byte
- func (t *TransferAction) GetOutputCommitments() []*math.G1
- func (t *TransferAction) GetOutputs() []driver.Output
- func (t *TransferAction) GetProof() []byte
- func (t *TransferAction) GetSerializedOutputs() ([][]byte, error)
- func (t *TransferAction) IsGraphHiding() bool
- func (t *TransferAction) IsRedeemAt(index int) bool
- func (t *TransferAction) NumOutputs() int
- func (t *TransferAction) Serialize() ([]byte, error)
- func (t *TransferAction) SerializeOutputAt(index int) ([]byte, error)
- type Verifier
- type WellFormedness
- type WellFormednessCommitments
- type WellFormednessProver
- type WellFormednessRandomness
- type WellFormednessVerifier
- type WellFormednessWitness
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 WellFormedness []byte // Proof that the outputs have value in the authorized range RangeCorrectness []byte }
Proof is a zero-knowledge proof that shows that a TransferAction is valid
func (*Proof) Deserialize ¶
Deserialize unmarshals Proof
type Prover ¶
type Prover struct { WellFormedness *WellFormednessProver RangeCorrectness *rangeproof.Prover }
Prover produces a proof that a TransferAction is valid
func NewProver ¶
func NewProver(inputWitness, outputWitness []*token.TokenDataWitness, inputs, outputs []*math.G1, pp *crypto.PublicParams) *Prover
NewProver returns a TransferAction Prover that corresponds to the passed arguments
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 []string // 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 *crypto.PublicParams }
Sender produces a signed TokenRequest
func NewSender ¶
func NewSender(signers []driver.Signer, tokens []*token.Token, ids []string, inf []*token.Metadata, pp *crypto.PublicParams) (*Sender, error)
NewSender returns a Sender
func (*Sender) GenerateZKTransfer ¶
func (s *Sender) GenerateZKTransfer(values []uint64, owners [][]byte) (*TransferAction, []*token.Metadata, error)
GenerateZKTransfer produces a TransferAction and an array of ValidationRecords that corresponds to the openings of the newly created outputs
type SigningIdentity ¶
type SigningIdentity interface { driver.SigningIdentity }
SigningIdentity signs TokenRequest
type TransferAction ¶
type TransferAction struct { // Inputs specify the identifiers in of the tokens to be spent Inputs []string // InputCommitments are the PedersenCommitments in the inputs InputCommitments []*math.G1 // OutputTokens are the new tokens resulting from the transfer OutputTokens []*token.Token // ZK Proof that shows that the transfer is correct Proof []byte // Metadata contains the transfer action's metadata Metadata map[string][]byte }
TransferAction specifies a transfer of one or more tokens
func NewTransfer ¶
func NewTransfer(inputs []string, inputCommitments []*math.G1, outputs []*math.G1, owners [][]byte, proof []byte) (*TransferAction, error)
NewTransfer returns the TransferAction that matches the passed arguments
func (*TransferAction) Deserialize ¶
func (t *TransferAction) Deserialize(raw []byte) error
Deserialize unmarshals the TransferAction
func (*TransferAction) GetInputs ¶
func (t *TransferAction) GetInputs() ([]string, error)
GetInputs returns the inputs in the TransferAction
func (*TransferAction) GetMetadata ¶
func (t *TransferAction) GetMetadata() map[string][]byte
GetMetadata returns metadata of the TransferAction
func (*TransferAction) GetOutputCommitments ¶
func (t *TransferAction) GetOutputCommitments() []*math.G1
GetOutputCommitments returns the Pedersen commitments in the TransferAction
func (*TransferAction) GetOutputs ¶
func (t *TransferAction) GetOutputs() []driver.Output
GetOutputs returns the outputs in the TransferAction
func (*TransferAction) GetProof ¶
func (t *TransferAction) GetProof() []byte
GetProof returns the proof in the TransferAction
func (*TransferAction) GetSerializedOutputs ¶
func (t *TransferAction) GetSerializedOutputs() ([][]byte, error)
GetSerializedOutputs returns the outputs in the TransferAction serialized
func (*TransferAction) IsGraphHiding ¶
func (t *TransferAction) IsGraphHiding() bool
IsGraphHiding returns false zkatdlog is not graph hiding
func (*TransferAction) IsRedeemAt ¶
func (t *TransferAction) IsRedeemAt(index int) bool
IsRedeemAt checks if output in the TransferAction at the passed index is redeemed
func (*TransferAction) NumOutputs ¶
func (t *TransferAction) NumOutputs() int
NumOutputs returns the number of outputs in the TransferAction
func (*TransferAction) Serialize ¶
func (t *TransferAction) Serialize() ([]byte, error)
Serialize marshals the TransferAction
func (*TransferAction) SerializeOutputAt ¶
func (t *TransferAction) SerializeOutputAt(index int) ([]byte, error)
SerializeOutputAt marshals the output in the TransferAction at the passed index
type Verifier ¶
type Verifier struct { WellFormedness *WellFormednessVerifier RangeCorrectness *rangeproof.Verifier }
Verifier verifies if a TransferAction is valid
func NewVerifier ¶
func NewVerifier(inputs, outputs []*math.G1, pp *crypto.PublicParams) *Verifier
NewVerifier returns a TransferAction Verifier as a function of the passed parameters
type WellFormedness ¶
type WellFormedness struct { // proof of knowledge of the randomness used in Pedersen commitments in the inputs InputBlindingFactors []*math.Zr // proof of knowledge of the randomness used in Pedersen commitments in the outputs OutputBlindingFactors []*math.Zr // proof of knowledge of the values encoded in the Pedersen commitments in the inputs InputValues []*math.Zr // proof of knowledge of the values encoded in the Pedersen commitments in the outputs OutputValues []*math.Zr // proof of knowledge of the token type encoded in both inputs and outputs Type *math.Zr // proof of knowledge of the sum of inputs and the sum of outputs // sum of inputs equal sum of outputs Sum *math.Zr // challenge used in proof Challenge *math.Zr }
func (*WellFormedness) Deserialize ¶
func (wf *WellFormedness) Deserialize(bytes []byte) error
Deserialize un-marshals WellFormedness
func (*WellFormedness) Serialize ¶
func (wf *WellFormedness) Serialize() ([]byte, error)
Serialize marshals WellFormedness
type WellFormednessCommitments ¶
type WellFormednessCommitments struct { Inputs []*math.G1 Outputs []*math.G1 InputSum *math.G1 OutputSum *math.G1 }
WellFormednessCommitments are commitments to the randomness used in WellFormedness
type WellFormednessProver ¶
type WellFormednessProver struct { *WellFormednessVerifier // contains filtered or unexported fields }
WellFormednessProver produces a WellFormedness proof
func NewWellFormednessProver ¶
func NewWellFormednessProver(witness *WellFormednessWitness, pp []*math.G1, inputs []*math.G1, outputs []*math.G1, c *math.Curve) *WellFormednessProver
NewWellFormednessProver returns a NewWellFormednessProver as a function of the passed arguments
func (*WellFormednessProver) Prove ¶
func (p *WellFormednessProver) Prove() ([]byte, error)
Prove returns a serialized WellFormedness proof
type WellFormednessRandomness ¶
WellFormednessRandomness is the randomness used in the generation of WellFormedness
type WellFormednessVerifier ¶
type WellFormednessVerifier 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 }
WellFormednessVerifier checks the validity of WellFormedness
func NewWellFormednessVerifier ¶
func NewWellFormednessVerifier(pp []*math.G1, inputs []*math.G1, outputs []*math.G1, c *math.Curve) *WellFormednessVerifier
NewWellFormednessVerifier returns a NewWellFormednessVerifier as a function of the passed arguments
func (*WellFormednessVerifier) Verify ¶
func (v *WellFormednessVerifier) Verify(p []byte) error
Verify returns an error when WellFormedness is not a valid
type WellFormednessWitness ¶
type WellFormednessWitness struct { // Type is the token type of inputs and outputs Type string // contains filtered or unexported fields }
WellFormednessWitness contains the secret information used to produce WellFormedness
func NewWellFormednessWitness ¶
func NewWellFormednessWitness(in, out []*token.TokenDataWitness) *WellFormednessWitness
NewWellFormednessWitness returns a WellFormednessWitness as a function of the passed arguments
func (*WellFormednessWitness) GetInBlindingFactors ¶
func (w *WellFormednessWitness) GetInBlindingFactors() []*math.Zr
GetInBlindingFactors returns the randomness used in the Pedersen commitments in the inputs
func (*WellFormednessWitness) GetInValues ¶
func (w *WellFormednessWitness) GetInValues() []*math.Zr
GetInValues returns input values
func (*WellFormednessWitness) GetOutBlindingFactors ¶
func (w *WellFormednessWitness) GetOutBlindingFactors() []*math.Zr
GetOutBlindingFactors returns the randomness used in the Pedersen commitments in the outputs
func (*WellFormednessWitness) GetOutValues ¶
func (w *WellFormednessWitness) GetOutValues() []*math.Zr
GetOutValues returns output values