コード例 #1
0
class Test1:  # name of abi
    address = None
    contract_abi_string = '''[{"constant": false, "inputs": [{"internalType": "uint256[4]", "name": "vk", "type": "uint256[4]"}, {"internalType": "uint256[2]", "name": "nfs", "type": "uint256[2]"}], "name": "check_mkroot_nullifiers_hsig_append_nullifiers_state", "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], "payable": false, "stateMutability": "nonpayable", "type": "function"}]'''
    contract_abi = None
    data_parser = DatatypeParser()
    client = None

    def __init__(self, address):
        self.client = BcosClient()
        self.address = address
        self.contract_abi = json.loads(self.contract_abi_string)
        self.data_parser.set_abi(self.contract_abi)

    def deploy(self, contract_bin_file):
        result = self.client.deployFromFile(contract_bin_file)
        self.address = result["contractAddress"]
        return result

    # ------------------------------------------
    def check_mkroot_nullifiers_hsig_append_nullifiers_state(self, vk, nfs):
        func_name = 'check_mkroot_nullifiers_hsig_append_nullifiers_state'
        args = [vk, nfs]
        receipt = self.client.sendRawTransactionGetReceipt(
            self.address, self.contract_abi, func_name, args)
        outputresult = self.data_parser.parse_receipt_output(
            func_name, receipt['output'])
        return outputresult, receipt
コード例 #2
0
def deployPoseidon():
    """
    Deploy the zeth contracts and record the instantiation details.
    """
    print("***********************")

    client = BcosClient()
    abi = [{
        'constant': True,
        'inputs': [{
            'name': 'input',
            'type': 'uint256[]'
        }],
        'name': 'poseidon',
        'outputs': [{
            'name': '',
            'type': 'uint256'
        }],
        'payable': False,
        'stateMutability': 'pure',
        'type': 'function'
    }]
    bin = "0x6120f4808038036000396000f37c01000000000000000000000000000000000000000000000000000000006000350463c4420fb4146200002e57fe5b7f2a605eab3c12c29701b9a8944a16ff3d64c199efa7c857c65e4c0560ab3b0ca16020527f25a8fb283934520d61862db42ab5fbbf21a13613f7e99cae00232a61959d468f60e0527f29f93e7ee3e09f10c2b577ab2056fa0b2694d164866d49122ce17818e2277ec16101a0527f2a101efc715f13fe15729e91c076536903f8718ffac65a04a1fff47e51ed0d6d610260527f23d3d70151df81f917113a847d8e61f4929b7edcc6ba0dfe6bd0116713834d61610320527f2185e429a96435c62e21e7091f4262685769e43fa49c9d40f88c41016c588ada6103e0527f1f5b500f1c0f88bcca0d51538b1a787ccd014eeb3831cecc5752dbb1a5732e756040527f063052928cdf6319a5cb946c2becbe0e4ebc9cc6244c9903a123707e595ebcad610100527f1321691a1c7edf2cdabb0bd4558d82ff697277299f7fec56406566faefd20d246101c0527f141194b8fa596f801dcbd27cd0a1fa45aa8d7a1db367e8f495dc906962b60750610280527f125bcfe7de4c761bea5cc5f06d853f39840c8648e0e321d5ab7dc779252d32a6610340527f1d583a5b54b566e83a38a7667d0a979327e66a3bf403f589b5f24c617d6f1aee610400527f140c27dca8225f48f74d55391032c02a2677a34a51cf8f329b6b1a0076a186316060527f057ccb8d91f4a1fa9e5039cf4f457e364f940cf575259be35c614030535293c6610120527f022588e3bcf16d2f9583ff188e2455e4d77e570a01366b13c3b0e9d1cd3dea276101e0527f0a8bef1519e2b7cc844b0714b71fe093a73334505b6b8e71d731aa1a6a63e9b26102a0527f2cb31f422481e106c8cf448eaa6b61fe07544eff879951baefb03cb91dbc1e3e610360527f14d180bf4c3bb4c109918b8bed15f0f781bfec0e0d63bed877c5ba8d21d78184610420527f2435feebb56e56c96b4d8a90637235e4f769cca19ee5cc0e1c84b4f74490cee36080527f249e9f24440c84e77026b8e111f2e6ca6d124556505b4e5bd5215983b445cbec610140527f2ae7c8d8341fc04509d31c5c3caf7b182cbadd6e89bd80e2a8dd438740a1400c610200527f0980e6aa5e105658acd1eddde95a92ffa1556f142a596b401f48395d47dc5a516102c0527f03c96fb68f083dfafb98c5e09181baf2f94dce618fbc78264bcc6ac102cd6f55610380527f11c3c8fdf6c7cfa26046d59ad05834c854f7f4324fe53f4abfbc9437b3d13082610440527f1cabef035d32194e6327ccafed62049f16340bd6522d0e0cfc04c1f3eb6cb8a460a0527f17250b02a83957b0d036d216114793fe53ef92d12ce1b91666546ac818e40c74610160527f25b1e032d89662f0666956c34f323c344278f370e4ca56409d7acc9098797797610220527f0f4461f42060b27d3b34a34d8a0a2d3d6a3d812f3756dcb19e5b04c689a83a5b6102e0527f1cbe64ac49aebf693279d246b2c8e257e99612512afdb30635f5b99ce579f92e6103a0527f2fd9287af078462bc14f7f1da959e7df7e9a1598b833d3e98cc3552456f8e985610460527f0809febd6b71b85af68e97b3a334b8240e138d95bdec10f96757b1972c74c70360c0527f075c1923454f6b1f87f00b238dbda2323e5ed5885a07d6681c8148aacbc32df8610180527f0af9bf6e54a040be1910bcab732d2a5451e356c9b0e54f196bc962bfa37a5784610240527f0a9346be53c2fa9f7907c52cbf7204de8c1c5dc8b90e2a800c6c1d290ae62c00610300527f2375201a368412e3c2046d85fae310971047afe12b973a429b097e44843eef636103c0527f2ccb8565240997047bef4989cf92c3d2017eb0fa368b135d2d2941c13ddcd324610480527f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f000000160e43560c43560a4356084356064356044357f1fd4a35e68f0946f8f5dfd2ac9d7882ce2466ec1c9766f69b5a14c3f84a17be2878183089150878184089250878185089350878186089450878187089550878188089650508681818082800980090990508682818082800980090991508683818082800980090992508684818082800980090993508685818082800980090994508686818082800980090995506200062960005262001f94565b7f170118300987f2aa8128c6893a7691621b7dd210af7f412385f8d6663782490887818308915087818408925087818508935087818608945087818708955087818808965050868181808280098009099050868281808280098009099150868381808280098009099250868481808280098009099350868581808280098009099450868681808280098009099550620006c460005262001f94565b7f0b734ac64dd2198297d67aab5b9f2dd61ae0a5e169692c8802760c97c1b7b0ed878183089150878184089250878185089350878186089450878187089550878188089650508681818082800980090990508682818082800980090991508683818082800980090992508684818082800980090993508685818082800980090994508686818082800980090995506200075f60005262001f94565b7f1430e42a7b4242b4586f06e9885a444ea4920fac92e2dfbc3cc16ebc2bc3416787818308915087818408925087818508935087818608945087818708955087818808965050868181808280098009099050868281808280098009099150868381808280098009099250868481808280098009099350868581808280098009099450868681808280098009099550620007fa60005262001f94565b7f2d03cefd44927bbfa58fb8a8f22a0686c99db6ea9673e5ae2e3f51016b4d7812878183089150878184089250878185089350878186089450878187089550878188089650508681818082800980090990506200085960005262001f94565b7f27a60ef60d51be502cad8248a0f6ddc28f49ce9e174032bb1a054503691a99b387818308915087818408925087818508935087818608945087818708955087818808965050868181808280098009099050620008b860005262001f94565b7f080a061bb2bc9ebb8c05ecf71fc842c7a09a85d48f5147fdd3bafc8d63a61801878183089150878184089250878185089350878186089450878187089550878188089650508681818082800980090990506200091760005262001f94565b7f0470cb196b0b31dcf0f998c08fd4a2d3784c84625d3d23cd9959c8df3d61a850878183089150878184089250878185089350878186089450878187089550878188089650508681818082800980090990506200097660005262001f94565b7f236a18fd797bcde8ceefd41745367450d80ecaf8fa5da304af8dd07d6c9c4a2f87818308915087818408925087818508935087818608945087818708955087818808965050868181808280098009099050620009d560005262001f94565b7f2da94346d74ec77c4e5f937d2d595070636e2fcdb9349ce0e2c789c9e9d41ae78781830891508781840892508781850893508781860894508781870895508781880896505086818180828009800909905062000a3460005262001f94565b7f278c16574216dd6780c4233d2e8bc1f90a76442f4fed1678d91a38f26a169f1d8781830891508781840892508781850893508781860894508781870895508781880896505086818180828009800909905062000a9360005262001f94565b7f0aba88ce0a5f3f57c82b73cc72d86f0182a5ebbf61236cf2d67e3903428f105c8781830891508781840892508781850893508781860894508781870895508781880896505086818180828009800909905062000af260005262001f94565b7f13d45f17ebd7bd267612d1c7d028c3ef2380ee77838b1809039156e45ea399da8781830891508781840892508781850893508781860894508781870895508781880896505086818180828009800909905062000b5160005262001f94565b7f2d7a5202c14dd920b8382ce02653223d81eeeba9e2a27473af50810482e01dd78781830891508781840892508781850893508781860894508781870895508781880896505086818180828009800909905062000bb060005262001f94565b7f245a0767c5b055812467f081108f7dfee5dcfc10f80079da8e941c77cc13db688781830891508781840892508781850893508781860894508781870895508781880896505086818180828009800909905062000c0f60005262001f94565b7f2c59e967a2d4ea6770593f65039451741d23b5da99dc8042070a39907478b66e8781830891508781840892508781850893508781860894508781870895508781880896505086818180828009800909905062000c6e60005262001f94565b7f24c85e48d7afe1001e8f66c6dd31213b4288933a0ad379864f16743df2c980038781830891508781840892508781850893508781860894508781870895508781880896505086818180828009800909905062000ccd60005262001f94565b7f227cd523af710c598ecab087c2843100f7a9738c3d488c007e428d91b1f337668781830891508781840892508781850893508781860894508781870895508781880896505086818180828009800909905062000d2c60005262001f94565b7f2559fff5296c533ad4c7c6e1c88b9c69980b197513e317db5402d492799eeb9f8781830891508781840892508781850893508781860894508781870895508781880896505086818180828009800909905062000d8b60005262001f94565b7f02a601bfc4da9459e9718fe6b926c0e175e63aa2217abf643dc9e0757d7ef1548781830891508781840892508781850893508781860894508781870895508781880896505086818180828009800909905062000dea60005262001f94565b7f0da58042d5874668e8e0f3a278dfc8c8b08ccfbf5b4257ed2832affb60cb41128781830891508781840892508781850893508781860894508781870895508781880896505086818180828009800909905062000e4960005262001f94565b7f2e6fdd26eac7bf454187dee626ab4b3f421739e8318796503f16da5691f1bed98781830891508781840892508781850893508781860894508781870895508781880896505086818180828009800909905062000ea860005262001f94565b7f21be0174899457628eb771a9505580d1e4ef36ffb502219a2f43351b18d2784e8781830891508781840892508781850893508781860894508781870895508781880896505086818180828009800909905062000f0760005262001f94565b7f2133b63278501b60e86883b00a54619ccf4a7cf07702dea240f53b19005f5a368781830891508781840892508781850893508781860894508781870895508781880896505086818180828009800909905062000f6660005262001f94565b7f21841c731a220c4817edefba29768e949c0b519bb8e320fab91d0c18a102bc188781830891508781840892508781850893508781860894508781870895508781880896505086818180828009800909905062000fc560005262001f94565b7f18b6901831fde10bda86893ae8cbd9f9da5af120dc44c89f5152926c28f2ed2f878183089150878184089250878185089350878186089450878187089550878188089650508681818082800980090990506200102460005262001f94565b7f2ec53e23654ad18aca5c584b2eac05eb7d4db203b23ca6620ec475a8795d4202878183089150878184089250878185089350878186089450878187089550878188089650508681818082800980090990506200108360005262001f94565b7f2c939494de2138a2ca5e19ce4b67cdffce49ed1107248aa5edb6e12c7d28df7787818308915087818408925087818508935087818608945087818708955087818808965050868181808280098009099050620010e260005262001f94565b7f0623ee7891199514435ad1ff285fb74fd43a7bb0dae62dbbdb36aff96e508972878183089150878184089250878185089350878186089450878187089550878188089650508681818082800980090990506200114160005262001f94565b7f22c8292e61a9bddf3d205cb50a7a4d29b06c431e53ec8fbaad8a73dd4104c64a87818308915087818408925087818508935087818608945087818708955087818808965050868181808280098009099050620011a060005262001f94565b7f0d51b55ec1f59f569076ecff66ba152b07679bc50dad6cd703b46b95e1cbd7e287818308915087818408925087818508935087818608945087818708955087818808965050868181808280098009099050620011ff60005262001f94565b7f27154bbfb0588b6f36300701b00213556cb869bb368c63d1ded2a8416e273c0d878183089150878184089250878185089350878186089450878187089550878188089650508681818082800980090990506200125e60005262001f94565b7f17b1370ccffe479909b0c1f7dc671b344494342940019105b90562cc4228eb5c87818308915087818408925087818508935087818608945087818708955087818808965050868181808280098009099050620012bd60005262001f94565b7f20ff783c31f906b9d0a4ae973600ee91e99e4565100c310065c27d0127059074878183089150878184089250878185089350878186089450878187089550878188089650508681818082800980090990506200131c60005262001f94565b7f13c45ba44e91db74e719b45a15914640283f1db32e1a4304667bcf67230c615b878183089150878184089250878185089350878186089450878187089550878188089650508681818082800980090990506200137b60005262001f94565b7f29cfab68a5620b3760e361caac37294ec856607f2729f2403af22ae485fe48ba87818308915087818408925087818508935087818608945087818708955087818808965050868181808280098009099050620013da60005262001f94565b7f1380cf7791392e856692cd802e0820e89d319fe8b262dffb8abd00cc83d10f27878183089150878184089250878185089350878186089450878187089550878188089650508681818082800980090990506200143960005262001f94565b7f2d9d9fdcac77dd461f1b159edc18eac9e53a01172733e042fe4ab39f76d4939b878183089150878184089250878185089350878186089450878187089550878188089650508681818082800980090990506200149860005262001f94565b7e28701c995d998357f61aae3b02a6764caf807a024ba0478965be12256d62a087818308915087818408925087818508935087818608945087818708955087818808965050868181808280098009099050620014f660005262001f94565b7f06268de0019eb6197fd8b34ca05a250aa2215a169f66b89acc7c70bbbdd26591878183089150878184089250878185089350878186089450878187089550878188089650508681818082800980090990506200155560005262001f94565b7f1b8191c81911bb23fd08d9f32c9cfc39d498d937c2cf2b4a286ce463f735e1b587818308915087818408925087818508935087818608945087818708955087818808965050868181808280098009099050620015b460005262001f94565b7f05a7f29c502bbc907f811b53e6901a4598539d0b2404c2c0f998bdc51d877216878183089150878184089250878185089350878186089450878187089550878188089650508681818082800980090990506200161360005262001f94565b7f164d0f7cbcdfd7c008c3ad541f1eb04374cdce427af07abbd20abb3c5f47e322878183089150878184089250878185089350878186089450878187089550878188089650508681818082800980090990506200167260005262001f94565b7f096f6dad4af11aef93cd170b131dc5ca907f1554edb860a2183b8f387bbfc49387818308915087818408925087818508935087818608945087818708955087818808965050868181808280098009099050620016d160005262001f94565b7f0aef194b2253cc03deb323029aa3d280cfc3bba70dbe35ebc76c4e5efb28f44c878183089150878184089250878185089350878186089450878187089550878188089650508681818082800980090990506200173060005262001f94565b7f2739ce523e8ac7040f41978fcb09a61fc893f489a7ac63b7dc2b666a0450b8b7878183089150878184089250878185089350878186089450878187089550878188089650508681818082800980090990506200178f60005262001f94565b7f0dda954b88b4662b7228ea53dfc0035cf1c3e54a3eff951ed20eddf50abd007087818308915087818408925087818508935087818608945087818708955087818808965050868181808280098009099050620017ee60005262001f94565b7f06013c9903173cc6bf78d659ddc7ddde597add8f66b4adf14fd0fdd2aea80b42878183089150878184089250878185089350878186089450878187089550878188089650508681818082800980090990506200184d60005262001f94565b7f2a44a05caa05df06a56f318ae930c0f5b1238eff2cc641442940c42125e3b1d887818308915087818408925087818508935087818608945087818708955087818808965050868181808280098009099050620018ac60005262001f94565b7f14c09ffabca71eaed84af10167d78bb3e29f0bbbf2d4a7537e046b0b81a560c4878183089150878184089250878185089350878186089450878187089550878188089650508681818082800980090990506200190b60005262001f94565b7f142aaa6de3cf63bb4172a80f539bf5ecd9a42802d39bce5d3728e9bcde35a55a878183089150878184089250878185089350878186089450878187089550878188089650508681818082800980090990506200196a60005262001f94565b7f06cea3644ef4942b5b898426b6c4845162e327a2ba7660cf2dca68f1ea3ab82a87818308915087818408925087818508935087818608945087818708955087818808965050868181808280098009099050620019c960005262001f94565b7f0fd2f28081191b6e436ee90785b22c924bc5936d6ff57c6e5d58f30a83dd46378781830891508781840892508781850893508781860894508781870895508781880896505086818180828009800909905062001a2860005262001f94565b7f1f138e07b3bd619267c920f1b52bf311de510f7b04b7c6575bc19dac05286c858781830891508781840892508781850893508781860894508781870895508781880896505086818180828009800909905062001a8760005262001f94565b7f1f3a2010c0091c2bf3cdd2834b1480186f4e474b4178af042d82122a69ee1b698781830891508781840892508781850893508781860894508781870895508781880896505086818180828009800909905062001ae660005262001f94565b7f1a33927f88bde3319be2cc152435e2ca4b055462321224031404d350be0d03d48781830891508781840892508781850893508781860894508781870895508781880896505086818180828009800909905062001b4560005262001f94565b7f15aa17ff60cb072ec045ab101d2eaf64a7ad4cb59493994b4354eef81e7841bf8781830891508781840892508781850893508781860894508781870895508781880896505086818180828009800909905062001ba460005262001f94565b7f16742ccf030b475a60958dc351e00eb04c088b74d90ba19cd0dc52ff1d8f71788781830891508781840892508781850893508781860894508781870895508781880896505086818180828009800909905062001c0360005262001f94565b7f2c03e4f03286941a2ce351f9aad0db78cc42c0b4047849321162da82970b7bd58781830891508781840892508781850893508781860894508781870895508781880896505086818180828009800909905062001c6260005262001f94565b7f1a03612ed3fe94958cf4f636e636b4742f8a967ef0d897fe140581ff2107ee4f8781830891508781840892508781850893508781860894508781870895508781880896505086818180828009800909905062001cc160005262001f94565b7f1852fd3c50e032d8cb1185165dd9f4c38d6a43094d5686e2eec4d8dbc62966178781830891508781840892508781850893508781860894508781870895508781880896505086818180828009800909905062001d2060005262001f94565b7ea0d0c4017ec6d8e48c88026c5574218b85ca4bb416fe7dd5301f0cf4963a638781830891508781840892508781850893508781860894508781870895508781880896505086818180828009800909905086828180828009800909915086838180828009800909925086848180828009800909935086858180828009800909945086868180828009800909955062001dba60005262001f94565b7f2aff97dafead01e68ee8bfcbdb0079f19483cb551634d05dcc52344a35695e608781830891508781840892508781850893508781860894508781870895508781880896505086818180828009800909905086828180828009800909915086838180828009800909925086848180828009800909935086858180828009800909945086868180828009800909955062001e5560005262001f94565b7f1fe380a3a0814b5ec3bd91dfa1d95992cffdd77ec0341b95b8f6b3509d2670018781830891508781840892508781850893508781860894508781870895508781880896505086818180828009800909905086828180828009800909915086838180828009800909925086848180828009800909935086858180828009800909945086868180828009800909955062001ef060005262001f94565b7f1783668830df79d79707da6a0e7c023c5f54a112be7ee3f7d49b420213ab7f648781830891508781840892508781850893508781860894508781870895508781880896505086818180828009800909905086828180828009800909915086838180828009800909925086848180828009800909935086858180828009800909945086868180828009800909955062001f8b60005262001f94565b60005260206000f35b8660205182098760405184098891088760605185098891088760805186098891088760a05187098891088760c05188098891088760e05183098861010051850989910888610120518609899108886101405187098991088861016051880989910888610180518909899108886101a0518409896101c05186098a9108896101e05187098a9108896102005188098a9108896102205189098a910889610240518a098a9108896102605185098a6102805187098b91088a6102a05188098b91088a6102c05189098b91088a6102e0518a098b91088a610300518b098b91088a6103205186098b6103405188098c91088b6103605189098c91088b610380518a098c91088b6103a0518b098c91088b6103c0518c098c91088b6103e05187098c6104005189098d91088c610420518a098d91088c610440518b098d91088c610460518c098d91088c610480518d098d91089a509850965094509250905060005156"

    mixerTransactionRecipient = client.sendRawTransactionGetReceipt(
        "", abi, None, None, bin)
    poseidon_address = mixerTransactionRecipient['contractAddress']
    print(f"deploy: poseidon_address={poseidon_address}")
    # print(contract_result)

    return poseidon_address
