Zeth - Zerocash on Ethereum  0.8
Reference implementation of the Zeth protocol by Clearmatics
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
coordinator.powersoftau_command.PowersOfTauCommand Class Reference

Public Member Functions

def __init__ (self, Optional[str] powersoftau_path, Optional[int] num_powers)
 
bool begin (self)
 
bool verify_contribution (self)
 
bool contribute (self, Optional[str] digest_file, bool skip_user_input)
 
bool verify_transcript (self, int num_rounds)
 

Static Public Member Functions

None append_response_to_transcript (str response, str transcript_file)
 

Public Attributes

 powersoftau_path
 
 num_powers
 

Detailed Description

Wrapper around the powersoftau commands

Definition at line 18 of file powersoftau_command.py.

Constructor & Destructor Documentation

◆ __init__()

def coordinator.powersoftau_command.PowersOfTauCommand.__init__ (   self,
Optional[str]  powersoftau_path,
Optional[int]  num_powers 
)

Definition at line 22 of file powersoftau_command.py.

22  def __init__(
23  self,
24  powersoftau_path: Optional[str],
25  num_powers: Optional[int]):
26  self.powersoftau_path = powersoftau_path or _default_powersoftau_path()
27  self.num_powers = num_powers
28  if not exists(self.powersoftau_path):
29  raise Exception(f"expected powersoftau path: {self.powersoftau_path}")
30 

Member Function Documentation

◆ append_response_to_transcript()

None coordinator.powersoftau_command.PowersOfTauCommand.append_response_to_transcript ( str  response,
str  transcript_file 
)
static

Definition at line 38 of file powersoftau_command.py.

38  def append_response_to_transcript(
39  response: str,
40  transcript_file: str) -> None:
41  import subprocess
42  with open(transcript_file, "ab") as transcript_f:
43  subprocess.run(
44  ["dd", f"if={response}", "bs=64", "skip=1"],
45  stdout=transcript_f,
46  check=True)
47 

◆ begin()

bool coordinator.powersoftau_command.PowersOfTauCommand.begin (   self)

Definition at line 31 of file powersoftau_command.py.

31  def begin(self) -> bool:
32  return self._exec("new")
33 
Here is the call graph for this function:

◆ contribute()

bool coordinator.powersoftau_command.PowersOfTauCommand.contribute (   self,
Optional[str]  digest_file,
bool  skip_user_input 
)

Definition at line 48 of file powersoftau_command.py.

48  def contribute(
49  self,
50  digest_file: Optional[str],
51  skip_user_input: bool) -> bool:
52  assert exists(CHALLENGE_FILE)
53  cmd_args: List[str] = []
54  kwargs = {}
55  if digest_file:
56  cmd_args += ["--digest", digest_file]
57  if skip_user_input:
58  kwargs["input"] = "any data\n".encode()
59  if self._exec("compute", cmd_args, kwargs):
60  assert exists(RESPONSE_FILE)
61  return True
62  return False
63 
Here is the call graph for this function:

◆ verify_contribution()

bool coordinator.powersoftau_command.PowersOfTauCommand.verify_contribution (   self)

Definition at line 34 of file powersoftau_command.py.

34  def verify_contribution(self) -> bool:
35  return self._exec("verify_transform")
36 
Here is the call graph for this function:

◆ verify_transcript()

bool coordinator.powersoftau_command.PowersOfTauCommand.verify_transcript (   self,
int  num_rounds 
)

Definition at line 64 of file powersoftau_command.py.

64  def verify_transcript(self, num_rounds: int) -> bool:
65  return self._exec("verify", args=["--rounds", str(num_rounds)])
66 
Here is the call graph for this function:

Member Data Documentation

◆ num_powers

coordinator.powersoftau_command.PowersOfTauCommand.num_powers

Definition at line 24 of file powersoftau_command.py.

◆ powersoftau_path

coordinator.powersoftau_command.PowersOfTauCommand.powersoftau_path

Definition at line 23 of file powersoftau_command.py.


The documentation for this class was generated from the following file:
test_commands.mock.str
str
Definition: mock.py:18
coordinator.contribute.contribute
None contribute(str base_url, str key_file, str challenge_file, Callable[[], str] contribute_cb, int wait_interval, Optional[str] server_certificate, bool insecure)
Definition: contribute.py:65