Zeth - Zerocash on Ethereum  0.8
Reference implementation of the Zeth protocol by Clearmatics
Classes | Static Public Member Functions | List of all members
zeth.core.zksnark.PGHR13 Class Reference
Inheritance diagram for zeth.core.zksnark.PGHR13:
Inheritance graph
[legend]
Collaboration diagram for zeth.core.zksnark.PGHR13:
Collaboration graph
[legend]

Classes

class  Proof
 
class  VerificationKey
 

Static Public Member Functions

str get_contract_name (PairingParameters pp)
 
List[int] verification_key_to_contract_parameters (IVerificationKey vk, PairingParameters pp)
 
PGHR13.VerificationKey verification_key_from_proto (snark_messages_pb2.VerificationKey vk_obj)
 
snark_messages_pb2.VerificationKey verification_key_to_proto (IVerificationKey vk)
 
PGHR13.VerificationKey verification_key_from_json_dict (Dict[str, Any] json_dict)
 
PGHR13.Proof proof_from_json_dict (Dict[str, Any] json_dict)
 
ExtendedProof extended_proof_from_proto (snark_messages_pb2.ExtendedProof ext_proof_proto)
 
snark_messages_pb2.ExtendedProof extended_proof_to_proto (ExtendedProof ext_proof)
 
List[int] proof_to_contract_parameters (IProof proof, PairingParameters pp)
 
- Static Public Member Functions inherited from zeth.core.zksnark.IZKSnarkProvider
IVerificationKey verification_key_from_proto (snark_messages_pb2.VerificationKey vk_obj)
 

Detailed Description

Definition at line 296 of file zksnark.py.

Member Function Documentation

◆ extended_proof_from_proto()

ExtendedProof zeth.core.zksnark.PGHR13.extended_proof_from_proto ( snark_messages_pb2.ExtendedProof  ext_proof_proto)
static

Reimplemented from zeth.core.zksnark.IZKSnarkProvider.

Definition at line 437 of file zksnark.py.

437  def extended_proof_from_proto(
438  ext_proof_proto: snark_messages_pb2.ExtendedProof) -> ExtendedProof:
439  ext_proof = ext_proof_proto.pghr13_extended_proof
440  return ExtendedProof(
441  proof=PGHR13.Proof(
442  a=g1_point_from_proto(ext_proof.a),
443  a_p=g1_point_from_proto(ext_proof.a_p),
444  b=g2_point_from_proto(ext_proof.b),
445  b_p=g1_point_from_proto(ext_proof.b_p),
446  c=g1_point_from_proto(ext_proof.c),
447  c_p=g1_point_from_proto(ext_proof.c_p),
448  h=g1_point_from_proto(ext_proof.h),
449  k=g1_point_from_proto(ext_proof.k)),
450  inputs=cast(List[str], json.loads(ext_proof.inputs)))
451 
Here is the call graph for this function:

◆ extended_proof_to_proto()

snark_messages_pb2.ExtendedProof zeth.core.zksnark.PGHR13.extended_proof_to_proto ( ExtendedProof  ext_proof)
static

Reimplemented from zeth.core.zksnark.IZKSnarkProvider.

Definition at line 453 of file zksnark.py.

453  def extended_proof_to_proto(
454  ext_proof: ExtendedProof) -> snark_messages_pb2.ExtendedProof:
455  proof = ext_proof.proof
456  assert isinstance(proof, PGHR13.Proof)
457  extproof_proto = snark_messages_pb2.ExtendedProof()
458  proof_proto = extproof_proto.pghr13_extended_proof \
459  # pylint: disable=no-member
460  g1_point_to_proto(proof.a, proof_proto.a)
461  g1_point_to_proto(proof.a_p, proof_proto.a_p)
462  g2_point_to_proto(proof.b, proof_proto.b)
463  g1_point_to_proto(proof.b_p, proof_proto.b_p)
464  g1_point_to_proto(proof.c, proof_proto.c)
465  g1_point_to_proto(proof.c_p, proof_proto.c_p)
466  g1_point_to_proto(proof.h, proof_proto.h)
467  g1_point_to_proto(proof.k, proof_proto.k)
468  proof_proto.inputs = json.dumps(ext_proof.inputs)
469  return extproof_proto
470 
Here is the call graph for this function:

◆ get_contract_name()

str zeth.core.zksnark.PGHR13.get_contract_name ( PairingParameters  pp)
static
Get the verifier and mixer contracts for this SNARK.

Reimplemented from zeth.core.zksnark.IZKSnarkProvider.

Definition at line 388 of file zksnark.py.

388  def get_contract_name(pp: PairingParameters) -> str:
389  return _contract_name("Pghr13", pp)
390 

◆ proof_from_json_dict()

PGHR13.Proof zeth.core.zksnark.PGHR13.proof_from_json_dict ( Dict[str, Any]  json_dict)
static

