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

Functions

None eth_send (Context ctx, str dest_addr, Optional[str] eth_private_key, Optional[str] eth_addr, str amount)
 

Variables

int FUND_AMOUNT_DEFAULT = 1000000
 
 help
 
 type
 
 default
 

Function Documentation

◆ eth_send()

None zeth.helper.eth_send.eth_send ( Context  ctx,
str  dest_addr,
Optional[str]  eth_private_key,
Optional[str]  eth_addr,
str  amount 
)
Send Ether from the local eth-addr to a destination address.

Definition at line 31 of file eth_send.py.

31 def eth_send(
32  ctx: Context,
33  dest_addr: str,
34  eth_private_key: Optional[str],
35  eth_addr: Optional[str],
36  amount: str) -> None:
37  """
38  Send Ether from the local eth-addr to a destination address.
39  """
40  dest_addr = load_eth_address(dest_addr)
41  eth_private_key_data = load_eth_private_key(eth_private_key)
42  eth_addr = load_eth_address(eth_addr)
43  eth_network = get_eth_network(ctx.obj["eth_network"])
44  web3 = open_web3_from_network(eth_network)
45 
46  if eth_private_key_data is None:
47  raise ClickException("hosted accounts are not supported")
48 
49  print(f"eth_addr = {eth_addr}")
50  print(f"dest_addr = {dest_addr}")
51  print(f"amount = {amount}")
52 
53  # pylint: disable=no-member
54  send_tx_desc = {
55  "from": eth_addr,
56  "to": dest_addr,
57  "value": EtherValue(amount).wei,
58  "gasPrice": web3.eth.gasPrice,
59  "nonce": web3.eth.getTransactionCount(eth_addr)
60  }
61  send_tx_desc["gas"] = web3.eth.estimateGas(send_tx_desc)
62 
63  signed_tx = web3.eth.account.signTransaction(
64  send_tx_desc, eth_private_key_data)
65 
66  tx_hash = web3.eth.sendRawTransaction(signed_tx.rawTransaction)
67  # pylint: enable=no-member
68 
69  print(tx_hash.hex())
Here is the call graph for this function:

Variable Documentation

◆ default

zeth.helper.eth_send.default

Definition at line 27 of file eth_send.py.

◆ FUND_AMOUNT_DEFAULT

int zeth.helper.eth_send.FUND_AMOUNT_DEFAULT = 1000000

Definition at line 14 of file eth_send.py.

◆ help

zeth.helper.eth_send.help

Definition at line 20 of file eth_send.py.

◆ type

zeth.helper.eth_send.type

Definition at line 26 of file eth_send.py.

zeth.cli.utils.get_eth_network
NetworkConfig get_eth_network(Optional[str] eth_network)
Definition: utils.py:84
zeth.cli.utils.load_eth_address
str load_eth_address(Optional[str] eth_addr)
Definition: utils.py:444
zeth.helper.eth_send.eth_send
None eth_send(Context ctx, str dest_addr, Optional[str] eth_private_key, Optional[str] eth_addr, str amount)
Definition: eth_send.py:31
zeth.cli.utils.load_eth_private_key
Optional[bytes] load_eth_private_key(Optional[str] private_key_file)
Definition: utils.py:465
zeth.cli.utils.open_web3_from_network
Any open_web3_from_network(NetworkConfig eth_net)
Definition: utils.py:114