コード例 #3
0
ファイル: HelloWorld.py プロジェクト: youwenbusi/zk-client
class HelloWorld:  # name of abi
    address = None
    contract_abi_string = '''[{"constant": false, "inputs": [{"name": "n", "type": "string"}], "name": "set", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": true, "inputs": [], "name": "get", "outputs": [{"name": "", "type": "string"}], "payable": false, "stateMutability": "view", "type": "function"}, {"inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor"}, {"anonymous": false, "inputs": [{"indexed": false, "name": "newname", "type": "string"}], "name": "onset", "type": "event", "topic": "0xafb180742c1292ea5d67c4f6d51283ecb11e49f8389f4539bef82135d689e118"}]'''
    contract_abi = None
    data_parser = DatatypeParser()
    client = None

    def __init__(self, address):
        self.client = BcosClient()
        self.address = address
        self.contract_abi = json.loads(self.contract_abi_string)
        self.data_parser.set_abi(self.contract_abi)

    def deploy(self, contract_bin_file):
        result = self.client.deployFromFile(contract_bin_file)
        self.address = result["contractAddress"]
        return result

    # ------------------------------------------
    def set(self, n):
        func_name = 'set'
        args = [n]
        receipt = self.client.sendRawTransactionGetReceipt(
            self.address, self.contract_abi, func_name, args)
        outputresult = self.data_parser.parse_receipt_output(
            func_name, receipt['output'])
        return outputresult, receipt

    # ------------------------------------------
    def get(self):
        func_name = 'get'
        args = []
        result = self.client.call(self.address, self.contract_abi, func_name,
                                  args)
        return result
コード例 #4
0
def deploy(
    token_address: Optional[str],
    poseidon_address: Optional[str],
):
    """
    Deploy the zeth contracts and record the instantiation details.
    """
    zksnark = get_zksnark_provider("GROTH16")
    prover_client = ProverClient(PROVER_SERVER_ENDPOINT_DEFAULT)
    vk_obj = prover_client.get_verification_key()
    vk_json = zksnark.parse_verification_key(vk_obj)
    #print("VK.json: ", vk_json)

    print("Received VK, writing verification key...")
    write_verification_key(vk_json)
    verification_key_params = zksnark.verification_key_parameters(vk_json)

    constructArgs = [
        5,
        to_checksum_address(token_address),
        to_checksum_address(poseidon_address),
        verification_key_params['Alpha'], verification_key_params['Beta1'],
        verification_key_params['Beta2'], verification_key_params['Delta1'],
        verification_key_params['Delta2'],
        verification_key_params['ABC_coords']
    ]

    si = Groth16Mixer("")
    '''
    fo = open("./contract/mixer/abi/Groth16Mixer.abi")
    abistring = fo.read()
    abi = json.loads(abistring)
    fo.close()
    f1 = open("./contract/mixer/abi/Groth16Mixer.bin")
    bin = f1.read()
    f1.close()
    '''

    with open("./contract/mixer/abi/Groth16Mixer1.abi", "r") as abistring:
        abistr = abistring.readlines()[0]
        abi = ast.literal_eval(abistr)
    with open("./contract/mixer/abi/Groth16Mixer.bin", "r") as binstring:
        binstr = binstring.readlines()[0]

    client = BcosClient()
    mixerTransactionRecipient = client.sendRawTransactionGetReceipt(
        "", abi, None, constructArgs, binstr)
    mixer_address = mixerTransactionRecipient['contractAddress']
    print(f"deploy: mixer_address={mixer_address}")
    #mixer_instance = Groth16Mixer(address)
    return mixer_address