Reimplemented from zeth.core.zksnark.IZKSnarkProvider.

Definition at line 433 of file zksnark.py.

433  def proof_from_json_dict(json_dict: Dict[str, Any]) -> PGHR13.Proof:
434  return PGHR13.Proof.from_json_dict(json_dict)
435 

◆ proof_to_contract_parameters()

List[int] zeth.core.zksnark.PGHR13.proof_to_contract_parameters ( IProof  proof,
PairingParameters  pp 
)
static
Generate the leading parameters to the mix function for this SNARK, from a
GenericProof object.

Reimplemented from zeth.core.zksnark.IZKSnarkProvider.

Definition at line 472 of file zksnark.py.

472  def proof_to_contract_parameters(
473  proof: IProof, pp: PairingParameters) -> List[int]:
474  assert isinstance(proof, PGHR13.Proof)
475  return \
477  g1_point_to_contract_parameters(proof.a_p) + \
479  g1_point_to_contract_parameters(proof.b_p) + \
481  g1_point_to_contract_parameters(proof.c_p) + \
484 
485 
Here is the call graph for this function:

◆ verification_key_from_json_dict()

PGHR13.VerificationKey zeth.core.zksnark.PGHR13.verification_key_from_json_dict ( Dict[str, Any]  json_dict)
static

Reimplemented from zeth.core.zksnark.IZKSnarkProvider.

Definition at line 428 of file zksnark.py.

428  def verification_key_from_json_dict(
429  json_dict: Dict[str, Any]) -> PGHR13.VerificationKey:
430  return PGHR13.VerificationKey.from_json_dict(json_dict)
431 

◆ verification_key_from_proto()

PGHR13.VerificationKey zeth.core.zksnark.PGHR13.verification_key_from_proto ( snark_messages_pb2.VerificationKey  vk_obj)
static

Definition at line 408 of file zksnark.py.

408  def verification_key_from_proto(
409  vk_obj: snark_messages_pb2.VerificationKey) -> PGHR13.VerificationKey:
410  vk = vk_obj.pghr13_verification_key
411  return PGHR13.VerificationKey(
412  a=g2_point_from_proto(vk.a),
413  b=g1_point_from_proto(vk.b),
414  c=g2_point_from_proto(vk.c),
415  g=g2_point_from_proto(vk.gamma),
416  gb1=g1_point_from_proto(vk.gamma_beta_g1),
417  gb2=g2_point_from_proto(vk.gamma_beta_g2),
418  z=g2_point_from_proto(vk.z),
419  ic=[G1Point.from_json_list(ic)
420  for ic in json.loads(vk.ic)])
421 
Here is the call graph for this function:

◆ verification_key_to_contract_parameters()

List[int] zeth.core.zksnark.PGHR13.verification_key_to_contract_parameters ( IVerificationKey  vk,
PairingParameters  pp 
)
static

Reimplemented from zeth.core.zksnark.IZKSnarkProvider.

Definition at line 392 of file zksnark.py.

392  def verification_key_to_contract_parameters(
393  vk: IVerificationKey,
394  pp: PairingParameters) -> List[int]:
395  assert isinstance(vk, PGHR13.VerificationKey)
396  return \
405  for ic in vk.ic], [])
406 
Here is the call graph for this function:

◆ verification_key_to_proto()

snark_messages_pb2.VerificationKey zeth.core.zksnark.PGHR13.verification_key_to_proto ( IVerificationKey  vk)
static

Reimplemented from zeth.core.zksnark.IZKSnarkProvider.

Definition at line 423 of file zksnark.py.

423  def verification_key_to_proto(
424  vk: IVerificationKey) -> snark_messages_pb2.VerificationKey:
425  raise Exception("not implemented")
426 

The documentation for this class was generated from the following file:
zeth.core.pairing.g1_point_to_contract_parameters
List[int] g1_point_to_contract_parameters(G1Point g1)
Definition: pairing.py:61
zeth.core.pairing.g2_point_from_proto
G2Point g2_point_from_proto(ec_group_messages_pb2.Group2Point point)
Definition: pairing.py:99
zeth.core.pairing.g1_point_from_proto
G1Point g1_point_from_proto(ec_group_messages_pb2.Group1Point point)
Definition: pairing.py:45
zeth.core.pairing.g2_point_to_proto
None g2_point_to_proto(G2Point g2, ec_group_messages_pb2.Group2Point g2_proto)
Definition: pairing.py:106
zeth.core.pairing.g2_point_to_contract_parameters
List[int] g2_point_to_contract_parameters(G2Point g2)
Definition: pairing.py:113
zeth.core.pairing.g1_point_to_proto
None g1_point_to_proto(G1Point g1, ec_group_messages_pb2.Group1Point g1_proto)
Definition: pairing.py:54