Zecale - Reconciling Privacy and Scalability on Smart-Contract Chains  0.5
Reference implementation of the Zecale protocol by Clearmatics
utils.py
Go to the documentation of this file.
1 # Copyright (c) 2015-2022 Clearmatics Technologies Ltd
2 #
3 # SPDX-License-Identifier: LGPL-3.0+
4 
5 from zecale.core.aggregated_transaction import AggregatedTransaction
6 from zecale.core.nested_transaction import NestedTransaction
7 from zeth.core.zksnark import IVerificationKey, IZKSnarkProvider
8 import json
9 
10 
12  zksnark: IZKSnarkProvider, vk_file: str) -> IVerificationKey:
13  """
14  Load a JSON verification key from a file.
15  """
16  with open(vk_file, "r") as vk_f:
17  return zksnark.verification_key_from_json_dict(json.load(vk_f))
18 
19 
21  zksnark: IZKSnarkProvider, tx_file: str) -> NestedTransaction:
22  """
23  Load a single transaction for some application.
24  """
25  with open(tx_file, "r") as tx_f:
26  return NestedTransaction.from_json_dict(zksnark, json.load(tx_f))
27 
28 
30  zksnark: IZKSnarkProvider, agg_tx_file: str) -> AggregatedTransaction:
31  """
32  Load an aggregated transaction from a file
33  """
34  with open(agg_tx_file, "r") as tx_f:
35  return AggregatedTransaction.from_json_dict(zksnark, json.load(tx_f))
zecale.core.nested_transaction
Definition: nested_transaction.py:1
zecale.cli.utils.load_aggregated_transaction
AggregatedTransaction load_aggregated_transaction(IZKSnarkProvider zksnark, str agg_tx_file)
Definition: utils.py:29
zecale.core.aggregated_transaction
Definition: aggregated_transaction.py:1
zecale.cli.utils.load_nested_transaction
NestedTransaction load_nested_transaction(IZKSnarkProvider zksnark, str tx_file)
Definition: utils.py:20
zecale.cli.utils.load_verification_key
IVerificationKey load_verification_key(IZKSnarkProvider zksnark, str vk_file)
Definition: utils.py:11