コード例 #5
0
def deploy_asset(description, shortName, minUnit, totalAmount: Optional[int]):
    """
    Deploy the zeth contracts and record the instantiation details.
    """
    # description, string memory shortName, uint8 minUnit, uint256 totalAmount
    constructArgs = [description, shortName, 18, totalAmount]
    abi = []
    binstr = ""
    # with open("./contract/bac/abi/BAC001.abi", "r") as abistring:
    #     abistr = abistring.readlines()[0]
    #     abi = ast.literal_eval(abistr)
    # with open("./contract/bac/abi/BAC001.bin", "r") as binstring:
    #     binstr = binstring.readlines()[0]
    '''
    fo = open("./contract/bac/abi/BAC001.abi")
    abistring = fo.read()
    abi = json.loads(abistring)
    fo.close()
    f1 = open("./contract/bac/abi/BAC001.bin")
    bin = f1.read()
    f1.close()
    '''
    abi = [{
        "inputs": [{
            "internalType": "string",
            "name": "description",
            "type": "string"
        }, {
            "internalType": "string",
            "name": "shortName",
            "type": "string"
        }, {
            "internalType": "uint8",
            "name": "minUnit",
            "type": "uint8"
        }, {
            "internalType": "uint256",
            "name": "totalAmount",
            "type": "uint256"
        }],
        "payable":
        False,
        "stateMutability":
        "nonpayable",
        "type":
        "constructor"
    }, {
        "anonymous":
        False,
        "inputs": [{
            "indexed": True,
            "internalType": "address",
            "name": "owner",
            "type": "address"
        }, {
            "indexed": True,
            "internalType": "address",
            "name": "spender",
            "type": "address"
        }, {
            "indexed": False,
            "internalType": "uint256",
            "name": "value",
            "type": "uint256"
        }],
        "name":
        "Approval",
        "type":
        "event"
    }, {
        "anonymous":
        False,
        "inputs": [{
            "indexed": True,
            "internalType": "address",
            "name": "account",
            "type": "address"
        }],
        "name":
        "IssuerAdded",
        "type":
        "event"
    }, {
        "anonymous":
        False,
        "inputs": [{
            "indexed": True,
            "internalType": "address",
            "name": "account",
            "type": "address"
        }],
        "name":
        "IssuerRemoved",
        "type":
        "event"
    }, {
        "anonymous":
        False,
        "inputs": [{
            "indexed": True,
            "internalType": "address",
            "name": "from",
            "type": "address"
        }, {
            "indexed": True,
            "internalType": "address",
            "name": "to",
            "type": "address"
        }, {
            "indexed": False,
            "internalType": "uint256",
            "name": "value",
            "type": "uint256"
        }, {
            "indexed": False,
            "internalType": "bytes",
            "name": "data",
            "type": "bytes"
        }],
        "name":
        "Send",
        "type":
        "event"
    }, {
        "anonymous":
        False,
        "inputs": [{
            "indexed": False,
            "internalType": "address",
            "name": "account",
            "type": "address"
        }],
        "name":
        "Suspended",
        "type":
        "event"
    }, {
        "anonymous":
        False,
        "inputs": [{
            "indexed": True,
            "internalType": "address",
            "name": "account",
            "type": "address"
        }],
        "name":
        "SuspenderAdded",
        "type":
        "event"
    }, {
        "anonymous":
        False,
        "inputs": [{
            "indexed": True,
            "internalType": "address",
            "name": "account",
            "type": "address"
        }],
        "name":
        "SuspenderRemoved",
        "type":
        "event"
    }, {
        "anonymous":
        False,
        "inputs": [{
            "indexed": False,
            "internalType": "address",
            "name": "account",
            "type": "address"
        }],
        "name":
        "UnSuspended",
        "type":
        "event"
    }, {
        "constant":
        False,
        "inputs": [{
            "internalType": "address",
            "name": "account",
            "type": "address"
        }],
        "name":
        "addIssuer",
        "outputs": [],
        "payable":
        False,
        "stateMutability":
        "nonpayable",
        "type":
        "function"
    }, {
        "constant":
        False,
        "inputs": [{
            "internalType": "address",
            "name": "account",
            "type": "address"
        }],
        "name":
        "addSuspender",
        "outputs": [],
        "payable":
        False,
        "stateMutability":
        "nonpayable",
        "type":
        "function"
    }, {
        "constant":
        True,
        "inputs": [{
            "internalType": "address",
            "name": "owner",
            "type": "address"
        }, {
            "internalType": "address",
            "name": "spender",
            "type": "address"
        }],
        "name":
        "allowance",
        "outputs": [{
            "internalType": "uint256",
            "name": "",
            "type": "uint256"
        }],
        "payable":
        False,
        "stateMutability":
        "view",
        "type":
        "function"
    }, {
        "constant":
        False,
        "inputs": [{
            "internalType": "address",
            "name": "spender",
            "type": "address"
        }, {
            "internalType": "uint256",
            "name": "value",
            "type": "uint256"
        }],
        "name":
        "approve",
        "outputs": [{
            "internalType": "bool",
            "name": "",
            "type": "bool"
        }],
        "payable":
        False,
        "stateMutability":
        "nonpayable",
        "type":
        "function"
    }, {
        "constant":
        True,
        "inputs": [{
            "internalType": "address",
            "name": "owner",
            "type": "address"
        }],
        "name":
        "balance",
        "outputs": [{
            "internalType": "uint256",
            "name": "",
            "type": "uint256"
        }],
        "payable":
        False,
        "stateMutability":
        "view",
        "type":
        "function"
    }, {
        "constant":
        False,
        "inputs": [{
            "internalType": "address[]",
            "name": "to",
            "type": "address[]"
        }, {
            "internalType": "uint256[]",
            "name": "values",
            "type": "uint256[]"
        }, {
            "internalType": "bytes",
            "name": "data",
            "type": "bytes"
        }],
        "name":
        "batchSend",
        "outputs": [],
        "payable":
        False,
        "stateMutability":
        "nonpayable",
        "type":
        "function"
    }, {
        "constant":
        False,
        "inputs": [{
            "internalType": "address",
            "name": "spender",
            "type": "address"
        }, {
            "internalType": "uint256",
            "name": "subtractedValue",
            "type": "uint256"
        }],
        "name":
        "decreaseAllowance",
        "outputs": [{
            "internalType": "bool",
            "name": "",
            "type": "bool"
        }],
        "payable":
        False,
        "stateMutability":
        "nonpayable",
        "type":
        "function"
    }, {
        "constant":
        True,
        "inputs": [],
        "name":
        "description",
        "outputs": [{
            "internalType": "string",
            "name": "",
            "type": "string"
        }],
        "payable":
        False,
        "stateMutability":
        "view",
        "type":
        "function"
    }, {
        "constant":
        False,
        "inputs": [{
            "internalType": "uint256",
            "name": "value",
            "type": "uint256"
        }, {
            "internalType": "bytes",
            "name": "data",
            "type": "bytes"
        }],
        "name":
        "destroy",
        "outputs": [],
        "payable":
        False,
        "stateMutability":
        "nonpayable",
        "type":
        "function"
    }, {
        "constant":
        False,
        "inputs": [{
            "internalType": "address",
            "name": "from",
            "type": "address"
        }, {
            "internalType": "uint256",
            "name": "value",
            "type": "uint256"
        }, {
            "internalType": "bytes",
            "name": "data",
            "type": "bytes"
        }],
        "name":
        "destroyFrom",
        "outputs": [],
        "payable":
        False,
        "stateMutability":
        "nonpayable",
        "type":
        "function"
    }, {
        "constant":
        False,
        "inputs": [{
            "internalType": "address",
            "name": "spender",
            "type": "address"
        }, {
            "internalType": "uint256",
            "name": "addedValue",
            "type": "uint256"
        }],
        "name":
        "increaseAllowance",
        "outputs": [{
            "internalType": "bool",
            "name": "",
            "type": "bool"
        }],
        "payable":
        False,
        "stateMutability":
        "nonpayable",
        "type":
        "function"
    }, {
        "constant":
        True,
        "inputs": [{
            "internalType": "address",
            "name": "account",
            "type": "address"
        }],
        "name":
        "isIssuer",
        "outputs": [{
            "internalType": "bool",
            "name": "",
            "type": "bool"
        }],
        "payable":
        False,
        "stateMutability":
        "view",
        "type":
        "function"
    }, {
        "constant":
        True,
        "inputs": [{
            "internalType": "address",
            "name": "account",
            "type": "address"
        }],
        "name":
        "isSuspender",
        "outputs": [{
            "internalType": "bool",
            "name": "",
            "type": "bool"
        }],
        "payable":
        False,
        "stateMutability":
        "view",
        "type":
        "function"
    }, {
        "constant":
        False,
        "inputs": [{
            "internalType": "address",
            "name": "to",
            "type": "address"
        }, {
            "internalType": "uint256",
            "name": "value",
            "type": "uint256"
        }, {
            "internalType": "bytes",
            "name": "data",
            "type": "bytes"
        }],
        "name":
        "issue",
        "outputs": [{
            "internalType": "bool",
            "name": "",
            "type": "bool"
        }],
        "payable":
        False,
        "stateMutability":
        "nonpayable",
        "type":
        "function"
    }, {
        "constant": True,
        "inputs": [],
        "name": "minUnit",
        "outputs": [{
            "internalType": "uint8",
            "name": "",
            "type": "uint8"
        }],
        "payable": False,
        "stateMutability": "view",
        "type": "function"
    }, {
        "constant": False,
        "inputs": [],
        "name": "renounceIssuer",
        "outputs": [],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function"
    }, {
        "constant": False,
        "inputs": [],
        "name": "renounceSuspender",
        "outputs": [],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function"
    }, {
        "constant":
        False,
        "inputs": [{
            "internalType": "address",
            "name": "to",
            "type": "address"
        }, {
            "internalType": "uint256",
            "name": "value",
            "type": "uint256"
        }, {
            "internalType": "bytes",
            "name": "data",
            "type": "bytes"
        }],
        "name":
        "send",
        "outputs": [],
        "payable":
        False,
        "stateMutability":
        "nonpayable",
        "type":
        "function"
    }, {
        "constant":
        False,
        "inputs": [{
            "internalType": "address",
            "name": "from",
            "type": "address"
        }, {
            "internalType": "address",
            "name": "to",
            "type": "address"
        }, {
            "internalType": "uint256",
            "name": "value",
            "type": "uint256"
        }, {
            "internalType": "bytes",
            "name": "data",
            "type": "bytes"
        }],
        "name":
        "sendFrom",
        "outputs": [],
        "payable":
        False,
        "stateMutability":
        "nonpayable",
        "type":
        "function"
    }, {
        "constant":
        True,
        "inputs": [],
        "name":
        "shortName",
        "outputs": [{
            "internalType": "string",
            "name": "",
            "type": "string"
        }],
        "payable":
        False,
        "stateMutability":
        "view",
        "type":
        "function"
    }, {
        "constant": False,
        "inputs": [],
        "name": "suspend",
        "outputs": [],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function"
    }, {
        "constant": True,
        "inputs": [],
        "name": "suspended",
        "outputs": [{
            "internalType": "bool",
            "name": "",
            "type": "bool"
        }],
        "payable": False,
        "stateMutability": "view",
        "type": "function"
    }, {
        "constant":
        True,
        "inputs": [],
        "name":
        "totalAmount",
        "outputs": [{
            "internalType": "uint256",
            "name": "",
            "type": "uint256"
        }],
        "payable":
        False,
        "stateMutability":
        "view",
        "type":
        "function"
    }, {
        "constant": False,
        "inputs": [],
        "name": "unSuspend",
        "outputs": [],
        "payable": False,
        "stateMutability": "nonpayable",
        "type": "function"
    }]
    bin = "60806040523480156200001157600080fd5b506040516200358d3803806200358d833981810160405260808110156200003757600080fd5b81019080805160405193929190846401000000008211156200005857600080fd5b838201915060208201858111156200006f57600080fd5b82518660018202830111640100000000821117156200008d57600080fd5b8083526020830192505050908051906020019080838360005b83811015620000c3578082015181840152602081019050620000a6565b50505050905090810190601f168015620000f15780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200011557600080fd5b838201915060208201858111156200012c57600080fd5b82518660018202830111640100000000821117156200014a57600080fd5b8083526020830192505050908051906020019080838360005b838110156200018057808201518184015260208101905062000163565b50505050905090810190601f168015620001ae5780820380516001836020036101000a031916815260200191505b506040526020018051906020019092919080519060200190929190505050620001dd336200028a60201b60201c565b620001ee33620002eb60201b60201c565b6000600260006101000a81548160ff021916908315150217905550836006908051906020019062000221929190620007ba565b5082600790805190602001906200023a929190620007ba565b5081600860006101000a81548160ff021916908360ff16021790555062000280338360ff16600a0a8302604051806020016040528060008152506200034c60201b60201c565b5050505062000869565b620002a58160006200056d60201b620029411790919060201c565b8073ffffffffffffffffffffffffffffffffffffffff167f05e7c881d716bee8cb7ed92293133ba156704252439e5c502c277448f04e20c260405160405180910390a250565b620003068160016200056d60201b620029411790919060201c565b8073ffffffffffffffffffffffffffffffffffffffff167ff4fbb5a5e62a703643fe5be0722720f728980fdde74f11d76eca7e13bdc3301d60405160405180910390a250565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415620003d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806200354a6021913960400191505060405180910390fd5b620003f0826005546200065160201b62001eff1790919060201c565b6005819055506200044f82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546200065160201b62001eff1790919060201c565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f76d4fc8756cf1c2b5aa667285d8c20b304dcd86209b4c34a84fc491867de76f184846040518083815260200180602001828103825283818151815260200191508051906020019080838360005b838110156200052c5780820151818401526020810190506200050f565b50505050905090810190601f1680156200055a5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3505050565b6200057f8282620006da60201b60201c565b15620005f3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f526f6c65733a206163636f756e7420616c72656164792068617320726f6c650081525060200191505060405180910390fd5b60018260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b600080828401905083811015620006d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141562000763576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806200356b6022913960400191505060405180910390fd5b8260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620007fd57805160ff19168380011785556200082e565b828001600101855582156200082e579182015b828111156200082d57825182559160200191906001019062000810565b5b5090506200083d919062000841565b5090565b6200086691905b808211156200086257600081600090555060010162000848565b5090565b90565b612cd180620008796000396000f3fe608060405234801561001057600080fd5b50600436106101585760003560e01c80639126d03c116100c3578063c83503621161007c578063c835036214610a39578063d0e7d61114610abc578063d7fb71c914610bc1578063dd62ed3e14610bcb578063e3d670d714610c43578063e6400bbe14610c9b57610158565b80639126d03c14610767578063938050e1146107c35780639bd9bbc6146107cd5780639cb35cbd146108b2578063a457c2d7146108d6578063bb3acde91461093c57610158565b8063452dee2811610115578063452dee28146105335780634ef7902e1461053d57806357a70df814610622578063702efdf3146106665780637284e41614610688578063877b9a671461070b57610158565b806303dfd47c1461015d578063095ea7b3146102225780631a39d8ef1461028857806320694db0146102a657806337f26e5b146102ea57806339509351146104cd575b600080fd5b6102206004803603604081101561017357600080fd5b81019080803590602001909291908035906020019064010000000081111561019a57600080fd5b8201836020820111156101ac57600080fd5b803590602001918460018302840111640100000000831117156101ce57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610ca5565b005b61026e6004803603604081101561023857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610cb4565b604051808215151515815260200191505060405180910390f35b610290610d4e565b6040518082815260200191505060405180910390f35b6102e8600480360360208110156102bc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d58565b005b6104cb6004803603606081101561030057600080fd5b810190808035906020019064010000000081111561031d57600080fd5b82018360208201111561032f57600080fd5b8035906020019184602083028401116401000000008311171561035157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156103b157600080fd5b8201836020820111156103c357600080fd5b803590602001918460208302840111640100000000831117156103e557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561044557600080fd5b82018360208201111561045757600080fd5b8035906020019184600183028401116401000000008311171561047957600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610dc2565b005b610519600480360360408110156104e357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f89565b604051808215151515815260200191505060405180910390f35b61053b6110b1565b005b6106206004803603606081101561055357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561059a57600080fd5b8201836020820111156105ac57600080fd5b803590602001918460018302840111640100000000831117156105ce57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050506110bc565b005b6106646004803603602081101561063857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110cc565b005b61066e611136565b604051808215151515815260200191505060405180910390f35b61069061114d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156106d05780820151818401526020810190506106b5565b50505050905090810190601f1680156106fd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61074d6004803603602081101561072157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111ef565b604051808215151515815260200191505060405180910390f35b6107a96004803603602081101561077d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061120c565b604051808215151515815260200191505060405180910390f35b6107cb611229565b005b6108b0600480360360608110156107e357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561082a57600080fd5b82018360208201111561083c57600080fd5b8035906020019184600183028401116401000000008311171561085e57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611234565b005b6108ba611329565b604051808260ff1660ff16815260200191505060405180910390f35b610922600480360360408110156108ec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611340565b604051808215151515815260200191505060405180910390f35b610a1f6004803603606081101561095257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561099957600080fd5b8201836020820111156109ab57600080fd5b803590602001918460018302840111640100000000831117156109cd57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611468565b604051808215151515815260200191505060405180910390f35b610a416114de565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610a81578082015181840152602081019050610a66565b50505050905090810190601f168015610aae5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610bbf60048036036080811015610ad257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190640100000000811115610b3957600080fd5b820183602082011115610b4b57600080fd5b80359060200191846001830284011164010000000083111715610b6d57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611580565b005b610bc961170f565b005b610c2d60048036036040811015610be157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061186f565b6040518082815260200191505060405180910390f35b610c8560048036036020811015610c5957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118f6565b6040518082815260200191505060405180910390f35b610ca361193f565b005b610cb0338383611aa0565b5050565b6000600260009054906101000a900460ff1615610d39576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f53757370656e6461626c653a2073757370656e6465640000000000000000000081525060200191505060405180910390fd5b610d44338484611cae565b6001905092915050565b6000600554905090565b610d61336111ef565b610db6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180612bd36030913960400191505060405180910390fd5b610dbf81611ea5565b50565b600260009054906101000a900460ff1615610e45576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f53757370656e6461626c653a2073757370656e6465640000000000000000000081525060200191505060405180910390fd5b8151835114610e9f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612b886026913960400191505060405180910390fd5b60008090505b8351811015610f8357600073ffffffffffffffffffffffffffffffffffffffff16848281518110610ed257fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff161415610f47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612bae6025913960400191505060405180910390fd5b610f78848281518110610f5657fe5b6020026020010151848381518110610f6a57fe5b602002602001015184611234565b806001019050610ea5565b50505050565b6000600260009054906101000a900460ff161561100e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f53757370656e6461626c653a2073757370656e6465640000000000000000000081525060200191505060405180910390fd5b6110a733846110a285600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eff90919063ffffffff16565b611cae565b6001905092915050565b6110ba33611f87565b565b6110c7838383611fe1565b505050565b6110d53361120c565b61112a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526036815260200180612c036036913960400191505060405180910390fd5b6111338161208a565b50565b6000600260009054906101000a900460ff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111e55780601f106111ba576101008083540402835291602001916111e5565b820191906000526020600020905b8154815290600101906020018083116111c857829003601f168201915b5050505050905090565b60006112058260006120e490919063ffffffff16565b9050919050565b60006112228260016120e490919063ffffffff16565b9050919050565b611232336121c2565b565b600260009054906101000a900460ff16156112b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f53757370656e6461626c653a2073757370656e6465640000000000000000000081525060200191505060405180910390fd5b6112c33384848461221c565b6112cf338484846124c1565b611324576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180612b10602e913960400191505060405180910390fd5b505050565b6000600860009054906101000a900460ff16905090565b6000600260009054906101000a900460ff16156113c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f53757370656e6461626c653a2073757370656e6465640000000000000000000081525060200191505060405180910390fd5b61145e338461145985600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126aa90919063ffffffff16565b611cae565b6001905092915050565b6000611473336111ef565b6114c8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180612bd36030913960400191505060405180910390fd5b6114d3848484612733565b600190509392505050565b606060078054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156115765780601f1061154b57610100808354040283529160200191611576565b820191906000526020600020905b81548152906001019060200180831161155957829003601f168201915b5050505050905090565b600260009054906101000a900460ff1615611603576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f53757370656e6461626c653a2073757370656e6465640000000000000000000081525060200191505060405180910390fd5b61160f8484848461221c565b6116a884336116a385600460008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126aa90919063ffffffff16565b611cae565b6116b4848484846124c1565b611709576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180612b10602e913960400191505060405180910390fd5b50505050565b6117183361120c565b61176d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526036815260200180612c036036913960400191505060405180910390fd5b600260009054906101000a900460ff166117ef576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f53757370656e6461626c653a206e6f742073757370656e64656400000000000081525060200191505060405180910390fd5b6000600260006101000a81548160ff0219169083151502179055507f349b4285cb8dde314c53fd9d8e8e578381a7375e4f76f9dd9fe07f9960f120a433604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6119483361120c565b61199d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526036815260200180612c036036913960400191505060405180910390fd5b600260009054906101000a900460ff1615611a20576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f53757370656e6461626c653a2073757370656e6465640000000000000000000081525060200191505060405180910390fd5b6001600260006101000a81548160ff0219169083151502179055507f6f123d3d54c84a7960a573b31c221dcd86e13fd849c5adb0c6ca851468cc1ae433604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611b26576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b636025913960400191505060405180910390fd5b611b3b826005546126aa90919063ffffffff16565b600581905550611b9382600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126aa90919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f76d4fc8756cf1c2b5aa667285d8c20b304dcd86209b4c34a84fc491867de76f184846040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611c6e578082015181840152602081019050611c53565b50505050905090810190601f168015611c9b5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611d34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b3e6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611dba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612aed6023913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b611eb981600061294190919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f05e7c881d716bee8cb7ed92293133ba156704252439e5c502c277448f04e20c260405160405180910390a250565b600080828401905083811015611f7d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b611f9b816001612a1c90919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f17eb45856cd2283111eeb8a1dddf8a43121889e3ce798241f96d2afed353eaa360405160405180910390a250565b611fec838383611aa0565b612085833361208085600460008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126aa90919063ffffffff16565b611cae565b505050565b61209e81600161294190919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167ff4fbb5a5e62a703643fe5be0722720f728980fdde74f11d76eca7e13bdc3301d60405160405180910390a250565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561216b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180612c7b6022913960400191505060405180910390fd5b8260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6121d6816000612a1c90919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167faf66545c919a3be306ee446d8f42a9558b5b022620df880517bc9593ec0f2d5260405160405180910390a250565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156122bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4241433030313a2073656e6420746f20746865207a65726f206164647265737381525060200191505060405180910390fd5b61231182600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126aa90919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123a682600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eff90919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f76d4fc8756cf1c2b5aa667285d8c20b304dcd86209b4c34a84fc491867de76f184846040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015612480578082015181840152602081019050612465565b50505050905090810190601f1680156124ad5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a350505050565b60006124e28473ffffffffffffffffffffffffffffffffffffffff16612ad9565b6124ef57600190506126a2565b60008473ffffffffffffffffffffffffffffffffffffffff1663c73d16ae878787876040518563ffffffff1660e01b8152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156125ca5780820151818401526020810190506125af565b50505050905090810190601f1680156125f75780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b15801561261957600080fd5b505af115801561262d573d6000803e3d6000fd5b505050506040513d602081101561264357600080fd5b8101908080519060200190929190505050905063c73d16ae60e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149150505b949350505050565b600082821115612722576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060200191505060405180910390fd5b600082840390508091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156127b9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612c5a6021913960400191505060405180910390fd5b6127ce82600554611eff90919063ffffffff16565b60058190555061282682600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eff90919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f76d4fc8756cf1c2b5aa667285d8c20b304dcd86209b4c34a84fc491867de76f184846040518083815260200180602001828103825283818151815260200191508051906020019080838360005b838110156129015780820151818401526020810190506128e6565b50505050905090810190601f16801561292e5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3505050565b61294b82826120e4565b156129be576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f526f6c65733a206163636f756e7420616c72656164792068617320726f6c650081525060200191505060405180910390fd5b60018260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b612a2682826120e4565b612a7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612c396021913960400191505060405180910390fd5b60008260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b600080823b90506000811191505091905056fe4241433030313a20617070726f766520746f20746865207a65726f20616464726573734241433030313a2073656e6420746f206e6f6e20424143303031526563656976657220696d706c656d656e7465724241433030313a20617070726f76652066726f6d20746865207a65726f20616464726573734241433030313a2064657374726f792066726f6d20746865207a65726f2061646472657373746f20616e642076616c756573206172726179206c656e676874206d757374206d617463682e64657374696e6174696f6e2061646472657373206d757374206265206e6f6e2d7a65726f2e497373756572526f6c653a2063616c6c657220646f6573206e6f742068617665207468652049737375657220726f6c6553757370656e646572526f6c653a2063616c6c657220646f6573206e6f742068617665207468652053757370656e64657220726f6c65526f6c65733a206163636f756e7420646f6573206e6f74206861766520726f6c654241433030313a20697373756520746f20746865207a65726f2061646472657373526f6c65733a206163636f756e7420697320746865207a65726f2061646472657373a265627a7a72315820ea68f575a369e3e2a9af93a2051728b3b715eff177ab21281245d33e40d78b5e64736f6c634300051100324241433030313a20697373756520746f20746865207a65726f2061646472657373526f6c65733a206163636f756e7420697320746865207a65726f2061646472657373"
    client = BcosClient()
    assetTransactionRecipient = client.sendRawTransactionGetReceipt(
        "", abi, None, constructArgs, bin, 30000000, 15)
    asset_address = assetTransactionRecipient['contractAddress']
    asset_instance = BAC001(asset_address)
    print(f"deploy: asset_address= {asset_address}")
    # asset_instance.issue(
    #     miner_address,
    #     Web3.toWei(asset_amount, 'ether'), '')
    # print("- Initial balances: ")
    # outputresult = asset_instance.balanceOf(miner_address)
    # print(f"  {miner_address}     : {outputresult}")
    return asset_address
