Zeth - Zerocash on Ethereum  0.8
Reference implementation of the Zeth protocol by Clearmatics
Functions | Variables
zeth.helper.eth_gen_address Namespace Reference

Functions

None eth_gen_address (Optional[str] eth_addr_file, Optional[str] eth_private_key_file, Optional[str] use_private_key)
 
bytes gen_eth_private_key ()
 

Variables

 help
 

Function Documentation

◆ eth_gen_address()

None zeth.helper.eth_gen_address.eth_gen_address ( Optional[str]  eth_addr_file,
Optional[str]  eth_private_key_file,
Optional[str]  use_private_key 
)
Locally generate a new Ethereum private key and address file, and write
them to the current directory.

Definition at line 21 of file eth_gen_address.py.

21 def eth_gen_address(
22  eth_addr_file: Optional[str],
23  eth_private_key_file: Optional[str],
24  use_private_key: Optional[str]) -> None:
25  """
26  Locally generate a new Ethereum private key and address file, and write
27  them to the current directory.
28  """
29  sys.stderr.write(
30  "*** WARNING: this address should not be used in production ***\n")
31 
32  eth_addr_file = eth_addr_file or ETH_ADDRESS_DEFAULT
33  eth_private_key_file = eth_private_key_file or ETH_PRIVATE_KEY_FILE_DEFAULT
34 
35  if use_private_key:
36  eth_private_key = bytes.fromhex(use_private_key)
37  else:
38  eth_private_key = gen_eth_private_key()
39 
40  if len(eth_private_key) != 32:
41  raise ClickException("invalid private key length")
42 
43  write_eth_private_key(eth_private_key, eth_private_key_file)
44  eth_address = eth_address_from_private_key(eth_private_key)
45  write_eth_address(eth_address, eth_addr_file)
46  print(
47  f"{eth_address}: written to {eth_addr_file}, "
48  f"private key to {eth_private_key_file}")
49 
50 
Here is the call graph for this function:

◆ gen_eth_private_key()

bytes zeth.helper.eth_gen_address.gen_eth_private_key ( )
Simple private key generation function. Not for production use.

Definition at line 51 of file eth_gen_address.py.

51 def gen_eth_private_key() -> bytes:
52  """
53  Simple private key generation function. Not for production use.
54  """
55  return Web3.sha3(os.urandom(4096))
Here is the caller graph for this function:

Variable Documentation

◆ help

zeth.helper.eth_gen_address.help

Definition at line 18 of file eth_gen_address.py.

zeth.cli.utils.write_eth_address
None write_eth_address(str eth_addr, str eth_addr_file)
Definition: utils.py:458
zeth.helper.eth_gen_address.gen_eth_private_key
bytes gen_eth_private_key()
Definition: eth_gen_address.py:51
zeth.cli.utils.write_eth_private_key
None write_eth_private_key(bytes private_key, str private_key_file)
Definition: utils.py:473
zeth.helper.eth_gen_address.eth_gen_address
None eth_gen_address(Optional[str] eth_addr_file, Optional[str] eth_private_key_file, Optional[str] use_private_key)
Definition: eth_gen_address.py:21
zeth.core.utils.eth_address_from_private_key
str eth_address_from_private_key(bytes eth_private_key)
Definition: utils.py:129