Documentation ¶
Index ¶
- type Action
- func (t *Action) Deserialize(raw []byte) error
- func (t *Action) GetInputs() []*token2.ID
- 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) IsGraphHiding() bool
- func (t *Action) IsRedeemAt(index int) bool
- func (t *Action) NumOutputs() int
- func (t *Action) Serialize() ([]byte, error)
- func (t *Action) SerializeOutputAt(index int) ([]byte, error)
- type Proof
- type Prover
- type Sender
- type SigningIdentity
- type TypeAndSumProof
- type TypeAndSumProofCommitments
- type TypeAndSumProofRandomness
- type TypeAndSumProver
- type TypeAndSumVerifier
- type TypeAndSumWitness
- type Verifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶ added in v0.4.0
type Action struct { // Inputs specify the identifiers in of the tokens to be spent Inputs []*token2.ID // InputCommitments are the PedersenCommitments in the inputs InputTokens []*token.Token // 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 }
Action specifies a transfer of one or more tokens
func NewTransfer ¶
func NewTransfer(inputs []*token2.ID, inputToken []*token.Token, outputs []*math.G1, owners [][]byte, proof []byte) (*Action, error)
NewTransfer returns the Action that matches the passed arguments
func (*Action) Deserialize ¶ added in v0.4.0
Deserialize unmarshals the Action
func (*Action) GetMetadata ¶ added in v0.4.0
GetMetadata returns metadata of the Action
func (*Action) GetOutputCommitments ¶ added in v0.4.0
GetOutputCommitments returns the Pedersen commitments in the Action
func (*Action) GetOutputs ¶ added in v0.4.0
GetOutputs returns the outputs in the Action
func (*Action) GetSerialNumbers ¶ added in v0.4.0
func (*Action) GetSerializedInputs ¶ added in v0.4.0
func (*Action) GetSerializedOutputs ¶ added in v0.4.0
GetSerializedOutputs returns the outputs in the Action serialized
func (*Action) IsGraphHiding ¶ added in v0.4.0
IsGraphHiding returns false zkatdlog is not graph hiding
func (*Action) IsRedeemAt ¶ added in v0.4.0
IsRedeemAt checks if output in the Action at the passed index is redeemed
func (*Action) NumOutputs ¶ added in v0.4.0
NumOutputs returns the number of outputs in the Action
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
func NewProver ¶
func NewProver(inputWitness, outputWitness []*token.TokenDataWitness, inputs, outputs []*math.G1, pp *crypto.PublicParams) (*Prover, error)
NewProver returns a Action 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 []*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 *crypto.PublicParams }
Sender produces a signed TokenRequest
func NewSender ¶
func NewSender(signers []driver.Signer, tokens []*token.Token, ids []*token2.ID, inf []*token.Metadata, pp *crypto.PublicParams) (*Sender, error)
NewSender returns a Sender
type SigningIdentity ¶
type SigningIdentity interface { driver.SigningIdentity }
SigningIdentity signs TokenRequest
type TypeAndSumProof ¶ added in v0.4.0
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 ¶ added in v0.4.0
func (p *TypeAndSumProof) Deserialize(bytes []byte) error
Deserialize un-marshals TypeAndSumProof
func (*TypeAndSumProof) Serialize ¶ added in v0.4.0
func (p *TypeAndSumProof) Serialize() ([]byte, error)
Serialize marshals TypeAndSumProof
type TypeAndSumProofCommitments ¶ added in v0.4.0
TypeAndSumProofCommitments are commitments to the randomness used in TypeAndSumProof
type TypeAndSumProofRandomness ¶ added in v0.4.0
type TypeAndSumProofRandomness struct {
// contains filtered or unexported fields
}
TypeAndSumProofRandomness is the randomness used in the generation of TypeAndSumProof
type TypeAndSumProver ¶ added in v0.4.0
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 ¶ added in v0.4.0
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 ¶ added in v0.4.0
func (p *TypeAndSumProver) Prove() (*TypeAndSumProof, error)
Prove returns a serialized TypeAndSumProof proof
type TypeAndSumVerifier ¶ added in v0.4.0
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 ¶ added in v0.4.0
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 ¶ added in v0.4.0
func (v *TypeAndSumVerifier) Verify(stp *TypeAndSumProof) error
Verify returns an error when TypeAndSumProof is not a valid
type TypeAndSumWitness ¶ added in v0.4.0
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 ¶ added in v0.4.0
func NewTypeAndSumWitness(bf *math.Zr, in, out []*token.TokenDataWitness, c *math.Curve) *TypeAndSumWitness
NewTypeAndSumWitness returns a TypeAndSumWitness as a function of the passed arguments
type Verifier ¶
type Verifier struct { TypeAndSum *TypeAndSumVerifier RangeCorrectness *rp.RangeCorrectnessVerifier }
Verifier verifies if a Action is valid
func NewVerifier ¶
func NewVerifier(inputs, outputs []*math.G1, pp *crypto.PublicParams) *Verifier
NewVerifier returns a Action Verifier as a function of the passed parameters