コード例 #6
0
ファイル: Groth16Mixer.py プロジェクト: youwenbusi/zk-client
class Groth16Mixer:  # name of abi
    address = None
    contract_abi_string = '''[{"inputs": [{"internalType": "uint256", "name": "mk_depth", "type": "uint256"}, {"internalType": "address", "name": "token", "type": "address"}, {"internalType": "uint256[2]", "name": "Alpha", "type": "uint256[2]"}, {"internalType": "uint256[2]", "name": "Beta1", "type": "uint256[2]"}, {"internalType": "uint256[2]", "name": "Beta2", "type": "uint256[2]"}, {"internalType": "uint256[2]", "name": "Delta1", "type": "uint256[2]"}, {"internalType": "uint256[2]", "name": "Delta2", "type": "uint256[2]"}, {"internalType": "uint256[]", "name": "ABC_coords", "type": "uint256[]"}], "payable": false, "stateMutability": "nonpayable", "type": "constructor"}, {"anonymous": false, "inputs": [{"indexed": false, "internalType": "string", "name": "message", "type": "string"}], "name": "LogDebug", "type": "event", "topic": "0xd44da6836c8376d1693e8b9cacf1c39b9bed3599164ad6d8e60902515f83938e"}, {"anonymous": false, "inputs": [{"indexed": false, "internalType": "bytes32", "name": "message", "type": "bytes32"}], "name": "LogDebug", "type": "event", "topic": "0x05e46912c9be87d8a6830598db8544b61884d9d22f3921597a9a6e8a340914b3"}, {"anonymous": false, "inputs": [{"indexed": false, "internalType": "uint256", "name": "mid", "type": "uint256"}, {"indexed": false, "internalType": "bytes32", "name": "root", "type": "bytes32"}, {"indexed": false, "internalType": "bytes32[2]", "name": "nullifiers", "type": "bytes32[2]"}, {"indexed": false, "internalType": "bytes32[2]", "name": "commitments", "type": "bytes32[2]"}, {"indexed": false, "internalType": "bytes[2]", "name": "ciphertexts", "type": "bytes[2]"}], "name": "LogMix", "type": "event", "topic": "0x5b20d7b970f991ad433adaa73d15ec55f2dc64ddfecb9505eb1f94e330ecddf7"}, {"constant": true, "inputs": [{"internalType": "uint256[10]", "name": "primary_inputs", "type": "uint256[10]"}], "name": "assemble_hsig", "outputs": [{"internalType": "bytes32", "name": "hsig", "type": "bytes32"}], "payable": false, "stateMutability": "pure", "type": "function"}, {"constant": true, "inputs": [{"internalType": "uint256", "name": "index", "type": "uint256"}, {"internalType": "uint256[10]", "name": "primary_inputs", "type": "uint256[10]"}], "name": "assemble_nullifier", "outputs": [{"internalType": "bytes32", "name": "nf", "type": "bytes32"}], "payable": false, "stateMutability": "pure", "type": "function"}, {"constant": true, "inputs": [{"internalType": "uint256[10]", "name": "primary_inputs", "type": "uint256[10]"}], "name": "assemble_public_values", "outputs": [{"internalType": "uint256", "name": "vpub_in", "type": "uint256"}, {"internalType": "uint256", "name": "vpub_out", "type": "uint256"}], "payable": false, "stateMutability": "pure", "type": "function"}, {"constant": true, "inputs": [], "name": "get_constants", "outputs": [{"internalType": "uint256", "name": "js_in", "type": "uint256"}, {"internalType": "uint256", "name": "js_out", "type": "uint256"}, {"internalType": "uint256", "name": "num_inputs", "type": "uint256"}], "payable": false, "stateMutability": "pure", "type": "function"}, {"constant": false, "inputs": [{"internalType": "bytes32", "name": "commitment", "type": "bytes32"}], "name": "insert", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": true, "inputs": [], "name": "mid", "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": false, "inputs": [{"internalType": "uint256[2]", "name": "a", "type": "uint256[2]"}, {"internalType": "uint256[4]", "name": "b", "type": "uint256[4]"}, {"internalType": "uint256[2]", "name": "c", "type": "uint256[2]"}, {"internalType": "uint256[4]", "name": "vk", "type": "uint256[4]"}, {"internalType": "uint256", "name": "sigma", "type": "uint256"}, {"internalType": "uint256[10]", "name": "input", "type": "uint256[10]"}, {"internalType": "bytes[2]", "name": "ciphertexts", "type": "bytes[2]"}], "name": "mix", "outputs": [], "payable": true, "stateMutability": "payable", "type": "function"}, {"constant": false, "inputs": [{"internalType": "address", "name": "", "type": "address"}, {"internalType": "address", "name": "", "type": "address"}, {"internalType": "uint256", "name": "", "type": "uint256"}, {"internalType": "bytes", "name": "", "type": "bytes"}], "name": "onBAC001Received", "outputs": [{"internalType": "bytes4", "name": "", "type": "bytes4"}], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": true, "inputs": [], "name": "token", "outputs": [{"internalType": "address", "name": "", "type": "address"}], "payable": false, "stateMutability": "view", "type": "function"}]'''
    contract_abi = None
    data_parser = DatatypeParser()
    client = None

    def __init__(self, address):
        self.client = BcosClient()
        self.address = address
        self.contract_abi = json.loads(self.contract_abi_string)
        self.data_parser.set_abi(self.contract_abi)

    def deploy(self, contract_bin_file):
        result = self.client.deployFromFile(contract_bin_file)
        self.address = result["contractAddress"]
        return result

    # ------------------------------------------
    def assemble_hsig(self, primary_inputs):
        func_name = 'assemble_hsig'
        args = [primary_inputs]
        result = self.client.call(self.address, self.contract_abi, func_name,
                                  args)
        return result

    # ------------------------------------------
    def assemble_nullifier(self, index, primary_inputs):
        func_name = 'assemble_nullifier'
        args = [index, primary_inputs]
        result = self.client.call(self.address, self.contract_abi, func_name,
                                  args)
        return result

    # ------------------------------------------
    def assemble_public_values(self, primary_inputs):
        func_name = 'assemble_public_values'
        args = [primary_inputs]
        result = self.client.call(self.address, self.contract_abi, func_name,
                                  args)
        return result

    # ------------------------------------------
    def get_constants(self):
        func_name = 'get_constants'
        args = []
        result = self.client.call(self.address, self.contract_abi, func_name,
                                  args)
        return result

    # ------------------------------------------
    def insert(self, commitment):
        func_name = 'insert'
        args = [commitment]
        receipt = self.client.sendRawTransactionGetReceipt(
            self.address, self.contract_abi, func_name, args)
        outputresult = self.data_parser.parse_receipt_output(
            func_name, receipt['output'])
        return outputresult, receipt

    # ------------------------------------------
    def mid(self):
        func_name = 'mid'
        args = []
        result = self.client.call(self.address, self.contract_abi, func_name,
                                  args)
        return result

    # ------------------------------------------
    def mix(self, a, b, c, vk, sigma, input, ciphertexts):
        func_name = 'mix'
        args = [a, b, c, vk, sigma, input, ciphertexts]
        receipt = self.client.sendRawTransactionGetReceipt(
            self.address, self.contract_abi, func_name, args)
        outputresult = self.data_parser.parse_receipt_output(
            func_name, receipt['output'])
        return outputresult, receipt

    # ------------------------------------------
    def token(self):
        func_name = 'token'
        args = []
        result = self.client.call(self.address, self.contract_abi, func_name,
                                  args)
        return result
コード例 #7
0
ファイル: zeth_deploy.py プロジェクト: youwenbusi/zk-client
def deploy(token_address: Optional[str]):
    """
    Deploy the zeth contracts and record the instantiation details.
    """
    zksnark = get_zksnark_provider("GROTH16")
    prover_client = ProverClient(PROVER_SERVER_ENDPOINT_DEFAULT)
    vk_obj = prover_client.get_verification_key()
    vk_json = zksnark.parse_verification_key(vk_obj)
    #print("VK.json: ", vk_json)

    print("Received VK, writing verification key...")
    write_verification_key(vk_json)
    verification_key_params = zksnark.verification_key_parameters(vk_json)
    constructArgs = [
        5,
        to_checksum_address(token_address), verification_key_params['Alpha'],
        verification_key_params['Beta1'], verification_key_params['Beta2'],
        verification_key_params['Delta1'], verification_key_params['Delta2'],
        verification_key_params['ABC_coords']
    ]

    si = Groth16Mixer("")
    '''
    fo = open("./contract/mixer/abi/Groth16Mixer.abi")
    abistring = fo.read()
    abi = json.loads(abistring)
    fo.close()
    f1 = open("./contract/mixer/abi/Groth16Mixer.bin")
    bin = f1.read()
    f1.close()
    '''

    abi = [{
        'inputs': [{
            'internalType': 'uint256',
            'name': 'mk_depth',
            'type': 'uint256'
        }, {
            'internalType': 'address',
            'name': 'token',
            'type': 'address'
        }, {
            'internalType': 'uint256[2]',
            'name': 'Alpha',
            'type': 'uint256[2]'
        }, {
            'internalType': 'uint256[2]',
            'name': 'Beta1',
            'type': 'uint256[2]'
        }, {
            'internalType': 'uint256[2]',
            'name': 'Beta2',
            'type': 'uint256[2]'
        }, {
            'internalType': 'uint256[2]',
            'name': 'Delta1',
            'type': 'uint256[2]'
        }, {
            'internalType': 'uint256[2]',
            'name': 'Delta2',
            'type': 'uint256[2]'
        }, {
            'internalType': 'uint256[]',
            'name': 'ABC_coords',
            'type': 'uint256[]'
        }],
        'payable':
        False,
        'stateMutability':
        'nonpayable',
        'type':
        'constructor'
    }, {
        'anonymous':
        False,
        'inputs': [{
            'indexed': False,
            'internalType': 'string',
            'name': 'message',
            'type': 'string'
        }],
        'name':
        'LogDebug',
        'type':
        'event'
    }, {
        'anonymous':
        False,
        'inputs': [{
            'indexed': False,
            'internalType': 'bytes32',
            'name': 'message',
            'type': 'bytes32'
        }],
        'name':
        'LogDebug',
        'type':
        'event'
    }, {
        'anonymous':
        False,
        'inputs': [{
            'indexed': False,
            'internalType': 'uint256',
            'name': 'mid',
            'type': 'uint256'
        }, {
            'indexed': False,
            'internalType': 'bytes32',
            'name': 'root',
            'type': 'bytes32'
        }, {
            'indexed': False,
            'internalType': 'bytes32[2]',
            'name': 'nullifiers',
            'type': 'bytes32[2]'
        }, {
            'indexed': False,
            'internalType': 'bytes32[2]',
            'name': 'commitments',
            'type': 'bytes32[2]'
        }, {
            'indexed': False,
            'internalType': 'bytes[2]',
            'name': 'ciphertexts',
            'type': 'bytes[2]'
        }],
        'name':
        'LogMix',
        'type':
        'event'
    }, {
        'constant':
        True,
        'inputs': [{
            'internalType': 'uint256[10]',
            'name': 'primary_inputs',
            'type': 'uint256[10]'
        }],
        'name':
        'assemble_hsig',
        'outputs': [{
            'internalType': 'bytes32',
            'name': 'hsig',
            'type': 'bytes32'
        }],
        'payable':
        False,
        'stateMutability':
        'pure',
        'type':
        'function'
    }, {
        'constant':
        True,
        'inputs': [{
            'internalType': 'uint256',
            'name': 'index',
            'type': 'uint256'
        }, {
            'internalType': 'uint256[10]',
            'name': 'primary_inputs',
            'type': 'uint256[10]'
        }],
        'name':
        'assemble_nullifier',
        'outputs': [{
            'internalType': 'bytes32',
            'name': 'nf',
            'type': 'bytes32'
        }],
        'payable':
        False,
        'stateMutability':
        'pure',
        'type':
        'function'
    }, {
        'constant':
        True,
        'inputs': [{
            'internalType': 'uint256[10]',
            'name': 'primary_inputs',
            'type': 'uint256[10]'
        }],
        'name':
        'assemble_public_values',
        'outputs': [{
            'internalType': 'uint256',
            'name': 'vpub_in',
            'type': 'uint256'
        }, {
            'internalType': 'uint256',
            'name': 'vpub_out',
            'type': 'uint256'
        }],
        'payable':
        False,
        'stateMutability':
        'pure',
        'type':
        'function'
    }, {
        'constant':
        True,
        'inputs': [],
        'name':
        'get_constants',
        'outputs': [{
            'internalType': 'uint256',
            'name': 'js_in',
            'type': 'uint256'
        }, {
            'internalType': 'uint256',
            'name': 'js_out',
            'type': 'uint256'
        }, {
            'internalType': 'uint256',
            'name': 'num_inputs',
            'type': 'uint256'
        }],
        'payable':
        False,
        'stateMutability':
        'pure',
        'type':
        'function'
    }, {
        'constant':
        False,
        'inputs': [{
            'internalType': 'bytes32',
            'name': 'commitment',
            'type': 'bytes32'
        }],
        'name':
        'insert',
        'outputs': [],
        'payable':
        False,
        'stateMutability':
        'nonpayable',
        'type':
        'function'
    }, {
        'constant':
        True,
        'inputs': [],
        'name':
        'mid',
        'outputs': [{
            'internalType': 'uint256',
            'name': '',
            'type': 'uint256'
        }],
        'payable':
        False,
        'stateMutability':
        'view',
        'type':
        'function'
    }, {
        'constant':
        False,
        'inputs': [{
            'internalType': 'uint256[2]',
            'name': 'a',
            'type': 'uint256[2]'
        }, {
            'internalType': 'uint256[4]',
            'name': 'b',
            'type': 'uint256[4]'
        }, {
            'internalType': 'uint256[2]',
            'name': 'c',
            'type': 'uint256[2]'
        }, {
            'internalType': 'uint256[4]',
            'name': 'vk',
            'type': 'uint256[4]'
        }, {
            'internalType': 'uint256',
            'name': 'sigma',
            'type': 'uint256'
        }, {
            'internalType': 'uint256[10]',
            'name': 'input',
            'type': 'uint256[10]'
        }, {
            'internalType': 'bytes[2]',
            'name': 'ciphertexts',
            'type': 'bytes[2]'
        }],
        'name':
        'mix',
        'outputs': [],
        'payable':
        True,
        'stateMutability':
        'payable',
        'type':
        'function'
    }, {
        'constant':
        False,
        'inputs': [{
            'internalType': 'address',
            'name': '',
            'type': 'address'
        }, {
            'internalType': 'address',
            'name': '',
            'type': 'address'
        }, {
            'internalType': 'uint256',
            'name': '',
            'type': 'uint256'
        }, {
            'internalType': 'bytes',
            'name': '',
            'type': 'bytes'
        }],
        'name':
        'onBAC001Received',
        'outputs': [{
            'internalType': 'bytes4',
            'name': '',
            'type': 'bytes4'
        }],
        'payable':
        False,
        'stateMutability':
        'nonpayable',
        'type':
        'function'
    }, {
        'constant':
        True,
        'inputs': [],
        'name':
        'token',
        'outputs': [{
            'internalType': 'address',
            'name': '',
            'type': 'address'
        }],
        'payable':
        False,
        'stateMutability':
        'view',
        'type':
        'function'
    }]

    binstr = "6080604052600080553480156200001557600080fd5b506040516200393b3803806200393b83398181016040526200003b9190810190620006cf565b878781806005811462000085576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200007c9062000904565b60405180910390fd5b50620000966200042960201b60201c565b506000600160008081526020019081526020016000206000603f8110620000b957fe5b01549050600160036000808152602001908152602001600020600083815260200190815260200160002060006101000a81548160ff02191690831515021790555081600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061010060fd1062000183576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200017a90620008c0565b60405180910390fd5b60fd6002800260010160fd610100030260406002020110620001dc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620001d390620008e2565b60405180910390fd5b505050604051806040016040528087600060028110620001f857fe5b60200201518152602001876001600281106200021057fe5b6020020151815250600660000160008201518160000155602082015181600101559050506040518060800160405280866000600281106200024d57fe5b60200201518152602001866001600281106200026557fe5b60200201518152602001856000600281106200027d57fe5b60200201518152602001856001600281106200029557fe5b6020020151815250600660020160008201518160000155602082015181600101556040820151816002015560608201518160030155905050604051806080016040528084600060028110620002e657fe5b6020020151815260200184600160028110620002fe57fe5b60200201518152602001836000600281106200031657fe5b60200201518152602001836001600281106200032e57fe5b6020020151815250600680016000820151816000015560208201518160010155604082015181600201556060820151816003015590505060008090505b60028251816200037757fe5b046006600a0180549050146200041a576006600a016040518060400160405280848481518110620003a457fe5b60200260200101518152602001846001850181518110620003c157fe5b60200260200101518152509080600181540180825580915050906001820390600052602060002090600202016000909192909190915060008201518160000155602082015181600101555050506002810190506200036b565b50505050505050505062000a23565b60008060001b90508060016000805481526020019081526020016000206002600560020a60020203603f81106200045c57fe5b018190555060006002600560020a816200047257fe5b0490505b6000811115620004df57620004978283620004e360201b620011e91760201c565b9150600060028260020203905082600160008054815260200190815260200160002082603f8110620004c557fe5b018190555060028281620004d557fe5b0491505062000476565b5050565b60007fdec937b7fa8db3de380427a8cc947bfab68514522c3439cfa2e99655098368146000527f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000018284828282088381820984858383098683840909925060005b605a8112156200057e57602060002080600052868688838808089350868485099250868488858a878809090994505060018101905062000543565b508484868a8888880808089550505050505092915050565b600081519050620005a781620009ef565b92915050565b600082601f830112620005bf57600080fd5b6002620005d6620005d08262000954565b62000926565b91508183856020840282011115620005ed57600080fd5b60005b83811015620006215781620006068882620006b8565b845260208401935060208301925050600181019050620005f0565b5050505092915050565b600082601f8301126200063d57600080fd5b8151620006546200064e8262000977565b62000926565b915081818352602084019350602081019050838560208402820111156200067a57600080fd5b60005b83811015620006ae5781620006938882620006b8565b8452602084019350602083019250506001810190506200067d565b5050505092915050565b600081519050620006c98162000a09565b92915050565b6000806000806000806000806101a0898b031215620006ed57600080fd5b6000620006fd8b828c01620006b8565b9850506020620007108b828c0162000596565b9750506040620007238b828c01620005ad565b9650506080620007368b828c01620005ad565b95505060c0620007498b828c01620005ad565b9450506101006200075d8b828c01620005ad565b935050610140620007718b828c01620005ad565b92505061018089015167ffffffffffffffff8111156200079057600080fd5b6200079e8b828c016200062b565b9150509295985092959890939650565b6000620007bd602d83620009a0565b91507f41206861736820646967657374206669747320696e20612073696e676c65206660008301527f69656c6420656c656d656e742e000000000000000000000000000000000000006020830152604082019050919050565b600062000825602b83620009a0565b91507f546f6f206d616e7920696e70757420616e64206f7574707574206e6f7465732060008301527f636f6e736964657265642e0000000000000000000000000000000000000000006020830152604082019050919050565b60006200088d601f83620009a0565b91507f496e76616c696420646570746820696e20426173654d65726b6c6554726565006000830152602082019050919050565b60006020820190508181036000830152620008db81620007ae565b9050919050565b60006020820190508181036000830152620008fd8162000816565b9050919050565b600060208201905081810360008301526200091f816200087e565b9050919050565b6000604051905081810181811067ffffffffffffffff821117156200094a57600080fd5b8060405250919050565b600067ffffffffffffffff8211156200096c57600080fd5b602082029050919050565b600067ffffffffffffffff8211156200098f57600080fd5b602082029050602081019050919050565b600082825260208201905092915050565b6000620009be82620009c5565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b620009fa81620009b1565b811462000a0657600080fd5b50565b62000a1481620009e5565b811462000a2057600080fd5b50565b612f088062000a336000396000f3fe6080604052600436106100865760003560e01c80634773862d116100595780634773862d1461015a578063a52f1ea814610176578063c73d16ae146101b3578063f9eb943f146101f0578063fc0c546a1461021d57610086565b80632d287e431461008b5780632e94420f146100b45780633e49ba65146100df57806346deb3411461011d575b600080fd5b34801561009757600080fd5b506100b260048036036100ad9190810190611cd7565b610248565b005b3480156100c057600080fd5b506100c9610318565b6040516100d69190612a59565b60405180910390f35b3480156100eb57600080fd5b5061010660048036036101019190810190611bf2565b61031e565b604051610114929190612ace565b60405180910390f35b34801561012957600080fd5b50610144600480360361013f9190810190611bf2565b61039a565b6040516101519190612843565b60405180910390f35b610174600480360361016f9190810190611c1c565b610417565b005b34801561018257600080fd5b5061019d60048036036101989190810190611d29565b61063d565b6040516101aa9190612843565b60405180910390f35b3480156101bf57600080fd5b506101da60048036036101d59190810190611b77565b61075b565b6040516101e7919061285e565b60405180910390f35b3480156101fc57600080fd5b5061020561076f565b60405161021493929190612af7565b60405180910390f35b34801561022957600080fd5b50610232610792565b60405161023f91906127a2565b60405180910390f35b600560020a600254141561028157600160005401600081905550600560020a6002548161027157fe5b066002819055506102806107b8565b5b600560020a600254106102c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102c0906128f9565b60405180910390fd5b60006002549050600260008154600101919050819055506000816001600560020a0301905082600160008054815260200190815260200160002082603f811061030e57fe5b0181905550505050565b60005481565b600080600083600280026001016002800101600a811061033a57fe5b602002015190506002800260010160fd610100030281901c905064e8d4a5100067ffffffffffffffff168167ffffffffffffffff1602915064e8d4a5100067ffffffffffffffff16604082901c67ffffffffffffffff1602925050915091565b60008060fd60406002026002800260010160fd6101000302604060020201610100030184600280026001016002800101600a81106103d457fe5b602002015160001b901b901c9050600060fd610100038460028060020101600a81106103fc57fe5b6020020151901b90508160001c810160001b92505050919050565b61041f61180e565b61042a85848361085f565b600060023373ffffffffffffffffffffffffffffffffffffffff168460006002811061045257fe5b60200201518560016002811061046457fe5b60200201518c8c8c8a6040516020016104839796959493929190612728565b60405160208183030381529060405260405161049f91906126fc565b602060405180830381855afa1580156104bc573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052506104df9190810190611d00565b9050610533866000600481106104f157fe5b60200201518760016004811061050357fe5b60200201518860026004811061051557fe5b60200201518960036004811061052757fe5b60200201518986610a41565b610572576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610569906129f9565b60405180910390fd5b61057e89898987610b18565b6105bd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105b490612999565b60405180910390fd5b6105c561180e565b6105cf8582610d1f565b60006105db6002610d7b565b90506105e681610df0565b7f5b20d7b970f991ad433adaa73d15ec55f2dc64ddfecb9505eb1f94e330ecddf76000548286858960405161061f959493929190612a74565b60405180910390a161063086610e31565b5050505050505050505050565b600060028310610682576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067990612879565b60405180910390fd5b600060fd610100038460010102604060020201905060fd61010003810160fd10156106e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d990612919565b60405180910390fd5b600060fd826002800260010160fd6101000302604060020201610100030185600280026001016002800101600a811061071757fe5b602002015160001b901b901c9050600060fd6101000385876002800101600a811061073e57fe5b6020020151901b90508160001c810160001b935050505092915050565b600063c73d16ae60e01b9050949350505050565b600080600060029250600291506001600280026001016002800101019050909192565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060001b90508060016000805481526020019081526020016000206002600560020a60020203603f81106107ea57fe5b018190555060006002600560020a816107ff57fe5b0490505b600081111561085b5761081682836111e9565b9150600060028260020203905082600160008054815260200190815260200160002082603f811061084357fe5b01819055506002828161085257fe5b04915050610803565b5050565b6108688261129a565b6108a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161089e90612939565b60405180910390fd5b60008090505b60028110156109755760006108c2828561063d565b90506004600082815260200190815260200160002060009054906101000a900460ff1615610925576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091c90612899565b60405180910390fd5b60016004600083815260200190815260200160002060006101000a81548160ff0219169083151502179055508083836002811061095e57fe5b6020020181815250505080806001019150506108ad565b5060006002828560405160200161098d9291906126d0565b6040516020818303038152906040526040516109a991906126fc565b602060405180830381855afa1580156109c6573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052506109e99190810190611d00565b905060006109f68461039a565b9050808214610a3a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3190612959565b60405180910390fd5b5050505050565b6000610a4b611830565b6107d05a038682528560208301528360408301526020608083016060846000600286f150604082018981528860208201526040816060836000600787f1506040836080856000600687f15060016040840152600260608401528560808401526040816060836000600787f150505080600260058110610ac657fe5b602002015181600060058110610ad857fe5b6020020151148015610b0b575080600360058110610af257fe5b602002015181600160058110610b0457fe5b6020020151145b9150509695505050505050565b6000807f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000019050610b46611852565b86600060028110610b5357fe5b602002015181600001818152505086600160028110610b6e57fe5b602002015181602001818152505085600060048110610b8957fe5b602002015181604001818152505085600160048110610ba457fe5b602002015181606001818152505085600260048110610bbf57fe5b602002015181608001818152505085600360048110610bda57fe5b60200201518160a001818152505084600060028110610bf557fe5b60200201518160c001818152505084600160028110610c1057fe5b60200201518160e00181815250506060600160028002600101600280010101604051908082528060200260200182016040528015610c5d5781602001602082028038833980820191505090505b50905060008090505b600160028002600101600280010101811015610d0457838682600a8110610c8957fe5b602002015110610cce576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cc5906129d9565b60405180910390fd5b8581600a8110610cda57fe5b6020020151828281518110610ceb57fe5b6020026020010181815250508080600101915050610c66565b50610d0f8183611385565b6001149350505050949350505050565b60008090505b6002811015610d765760008382600201600a8110610d3f57fe5b602002015160001b905080838360028110610d5657fe5b602002018181525050610d6881610248565b508080600101915050610d25565b505050565b60008060025490506000836002540390506000600560020a90505b6001811115610dc457610daa8183856116a1565b809450819350505060028181610dbc57fe5b049050610d96565b60016000805481526020019081526020016000206000603f8110610de457fe5b01549350505050919050565b60016003600080548152602001908152602001600020600083815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600080610e3d8361031e565b915091506000821115610f8457600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f3c576000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663d0e7d6113330866040518463ffffffff1660e01b8152600401610f04939291906127bd565b600060405180830381600087803b158015610f1e57600080fd5b505af1158015610f32573d6000803e3d6000fd5b5050505050610f7f565b813414610f7e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f75906129b9565b60405180910390fd5b5b61103c565b600034111561103b5760003373ffffffffffffffffffffffffffffffffffffffff1634604051610fb390612713565b60006040518083038185875af1925050503d8060008114610ff0576040519150601f19603f3d011682016040523d82523d6000602084013e610ff5565b606091505b5050905080611039576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611030906128b9565b60405180910390fd5b505b5b60008111156111e457600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611135576000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff16639bd9bbc633846040518363ffffffff1660e01b81526004016110fd929190612807565b600060405180830381600087803b15801561111757600080fd5b505af115801561112b573d6000803e3d6000fd5b50505050506111e3565b60003373ffffffffffffffffffffffffffffffffffffffff168260405161115b90612713565b60006040518083038185875af1925050503d8060008114611198576040519150601f19603f3d011682016040523d82523d6000602084013e61119d565b606091505b50509050806111e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d8906128d9565b60405180910390fd5b505b5b505050565b60007fdec937b7fa8db3de380427a8cc947bfab68514522c3439cfa2e99655098368146000527f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000018284828282088381820984858383098683840909925060005b605a81121561128257602060002080600052868688838808089350868485099250868488858a8788090909945050600181019050611249565b508484868a8888880808089550505050505092915050565b6000806000905060008090505b600054811161137957600360008281526020019081526020016000206000856000600a81106112d257fe5b602002015160001b815260200190815260200160002060009054906101000a900460ff16156113045781806001019250505b600360008281526020019081526020016000206000856001600a811061132657fe5b602002015160001b815260200190815260200160002060009054906101000a900460ff16156113585781806001019250505b600282141561136c57600192505050611380565b80806001019150506112a7565b5060009150505b919050565b60006006600a01805490506001845101146113d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113cc90612979565b60405180910390fd5b6113dd611897565b6000600190506107d05a03600a60060183526020832060208701875160200281018254865260018301546020870152600283019250604086015b8183101561146657835481526001840154602082015282516040820152604081606083600060078af160408860808a600060068bf1808216881697505050600284019350602083019250611417565b5050505050806114ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114a290612a39565b60405180910390fd5b7f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c260408301527f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed60608301527f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b60808301527f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa60a083015260065460c083015260016006015460e083015260026006015461010083015260036006015461012083015260046006015461014083015260056006015461016083015283516101808301527f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47602085015181810682036101a085015260408601516101c085015260608601516101e0850152608086015161020085015260a086015161022085015260c086015161024085015260e086015161026085015260068001546102808501526007600601546102a08501526008600601546102c08501526009600601546102e085015260208461030086600060086107d05a03f19250505080611685576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161167c90612a19565b60405180910390fd5b8160006018811061169257fe5b60200201519250505092915050565b60008060006001860390506000600119861682019050600080600187161461174e576001868401039050611718600160008054815260200190815260200160002082603f81106116ed57fe5b0154600160008054815260200190815260200160002085600202603f811061171157fe5b01546111e9565b60016000805481526020019081526020016000206002600184038161173957fe5b04603f811061174457fe5b0181905550611754565b85830190505b5b818111156117e6576002810390506117b0600160008054815260200190815260200160002082603f811061178557fe5b0154600160008054815260200190815260200160002060018401603f81106117a957fe5b01546111e9565b6001600080548152602001908152602001600020600260018403816117d157fe5b04603f81106117dc57fe5b0181905550611755565b600287816117f057fe5b04600260018801816117fe57fe5b0494509450505050935093915050565b6040518060400160405280600290602082028038833980820191505090505090565b6040518060a00160405280600590602082028038833980820191505090505090565b60405180610100016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b604051806103000160405280601890602082028038833980820191505090505090565b6000813590506118c981612e80565b92915050565b600082601f8301126118e057600080fd5b60026118f36118ee82612b5b565b612b2e565b9150818360005b8381101561192a57813586016119108882611aba565b8452602084019350602083019250506001810190506118fa565b5050505092915050565b600082601f83011261194557600080fd5b600a61195861195382612b7d565b612b2e565b9150818385602084028201111561196e57600080fd5b60005b8381101561199e57816119848882611b62565b845260208401935060208301925050600181019050611971565b5050505092915050565b600082601f8301126119b957600080fd5b60026119cc6119c782612b9f565b612b2e565b915081838560208402820111156119e257600080fd5b60005b83811015611a1257816119f88882611b62565b8452602084019350602083019250506001810190506119e5565b5050505092915050565b600082601f830112611a2d57600080fd5b6004611a40611a3b82612bc1565b612b2e565b91508183856020840282011115611a5657600080fd5b60005b83811015611a865781611a6c8882611b62565b845260208401935060208301925050600181019050611a59565b5050505092915050565b600081359050611a9f81612e97565b92915050565b600081519050611ab481612e97565b92915050565b600082601f830112611acb57600080fd5b8135611ade611ad982612be3565b612b2e565b91508082526020830160208301858383011115611afa57600080fd5b611b05838284612e23565b50505092915050565b600082601f830112611b1f57600080fd5b8135611b32611b2d82612c0f565b612b2e565b91508082526020830160208301858383011115611b4e57600080fd5b611b59838284612e23565b50505092915050565b600081359050611b7181612eae565b92915050565b60008060008060808587031215611b8d57600080fd5b6000611b9b878288016118ba565b9450506020611bac878288016118ba565b9350506040611bbd87828801611b62565b925050606085013567ffffffffffffffff811115611bda57600080fd5b611be687828801611b0e565b91505092959194509250565b60006101408284031215611c0557600080fd5b6000611c1384828501611934565b91505092915050565b6000806000806000806000610300888a031215611c3857600080fd5b6000611c468a828b016119a8565b9750506040611c578a828b01611a1c565b96505060c0611c688a828b016119a8565b955050610100611c7a8a828b01611a1c565b945050610180611c8c8a828b01611b62565b9350506101a0611c9e8a828b01611934565b9250506102e088013567ffffffffffffffff811115611cbc57600080fd5b611cc88a828b016118cf565b91505092959891949750929550565b600060208284031215611ce957600080fd5b6000611cf784828501611a90565b91505092915050565b600060208284031215611d1257600080fd5b6000611d2084828501611aa5565b91505092915050565b6000806101608385031215611d3d57600080fd5b6000611d4b85828601611b62565b9250506020611d5c85828601611934565b9150509250929050565b6000611d728383612008565b60208301905092915050565b6000611d8a8383612026565b60208301905092915050565b6000611da28383612075565b905092915050565b6000611db683836126aa565b60208301905092915050565b611dcb81612ded565b82525050565b611dda81612d7b565b82525050565b611de981612c6d565b611df38184612cfb565b9250611dfe82612c3b565b8060005b83811015611e2f578151611e168782611d66565b9650611e2183612cba565b925050600181019050611e02565b505050505050565b611e4081612c6d565b611e4a8184612d06565b9250611e5582612c3b565b8060005b83811015611e86578151611e6d8782611d7e565b9650611e7883612cba565b925050600181019050611e59565b505050505050565b6000611e9982612c78565b611ea38185612d11565b935083602082028501611eb585612c45565b8060005b85811015611ef15784840389528151611ed28582611d96565b9450611edd83612cc7565b925060208a01995050600181019050611eb9565b50829750879550505050505092915050565b611f0c81612c83565b611f168184612d1c565b9250611f2182612c4f565b8060005b83811015611f52578151611f398782611daa565b9650611f4483612cd4565b925050600181019050611f25565b505050505050565b611f6381612c8e565b611f6d8184612d27565b9250611f7882612c59565b8060005b83811015611fa9578151611f908782611daa565b9650611f9b83612ce1565b925050600181019050611f7c565b505050505050565b611fba81612c99565b611fc48184612d32565b9250611fcf82612c63565b8060005b83811015612000578151611fe78782611daa565b9650611ff283612cee565b925050600181019050611fd3565b505050505050565b61201181612d8d565b82525050565b61202081612d8d565b82525050565b61202f81612d8d565b82525050565b61203e81612d97565b82525050565b600061204f82612caf565b6120598185612d5f565b9350612069818560208601612e32565b80840191505092915050565b600061208082612ca4565b61208a8185612d3d565b935061209a818560208601612e32565b6120a381612e6f565b840191505092915050565b60006120b982612ca4565b6120c38185612d5f565b93506120d3818560208601612e32565b80840191505092915050565b60006120ec601883612d6a565b91507f6e756c6c696669657220696e646578206f766572666c6f7700000000000000006000830152602082019050919050565b600061212c603783612d6a565b91507f496e76616c6964206e756c6c69666965723a2054686973206e756c6c6966696560008301527f722068617320616c7265616479206265656e20757365640000000000000000006020830152604082019050919050565b6000612192601e83612d6a565b91507f767075625f696e2072657475726e207472616e73666572206661696c656400006000830152602082019050919050565b60006121d2601883612d6a565b91507f767075625f6f7574207472616e73666572206661696c656400000000000000006000830152602082019050919050565b6000612212602783612d6a565b91507f4d65726b6c6520747265652066756c6c3a2043616e6e6f7420617070656e642060008301527f616e796d6f7265000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000612278603083612d6a565b91507f6e756c6c6966696572207772697474656e20696e20646966666572656e74207260008301527f6573696475616c2062697420662e652e000000000000000000000000000000006020830152604082019050919050565b60006122de602583612d6a565b91507f496e76616c696420726f6f743a205468697320726f6f7420646f65736e27742060008301527f65786973740000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000612344604983612d6a565b91507f496e76616c696420687369673a2054686973206873696720646f6573206e6f7460008301527f20636f72726573706f6e6420746f207468652068617368206f6620766b20616e60208301527f6420746865206e667300000000000000000000000000000000000000000000006040830152606082019050919050565b60006123d0602283612d6a565b91507f496e707574206c656e67746820646966666572732066726f6d2065787065637460008301527f65640000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000612436603383612d6a565b91507f496e76616c69642070726f6f663a20556e61626c6520746f207665726966792060008301527f7468652070726f6f6620636f72726563746c79000000000000000000000000006020830152604082019050919050565b600061249c602a83612d6a565b91507f57726f6e67206d73672e76616c75653a2056616c75652070616964206973206e60008301527f6f7420636f7272656374000000000000000000000000000000000000000000006020830152604082019050919050565b6000612502601c83612d6a565b91507f496e707574206973206e6f7420696e207363616c6172206669656c64000000006000830152602082019050919050565b6000612542603b83612d6a565b91507f496e76616c6964207369676e61747572653a20556e61626c6520746f2076657260008301527f69667920746865207369676e617475726520636f72726563746c7900000000006020830152604082019050919050565b60006125a8600083612d4e565b9150600082019050919050565b60006125c2600083612d5f565b9150600082019050919050565b60006125dc603783612d6a565b91507f43616c6c20746f20626e3235364164642c20626e3235365363616c61724d756c60008301527f206f7220626e32353650616972696e67206661696c65640000000000000000006020830152604082019050919050565b6000612642603983612d6a565b91507f43616c6c20746f2074686520626e323536416464206f7220626e32353653636160008301527f6c61724d756c20707265636f6d70696c6564206661696c6564000000000000006020830152604082019050919050565b6126a481612de3565b82525050565b6126b381612de3565b82525050565b6126ca6126c582612de3565b612e65565b82525050565b60006126dc8285611e37565b6040820191506126ec8284611fb1565b6080820191508190509392505050565b60006127088284612044565b915081905092915050565b600061271e826125b5565b9150819050919050565b6000612734828a6126b9565b60208201915061274482896120ae565b915061275082886120ae565b915061275c8287611f5a565b60408201915061276c8286611fb1565b60808201915061277c8285611f5a565b60408201915061278c8284611f03565b6101408201915081905098975050505050505050565b60006020820190506127b76000830184611dd1565b92915050565b60006080820190506127d26000830186611dc2565b6127df6020830185611dd1565b6127ec604083018461269b565b81810360608301526127fd8161259b565b9050949350505050565b600060608201905061281c6000830185611dc2565b612829602083018461269b565b818103604083015261283a8161259b565b90509392505050565b60006020820190506128586000830184612017565b92915050565b60006020820190506128736000830184612035565b92915050565b60006020820190508181036000830152612892816120df565b9050919050565b600060208201905081810360008301526128b28161211f565b9050919050565b600060208201905081810360008301526128d281612185565b9050919050565b600060208201905081810360008301526128f2816121c5565b9050919050565b6000602082019050818103600083015261291281612205565b9050919050565b600060208201905081810360008301526129328161226b565b9050919050565b60006020820190508181036000830152612952816122d1565b9050919050565b6000602082019050818103600083015261297281612337565b9050919050565b60006020820190508181036000830152612992816123c3565b9050919050565b600060208201905081810360008301526129b281612429565b9050919050565b600060208201905081810360008301526129d28161248f565b9050919050565b600060208201905081810360008301526129f2816124f5565b9050919050565b60006020820190508181036000830152612a1281612535565b9050919050565b60006020820190508181036000830152612a32816125cf565b9050919050565b60006020820190508181036000830152612a5281612635565b9050919050565b6000602082019050612a6e600083018461269b565b92915050565b600060e082019050612a89600083018861269b565b612a966020830187612017565b612aa36040830186611de0565b612ab06080830185611de0565b81810360c0830152612ac28184611e8e565b90509695505050505050565b6000604082019050612ae3600083018561269b565b612af0602083018461269b565b9392505050565b6000606082019050612b0c600083018661269b565b612b19602083018561269b565b612b26604083018461269b565b949350505050565b6000604051905081810181811067ffffffffffffffff82111715612b5157600080fd5b8060405250919050565b600067ffffffffffffffff821115612b7257600080fd5b602082029050919050565b600067ffffffffffffffff821115612b9457600080fd5b602082029050919050565b600067ffffffffffffffff821115612bb657600080fd5b602082029050919050565b600067ffffffffffffffff821115612bd857600080fd5b602082029050919050565b600067ffffffffffffffff821115612bfa57600080fd5b601f19601f8301169050602081019050919050565b600067ffffffffffffffff821115612c2657600080fd5b601f19601f8301169050602081019050919050565b6000819050919050565b6000819050919050565b6000819050919050565b6000819050919050565b6000819050919050565b600060029050919050565b600060029050919050565b6000600a9050919050565b600060029050919050565b600060049050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b600081905092915050565b600081905092915050565b600081905092915050565b600081905092915050565b600081905092915050565b600081905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b6000612d8682612dc3565b9050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000612df882612dff565b9050919050565b6000612e0a82612e11565b9050919050565b6000612e1c82612dc3565b9050919050565b82818337600083830152505050565b60005b83811015612e50578082015181840152602081019050612e35565b83811115612e5f576000848401525b50505050565b6000819050919050565b6000601f19601f8301169050919050565b612e8981612d7b565b8114612e9457600080fd5b50565b612ea081612d8d565b8114612eab57600080fd5b50565b612eb781612de3565b8114612ec257600080fd5b5056fea365627a7a72315820f62d867b7f806cc547daab622cb427ec98c2222a4a755612cb1dc066faf41a526c6578706572696d656e74616cf564736f6c63430005110040"

    # with open("./contract/mixer/abi/Groth16Mixer.abi", "r") as abistring:
    #     abistr = abistring.readlines()[0]
    #     abi = ast.literal_eval(abistr)
    # with open("./contract/mixer/abi/Groth16Mixer.bin", "r") as binstring:
    #     binstr = binstring.readlines()[0]

    client = BcosClient()
    mixerTransactionRecipient = client.sendRawTransactionGetReceipt(
        "", abi, None, constructArgs, binstr)
    mixer_address = mixerTransactionRecipient['contractAddress']
    print(f"deploy: mixer_address={mixer_address}")
    #mixer_instance = Groth16Mixer(address)
    return mixer_address
コード例 #8
0
ファイル: BAC001.py プロジェクト: youwenbusi/zk-client
class BAC001:  # name of abi
    address = None
    contract_abi_string = '''[{"inputs": [{"internalType": "string", "name": "description", "type": "string"}, {"internalType": "string", "name": "shortName", "type": "string"}, {"internalType": "uint8", "name": "minUnit", "type": "uint8"}, {"internalType": "uint256", "name": "totalAmount", "type": "uint256"}], "payable": false, "stateMutability": "nonpayable", "type": "constructor"}, {"anonymous": false, "inputs": [{"indexed": true, "internalType": "address", "name": "owner", "type": "address"}, {"indexed": true, "internalType": "address", "name": "spender", "type": "address"}, {"indexed": false, "internalType": "uint256", "name": "value", "type": "uint256"}], "name": "Approval", "type": "event", "topic": "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925"}, {"anonymous": false, "inputs": [{"indexed": true, "internalType": "address", "name": "account", "type": "address"}], "name": "IssuerAdded", "type": "event", "topic": "0x05e7c881d716bee8cb7ed92293133ba156704252439e5c502c277448f04e20c2"}, {"anonymous": false, "inputs": [{"indexed": true, "internalType": "address", "name": "account", "type": "address"}], "name": "IssuerRemoved", "type": "event", "topic": "0xaf66545c919a3be306ee446d8f42a9558b5b022620df880517bc9593ec0f2d52"}, {"anonymous": false, "inputs": [{"indexed": true, "internalType": "address", "name": "from", "type": "address"}, {"indexed": true, "internalType": "address", "name": "to", "type": "address"}, {"indexed": false, "internalType": "uint256", "name": "value", "type": "uint256"}, {"indexed": false, "internalType": "bytes", "name": "data", "type": "bytes"}], "name": "Send", "type": "event", "topic": "0x76d4fc8756cf1c2b5aa667285d8c20b304dcd86209b4c34a84fc491867de76f1"}, {"anonymous": false, "inputs": [{"indexed": false, "internalType": "address", "name": "account", "type": "address"}], "name": "Suspended", "type": "event", "topic": "0x6f123d3d54c84a7960a573b31c221dcd86e13fd849c5adb0c6ca851468cc1ae4"}, {"anonymous": false, "inputs": [{"indexed": true, "internalType": "address", "name": "account", "type": "address"}], "name": "SuspenderAdded", "type": "event", "topic": "0xf4fbb5a5e62a703643fe5be0722720f728980fdde74f11d76eca7e13bdc3301d"}, {"anonymous": false, "inputs": [{"indexed": true, "internalType": "address", "name": "account", "type": "address"}], "name": "SuspenderRemoved", "type": "event", "topic": "0x17eb45856cd2283111eeb8a1dddf8a43121889e3ce798241f96d2afed353eaa3"}, {"anonymous": false, "inputs": [{"indexed": false, "internalType": "address", "name": "account", "type": "address"}], "name": "UnSuspended", "type": "event", "topic": "0x349b4285cb8dde314c53fd9d8e8e578381a7375e4f76f9dd9fe07f9960f120a4"}, {"constant": false, "inputs": [{"internalType": "address", "name": "account", "type": "address"}], "name": "addIssuer", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": false, "inputs": [{"internalType": "address", "name": "account", "type": "address"}], "name": "addSuspender", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": true, "inputs": [{"internalType": "address", "name": "owner", "type": "address"}, {"internalType": "address", "name": "spender", "type": "address"}], "name": "allowance", "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": false, "inputs": [{"internalType": "address", "name": "spender", "type": "address"}, {"internalType": "uint256", "name": "value", "type": "uint256"}], "name": "approve", "outputs": [{"internalType": "bool", "name": "", "type": "bool"}], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": true, "inputs": [{"internalType": "address", "name": "owner", "type": "address"}], "name": "balance", "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": false, "inputs": [{"internalType": "address[]", "name": "to", "type": "address[]"}, {"internalType": "uint256[]", "name": "values", "type": "uint256[]"}, {"internalType": "bytes", "name": "data", "type": "bytes"}], "name": "batchSend", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": false, "inputs": [{"internalType": "address", "name": "spender", "type": "address"}, {"internalType": "uint256", "name": "subtractedValue", "type": "uint256"}], "name": "decreaseAllowance", "outputs": [{"internalType": "bool", "name": "", "type": "bool"}], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": true, "inputs": [], "name": "description", "outputs": [{"internalType": "string", "name": "", "type": "string"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": false, "inputs": [{"internalType": "uint256", "name": "value", "type": "uint256"}, {"internalType": "bytes", "name": "data", "type": "bytes"}], "name": "destroy", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": false, "inputs": [{"internalType": "address", "name": "from", "type": "address"}, {"internalType": "uint256", "name": "value", "type": "uint256"}, {"internalType": "bytes", "name": "data", "type": "bytes"}], "name": "destroyFrom", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": false, "inputs": [{"internalType": "address", "name": "spender", "type": "address"}, {"internalType": "uint256", "name": "addedValue", "type": "uint256"}], "name": "increaseAllowance", "outputs": [{"internalType": "bool", "name": "", "type": "bool"}], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": true, "inputs": [{"internalType": "address", "name": "account", "type": "address"}], "name": "isIssuer", "outputs": [{"internalType": "bool", "name": "", "type": "bool"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": true, "inputs": [{"internalType": "address", "name": "account", "type": "address"}], "name": "isSuspender", "outputs": [{"internalType": "bool", "name": "", "type": "bool"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": false, "inputs": [{"internalType": "address", "name": "to", "type": "address"}, {"internalType": "uint256", "name": "value", "type": "uint256"}, {"internalType": "bytes", "name": "data", "type": "bytes"}], "name": "issue", "outputs": [{"internalType": "bool", "name": "", "type": "bool"}], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": true, "inputs": [], "name": "minUnit", "outputs": [{"internalType": "uint8", "name": "", "type": "uint8"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": false, "inputs": [], "name": "renounceIssuer", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": false, "inputs": [], "name": "renounceSuspender", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": false, "inputs": [{"internalType": "address", "name": "to", "type": "address"}, {"internalType": "uint256", "name": "value", "type": "uint256"}, {"internalType": "bytes", "name": "data", "type": "bytes"}], "name": "send", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": false, "inputs": [{"internalType": "address", "name": "from", "type": "address"}, {"internalType": "address", "name": "to", "type": "address"}, {"internalType": "uint256", "name": "value", "type": "uint256"}, {"internalType": "bytes", "name": "data", "type": "bytes"}], "name": "sendFrom", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": true, "inputs": [], "name": "shortName", "outputs": [{"internalType": "string", "name": "", "type": "string"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": false, "inputs": [], "name": "suspend", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": true, "inputs": [], "name": "suspended", "outputs": [{"internalType": "bool", "name": "", "type": "bool"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": true, "inputs": [], "name": "totalAmount", "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": false, "inputs": [], "name": "unSuspend", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}]'''
    contract_abi = None
    data_parser = DatatypeParser()
    client = None

    def __init__(self, address):
        self.client = BcosClient()
        self.address = address
        self.contract_abi = json.loads(self.contract_abi_string)
        self.data_parser.set_abi(self.contract_abi)

    def deploy(self, contract_bin_file):
        result = self.client.deployFromFile(contract_bin_file)
        self.address = result["contractAddress"]
        return result

    # ------------------------------------------
    def addIssuer(self, account):
        func_name = 'addIssuer'
        args = [to_checksum_address(account)]
        receipt = self.client.sendRawTransactionGetReceipt(self.address, self.contract_abi, func_name, args)
        outputresult = self.data_parser.parse_receipt_output(func_name, receipt['output'])
        return outputresult, receipt

    # ------------------------------------------
    def addSuspender(self, account):
        func_name = 'addSuspender'
        args = [to_checksum_address(account)]
        receipt = self.client.sendRawTransactionGetReceipt(self.address, self.contract_abi, func_name, args)
        outputresult = self.data_parser.parse_receipt_output(func_name, receipt['output'])
        return outputresult, receipt

    # ------------------------------------------
    def allowance(self, owner, spender):
        func_name = 'allowance'
        args = [to_checksum_address(owner), to_checksum_address(spender)]
        result = self.client.call(self.address, self.contract_abi, func_name, args)
        return result

    # ------------------------------------------
    def approve(self, spender, value):
        func_name = 'approve'
        args = [to_checksum_address(spender), value]
        receipt = self.client.sendRawTransactionGetReceipt(self.address, self.contract_abi, func_name, args)
        outputresult = self.data_parser.parse_receipt_output(func_name, receipt['output'])
        return outputresult, receipt

    # ------------------------------------------
    def balance(self, owner):
        func_name = 'balance'
        args = [to_checksum_address(owner)]
        result = self.client.call(self.address, self.contract_abi, func_name, args)
        return result

    # ------------------------------------------
    def batchSend(self, to, values, data):
        func_name = 'batchSend'
        args = [to, values, data]
        receipt = self.client.sendRawTransactionGetReceipt(self.address, self.contract_abi, func_name, args)
        outputresult = self.data_parser.parse_receipt_output(func_name, receipt['output'])
        return outputresult, receipt

    # ------------------------------------------
    def decreaseAllowance(self, spender, subtractedValue):
        func_name = 'decreaseAllowance'
        args = [to_checksum_address(spender), subtractedValue]
        receipt = self.client.sendRawTransactionGetReceipt(self.address, self.contract_abi, func_name, args)
        outputresult = self.data_parser.parse_receipt_output(func_name, receipt['output'])
        return outputresult, receipt

    # ------------------------------------------
    def description(self):
        func_name = 'description'
        args = []
        result = self.client.call(self.address, self.contract_abi, func_name, args)
        return result

    # ------------------------------------------
    def destroy(self, value, data):
        func_name = 'destroy'
        args = [value, data]
        receipt = self.client.sendRawTransactionGetReceipt(self.address, self.contract_abi, func_name, args)
        outputresult = self.data_parser.parse_receipt_output(func_name, receipt['output'])
        return outputresult, receipt

    # ------------------------------------------
    def destroyFrom(self, from1, value, data):
        func_name = 'destroyFrom'
        args = [to_checksum_address(from1), value, data]
        receipt = self.client.sendRawTransactionGetReceipt(self.address, self.contract_abi, func_name, args)
        outputresult = self.data_parser.parse_receipt_output(func_name, receipt['output'])
        return outputresult, receipt

    # ------------------------------------------
    def increaseAllowance(self, spender, addedValue):
        func_name = 'increaseAllowance'
        args = [to_checksum_address(spender), addedValue]
        receipt = self.client.sendRawTransactionGetReceipt(self.address, self.contract_abi, func_name, args)
        outputresult = self.data_parser.parse_receipt_output(func_name, receipt['output'])
        return outputresult, receipt

    # ------------------------------------------
    def isIssuer(self, account):
        func_name = 'isIssuer'
        args = [to_checksum_address(account)]
        result = self.client.call(self.address, self.contract_abi, func_name, args)
        return result

    # ------------------------------------------
    def isSuspender(self, account):
        func_name = 'isSuspender'
        args = [to_checksum_address(account)]
        result = self.client.call(self.address, self.contract_abi, func_name, args)
        return result

    # ------------------------------------------
    def issue(self, to, value, data):
        func_name = 'issue'
        args = [to_checksum_address(to), value, data]
        receipt = self.client.sendRawTransactionGetReceipt(self.address, self.contract_abi, func_name, args)
        outputresult = self.data_parser.parse_receipt_output(func_name, receipt['output'])
        return outputresult, receipt

    # ------------------------------------------
    def minUnit(self):
        func_name = 'minUnit'
        args = []
        result = self.client.call(self.address, self.contract_abi, func_name, args)
        return result

    # ------------------------------------------
    def renounceIssuer(self):
        func_name = 'renounceIssuer'
        args = []
        receipt = self.client.sendRawTransactionGetReceipt(self.address, self.contract_abi, func_name, args)
        outputresult = self.data_parser.parse_receipt_output(func_name, receipt['output'])
        return outputresult, receipt

    # ------------------------------------------
    def renounceSuspender(self):
        func_name = 'renounceSuspender'
        args = []
        receipt = self.client.sendRawTransactionGetReceipt(self.address, self.contract_abi, func_name, args)
        outputresult = self.data_parser.parse_receipt_output(func_name, receipt['output'])
        return outputresult, receipt

    # ------------------------------------------
    def send(self, to, value, data):
        func_name = 'send'
        args = [to_checksum_address(to), value, data]
        receipt = self.client.sendRawTransactionGetReceipt(self.address, self.contract_abi, func_name, args)
        outputresult = self.data_parser.parse_receipt_output(func_name, receipt['output'])
        return outputresult, receipt

    # ------------------------------------------
    def sendFrom(self, from1, to, value, data):
        func_name = 'sendFrom'
        args = [to_checksum_address(from1), to_checksum_address(to), value, data]
        receipt = self.client.sendRawTransactionGetReceipt(self.address, self.contract_abi, func_name, args)
        outputresult = self.data_parser.parse_receipt_output(func_name, receipt['output'])
        return outputresult, receipt

    # ------------------------------------------
    def shortName(self):
        func_name = 'shortName'
        args = []
        result = self.client.call(self.address, self.contract_abi, func_name, args)
        return result

    # ------------------------------------------
    def suspend(self):
        func_name = 'suspend'
        args = []
        receipt = self.client.sendRawTransactionGetReceipt(self.address, self.contract_abi, func_name, args)
        outputresult = self.data_parser.parse_receipt_output(func_name, receipt['output'])
        return outputresult, receipt

    # ------------------------------------------
    def suspended(self):
        func_name = 'suspended'
        args = []
        result = self.client.call(self.address, self.contract_abi, func_name, args)
        return result

    # ------------------------------------------
    def totalAmount(self):
        func_name = 'totalAmount'
        args = []
        result = self.client.call(self.address, self.contract_abi, func_name, args)
        return result

    # ------------------------------------------
    def unSuspend(self):
        func_name = 'unSuspend'
        args = []
        receipt = self.client.sendRawTransactionGetReceipt(self.address, self.contract_abi, func_name, args)
        outputresult = self.data_parser.parse_receipt_output(func_name, receipt['output'])
        return outputresult, receipt