def zchain_address_get_balance(chainId, addr): logger.info('Zchain.Address.GetBalance') ercchainId = chainId chainId = chainId.lower() balance = "0" if chainId == 'eth': balance = eth_utils.eth_get_address_balance(addr, chainId) elif 'erc' in chainId: #print ercchainId asser = None if erc_chainId_map.has_key(ercchainId): asset = erc_chainId_map[ercchainId] if asset == None: return error_utils.invalid_chainid_type(chainId) temp = { 'precison': asset['precison'], 'addr': addr, 'contract_addr': asset['address'] } balance = eth_utils.eth_get_address_balance(temp, chainId) elif chainId == "hc": balance = hc_plugin.hc_get_balance(addr) elif chainId in sim_btc_utils_all: balance = sim_btc_plugin[chainId].sim_btc_get_balance(addr) else: return error_utils.invalid_chainid_type(chainId) return {'chainId': chainId, 'address': addr, 'balance': balance}
def zchain_trans_createFullSendTrx(chainId, from_addr,dest_info): logger.info('Zchain.Trans.createTrx') if type(chainId) != unicode: return error_utils.mismatched_parameter_type('chainId', 'STRING') chainId = chainId.lower() result = {} if sim_btc_plugin.has_key(chainId): is_fast_record = db.get_collection("b_config").find_one({"key": "is_fast"}) is_fast = False if is_fast_record is not None: is_fast = bool(is_fast_record["value"]) result = sim_btc_plugin[chainId].sim_btc_create_transaction(from_addr,dest_info,is_fast,True) elif chainId == "hc": result = hc_plugin.hc_create_transaction(from_addr, dest_info) elif chainId == "usdt": result = usdt_plugin.omni_create_transaction(from_addr,dest_info) elif chainId == "btm": result = btm_plugin.btm_create_transaction(from_addr, dest_info) else: return error_utils.invalid_chainid_type(chainId) if result == {}: return error_utils.error_response("Cannot create transaction.") return { 'chainId': chainId, 'data': result }
def zchain_trans_decodeTrx(chainId, trx_hex): chainId = chainId.lower() logger.info('Zchain.Trans.DecodeTrx') if type(chainId) != unicode: return error_utils.mismatched_parameter_type('chainId', 'STRING') result = "" if sim_btc_plugin.has_key(chainId): result = sim_btc_plugin[chainId].sim_btc_decode_hex_transaction(trx_hex) elif chainId == "hc": result = hc_plugin.hc_decode_hex_transaction(trx_hex) elif chainId == "usdt": result = usdt_plugin.omni_decode_hex_transaction(trx_hex) elif chainId == "btm": result = btm_plugin.btm_decode_hex_transaction(trx_hex) else: return error_utils.invalid_chainid_type(chainId) if result == "": return error_utils.error_response("Cannot create transaction.") return { 'chainId': chainId, 'data': result }
def zchain_crypt_verify_message(chainId, addr, message, signature): chainId = chainId.lower() logger.info('Zchain.Crypt.VerifyMessage') if type(chainId) != unicode: return error_utils.mismatched_parameter_type('chainId', 'STRING') result = False cache_record = db.get_collection("b_verify_cache").find_one({"chainId": chainId,"addr":addr, "message":message, "signature":signature}) if cache_record is not None: result = True return { 'chainId': chainId, 'data': result } if sim_btc_plugin.has_key(chainId): result = sim_btc_plugin[chainId].sim_btc_verify_signed_message(addr, message, signature) elif chainId == "hc": result = hc_plugin.hc_verify_signed_message(addr, message, signature) elif (chainId == 'eth') or ('erc' in chainId): #print 1 result = eth_utils.eth_verify_signed_message(addr, message, signature) else: return error_utils.invalid_chainid_type(chainId) if result: db.get_collection("b_verify_cache").insert_one( {"chainId": chainId, "addr": addr, "message": message, "signature": signature}) return { 'chainId': chainId, 'data': result }
def zchain_multisig_create(chainId, addrs, amount): chainId = chainId.lower() logger.info('Zchain.Multisig.Create') if type(chainId) != unicode: return error_utils.mismatched_parameter_type('chainId', 'STRING') if type(addrs) != list: return error_utils.mismatched_parameter_type('addrs', 'ARRAY') if type(amount) != int: return error_utils.mismatched_parameter_type('amount', 'INTEGER') address = "" redeemScript = "" if sim_btc_plugin.has_key(chainId): result = sim_btc_plugin[chainId].sim_btc_create_multisig(addrs, amount) if result is not None: address = result["address"] redeemScript = result["redeemScript"] mutisig_record = db.get_collection("b_"+chainId+"_multisig_address").find_one({"address": address}) if mutisig_record is not None: db.get_collection("b_"+chainId+"_multisig_address").remove({"address": address}) data = {"address": address, "redeemScript": redeemScript, "addr_type":0} db.get_collection("b_"+chainId+"_multisig_address").insert_one(data) elif chainId == "hc": result = hc_plugin.hc_create_multisig(addrs, amount) if result is not None: address = result["address"] redeemScript = result["redeemScript"] mutisig_record = db.get_collection("b_hc_multisig_address").find_one({"address": address}) if mutisig_record is not None: db.get_collection("b_hc_multisig_address").remove({"address": address}) data = {"address": address, "redeemScript": redeemScript, "addr_type":0} db.get_collection("b_hc_multisig_address").insert_one(data) elif chainId == "btm": result = btm_plugin.btm_create_multisig(addrs, amount) if result is not None: address = result["address"] redeemScript = result["redeemScript"] mutisig_record = db.get_collection("b_btm_multisig_address").find_one({"address": address}) if mutisig_record is not None: db.get_collection("b_btm_multisig_address").remove({"address": address}) data = {"address": address, "redeemScript": redeemScript, "addr_type":0} db.get_collection("b_btm_multisig_address").insert_one(data) elif chainId == "usdt": result = usdt_plugin.omni_create_multisig(addrs, amount) if result is not None: address = result["address"] redeemScript = result["redeemScript"] mutisig_record = db.get_collection("b_" + chainId + "_multisig_address").find_one({"address": address}) if mutisig_record is not None: db.get_collection("b_" + chainId + "_multisig_address").remove({"address": address}) data = {"address": address, "redeemScript": redeemScript, "addr_type": 0} db.get_collection("b_" + chainId + "_multisig_address").insert_one(data) else: return error_utils.invalid_chainid_type(chainId) return { 'chainId': chainId, 'address': address, 'redeemScript': redeemScript }
def zchain_address_create(chainId): chainId = chainId.lower() logger.info('Create_address coin: %s' % (chainId)) if chainId == 'eth': address = eth_utils.eth_create_address() elif sim_btc_plugin.has_key(chainId): address = sim_btc_plugin[chainId].sim_btc_create_address() elif chainId == "hc": address = hc_plugin.hc_create_address() else: return error_utils.invalid_chainid_type(chainId) if address != "": if chainId == 'eth': pass # eth_utils.eth_backup() else: pass # btc_utils.btc_backup_wallet() data = db.b_chain_account.find_one({"chainId": chainId, "address": address}) if data != None: return {'chainId': chainId, 'error': '创建地址失败'} d = {"chainId": chainId, "address": address, "name": "", "pubKey": "", "securedPrivateKey": "", "creatorUserId": "", "balance": {}, "memo": "", "createTime": datetime.now().strftime("%Y-%m-%d %H:%M:%S")} db.b_chain_account.insert(d) return {'chainId': chainId, 'address': address} else: return {'chainId': chainId, 'error': '创建地址失败'}
def zchain_address_validate(chainId,addr): chainId = chainId.lower() logger.info("Zchain.Address.validate") if type(chainId) != unicode: return error_utils.mismatched_parameter_type('chainId', 'STRING') if type(addr) != unicode: return error_utils.mismatched_parameter_type('addr', 'STRING') result = None if sim_btc_plugin.has_key(chainId): result = sim_btc_plugin[chainId].sim_btc_validate_address(addr) elif chainId == "hc": result = hc_plugin.hc_validate_address(addr) elif chainId == "usdt": result = usdt_plugin.omni_validate_address(addr) elif chainId == "btm": result = btm_plugin.btm_validate_address(addr) return { "chainId": chainId, "valid": result } elif chainId == "eth" or 'erc'in chainId: result = eth_utils.eth_validate_address(addr) return { "chainId": chainId, "valid": result } else: return error_utils.invalid_chainid_type(chainId) return { "chainId":chainId, "valid" : result.get("isvalid") }
def zchain_addr_importaddr(chainId, addr): logger.info('Zchain.Addr.importAddr') if type(chainId) != unicode: return error_utils.mismatched_parameter_type('chainId', 'STRING') if sim_btc_plugin.has_key(chainId): sim_btc_plugin[chainId].sim_btc_import_addr(addr) elif chainId == "hc": hc_plugin.hc_import_addr(addr) elif chainId == "usdt": usdt_plugin.omni_import_addr(addr) elif chainId.lower() == 'eth': if "erc" in addr: temp_chainId = chainId.lower() pos = addr.find("erc") handle_addr = addr[0:pos] asset = db.b_eths_address.find_one({'chainId':temp_chainId,'address':handle_addr}) if asset == None: db.b_eths_address.insert({'chainId': temp_chainId, 'address': handle_addr, 'isContractAddress': True}) else: db.b_eths_address.update({'chainId':temp_chainId,'address':handle_addr},{"$set":{ 'isContractAddress': True}}) else: temp_chainId = chainId.lower() asset = db.b_eths_address.find_one({'chainId': temp_chainId, 'address': addr}) if asset == None: db.b_eths_address.insert({'chainId': temp_chainId, 'address': addr, 'isContractAddress': False}) else: db.b_eths_address.update({'chainId':temp_chainId,'address':addr},{"$set":{ 'isContractAddress': False}}) eth_utils.add_guard_address(addr) elif ('erc' in chainId.lower()): erc_asset = None if erc_chainId_map.has_key(chainId): erc_asset = erc_chainId_map[chainId] if erc_asset != None: if "erc" in addr: pos = addr.find("erc") handle_addr = addr[0:pos] asset = db.b_eths_address.find_one({'chainId': chainId, 'address': handle_addr}) if asset == None: db.b_eths_address.insert( {'chainId': chainId, 'address': handle_addr, 'isContractAddress': True}) else: db.b_eths_address.update({'chainId': chainId, 'address': handle_addr}, {"$set": {'isContractAddress': True}}) else: asset = db.b_eths_address.find_one({'chainId': chainId, 'address': addr}) if asset == None: db.b_eths_address.insert( {'chainId': chainId, 'address': addr, 'isContractAddress': False}) else: db.b_eths_address.update({'chainId': chainId, 'address': addr}, {"$set": {'isContractAddress': False}}) eth_utils.add_guard_address(addr) else: return error_utils.invalid_chainid_type(chainId) return { 'chainId': chainId, 'data': "" }
def zchain_multisig_add(chainId, addrs, amount, addrType): logger.info('Zchain.Multisig.Add') chainId = chainId.lower() if type(chainId) != unicode: return error_utils.mismatched_parameter_type('chainId', 'STRING') if type(addrs) != list: return error_utils.mismatched_parameter_type('addrs', 'ARRAY') if type(amount) != int: return error_utils.mismatched_parameter_type('amount', 'INTEGER') if type(addrType) != int: return error_utils.mismatched_parameter_type('addrType', 'INTEGER') address = "" if sim_btc_plugin.has_key(chainId): multisig_addr = sim_btc_plugin[chainId].sim_btc_add_multisig( addrs, amount) if multisig_addr is not None: addr_info = sim_btc_plugin[chainId].sim_btc_validate_address( multisig_addr) if addr_info == "": multisig_record = db.get_collection( "b_" + chainId + "_multisig_address").find_one( {"address": multisig_addr}) if multisig_record is not None: db.get_collection("b_" + chainId + "_multisig_address").remove( {"address": multisig_addr}) data = { "address": addr_info["address"], "redeemScript": addr_info["hex"], "addr_type": addrType } db.get_collection("b_" + chainId + "_multisig_address").insert_one(data) address = addr_info["address"] elif chainId == "hc": multisig_addr = hc_plugin.hc_add_multisig(addrs, amount) if multisig_addr is not None: addr_info = hc_plugin.hc_validate_address(multisig_addr) if addr_info is not None: multisig_record = db.get_collection( "b_hc_multisig_address").find_one( {"address": multisig_addr}) if multisig_record is not None: db.get_collection("b_hc_multisig_address").remove( {"address": multisig_addr}) data = { "address": addr_info["address"], "redeemScript": addr_info["hex"], "addr_type": addrType } db.get_collection("b_hc_multisig_address").insert_one(data) else: return error_utils.invalid_chainid_type() return {'chainId': chainId, 'data': address}
def zchain_trans_broadcastTrx(chainId, trx): logger.info('Zchain.Trans.broadcastTrx') global last_clean_broadcast_cache_time if type(chainId) != unicode: return error_utils.mismatched_parameter_type('chainId', 'STRING') md = hashlib.md5() md.update(trx) trxId = md.hexdigest() broad_cast_record = db.get_collection("b_broadcast_trans_cache").find_one({ "chainId": chainId, "trx": trxId, "effectiveTime": { "$gt": int(time.time()) - 10 } }) if broad_cast_record is not None: if broad_cast_record['result'] == "": return error_utils.error_response("Cannot broadcast transactions.") return {'chainId': chainId, 'data': broad_cast_record['result']} result = "" if sim_btc_plugin.has_key(chainId): result = sim_btc_plugin[chainId].sim_btc_broadcaset_trx(trx) elif chainId == "hc": result = hc_plugin.hc_broadcaset_trx(trx) elif chainId.lower() == "eth": result = eth_utils.eth_send_raw_transaction(trx) elif 'erc' in chainId.lower(): result = eth_utils.eth_send_raw_transaction(trx) else: return error_utils.invalid_chainid_type() db.get_collection("b_broadcast_trans_cache").insert_one({ "chainId": chainId, "trx": trxId, "effectiveTime": int(time.time()), "result": result }) if int(time.time()) - last_clean_broadcast_cache_time > 10 * 60: db.get_collection("b_broadcast_trans_cache").delete_many( {"effectiveTime": { "$lt": int(time.time()) - 10 }}) last_clean_broadcast_cache_time = int(time.time()) if result == "": return error_utils.error_response("Cannot broadcast transactions.") return {'chainId': chainId, 'data': result}
def zchain_EthCall(chainId,callData,blockheight): logger.info('Zchain.EthCall') chainId = chainId.lower() if type(chainId) != unicode: return error_utils.mismatched_parameter_type('chainId', 'STRING') ercchainId = chainId if chainId == 'eth': ret = eth_utils.eth_call(callData,blockheight) return ret elif 'erc' in chainId: #print ercchainId asset = None if erc_chainId_map.has_key(ercchainId): asset = erc_chainId_map[ercchainId] if asset == None: return error_utils.invalid_chainid_type(chainId) ret = eth_utils.eth_call(callData, blockheight) return ret return error_utils.invalid_chainid_type()
def zchain_withdraw_getinfo(chainId): """ 查询提现账户的信�? :param chainId: :return: """ chainId = chainId.lower() logger.info('Zchain.Withdraw.GetInfo') if type(chainId) != unicode: return error_utils.mismatched_parameter_type('chainId', 'STRING') records = db.b_config.find_one({'key': 'withdrawaddress'}, {'_id': 0}) address = "" if records == None: db.b_config.insert_one({"key": "withdrawaddress", "value": []}) records = db.b_config.find_one({'key': 'withdrawaddress'}, {'_id': 0}) for r in records["value"]: if r['chainId'] == chainId: address = r['address'] if address == "": if chainId == "eth": address = eth_utils.eth_create_address() # eth_utils.eth_backup() records["value"].append({"chainId": "eth", "address": address}) elif sim_btc_plugin.has_key(chainId): address = sim_btc_plugin[chainId].sim_btc_create_withdraw_address() sim_btc_plugin.sim_btc_backup_wallet() records["value"].append({"chainId": chainId, "address": address}) elif chainId == "hc": address = hc_plugin.hc_create_withdraw_address() hc_plugin.hc_backup_wallet() records["value"].append({"chainId": chainId, "address": address}) elif chainId == "etp": address = etp_utils.etp_create_withdraw_address() records["value"].append({"chainId": "etp", "address": address}) db.b_config.update({"key": "withdrawaddress"}, {"$set": {"value": records["value"]}}) balance = 0.0 if chainId == "eth": balance = eth_utils.eth_get_base_balance(address) elif sim_btc_plugin.has_key(chainId): balance = sim_btc_plugin.sim_btc_get_withdraw_balance() elif chainId == "hc": balance = hc_plugin.hc_get_withdraw_balance() elif chainId == "etp": balance = etp_utils.etp_get_addr_balance(address) else: return error_utils.invalid_chainid_type(chainId) return { 'chainId': chainId, 'address': address, 'balance': balance }
def zchain_query_getEthTrx(chainId,trxid): logger.info('Zchain.Query.getEthTrx') if type(chainId) != unicode: return error_utils.mismatched_parameter_type('chainId', 'STRING') chainId = chainId.lower() result = {} if 'erc' in chainId: result = eth_utils.eth_get_trx(trxid) elif 'eth' == chainId: result = eth_utils.eth_get_trx(trxid) else: return error_utils.invalid_chainid_type(chainId) #print result return result
def zchain_query_getTrxHistoryByAddress(chainId,address,startBlock,endBlock): logger.info('Zchain.Query.getTrxHistoryByAddress') if type(chainId) != unicode: return error_utils.mismatched_parameter_type('chainId', 'STRING') chainId = chainId.lower() result = [] if 'erc' in chainId: result = eth_utils.eth_get_trx_history_by_address(address,startBlock,endBlock) elif 'eth' == chainId: result = eth_utils.eth_get_trx_history_by_address(address,startBlock,endBlock) else: return error_utils.invalid_chainid_type(chainId) #print result return result
def zchain_addr_importaddr(chainId, addr): logger.info('Zchain.Addr.importAddr') if type(chainId) != unicode: return error_utils.mismatched_parameter_type('chainId', 'STRING') if sim_btc_plugin.has_key(chainId): sim_btc_plugin[chainId].sim_btc_import_addr(addr) elif chainId == "hc": hc_plugin.hc_import_addr(addr) else: return error_utils.invalid_chainid_type() return { 'chainId': chainId, 'data': "" }
def zchain_query_getUtxoCount(chainId, address): logger.info('Zchain.Query.getUtxoCount') if type(chainId) != unicode: return error_utils.mismatched_parameter_type('chainId', 'STRING') chainId = chainId.lower() result = {} if sim_btc_plugin.has_key(chainId): result = sim_btc_plugin[chainId].sim_btc_get_trx_out(address) elif chainId == "hc": result = hc_plugin.hc_get_trx_out(address) else: return error_utils.invalid_chainid_type() #print result return len(result)
def zchain_trans_getTrxOuts(chainId, addr): chainId = chainId.lower() logger.info('Zchain.Trans.getTrxOuts') if type(chainId) != unicode: return error_utils.mismatched_parameter_type('chainId', 'STRING') result = False if sim_btc_plugin.has_key(chainId): result = sim_btc_plugin[chainId].sim_btc_query_tx_out(addr) elif chainId == "hc": result = hc_plugin.hc_query_tx_out(addr) else: return error_utils.invalid_chainid_type() return {'chainId': chainId, 'data': result}
def zchain_trans_getEthTrxCount(chainId, addr, indexFormat): logger.info('Zchain.Trans.getEthTrxCount') if type(chainId) != unicode: return error_utils.mismatched_parameter_type('chainId', 'STRING') chainId = chainId.lower() result = {} if 'erc' in chainId: result = eth_utils.eth_get_trx_count(addr,indexFormat) elif 'eth' == chainId: result = eth_utils.eth_get_trx_count(addr, indexFormat) else: return error_utils.invalid_chainid_type(chainId) if result == {}: return error_utils.error_response("Cannot eth trx count.") #print result return result
def zchain_crypt_sign(chainId, addr, message): logger.info('Zchain.Crypt.Sign') if type(chainId) != unicode: return error_utils.mismatched_parameter_type('chainId', 'STRING') signed_message = "" if sim_btc_plugin.has_key(chainId): signed_message = sim_btc_plugin[chainId].sim_btc_sign_message( addr, message) elif chainId == "hc": signed_message = hc_plugin.hc_sign_message(addr, message) else: return error_utils.invalid_chainid_type() if signed_message == "": return error_utils.error_response("Cannot sign message.") return {'chainId': chainId, 'data': signed_message}
def zchain_trans_createTrx(chainId, from_addr, dest_info): logger.info('Zchain.Trans.createTrx') if type(chainId) != unicode: return error_utils.mismatched_parameter_type('chainId', 'STRING') chainId = chainId.lower() result = {} if sim_btc_plugin.has_key(chainId): result = sim_btc_plugin[chainId].sim_btc_create_transaction( from_addr, dest_info) elif chainId == "hc": result = hc_plugin.hc_create_transaction(from_addr, dest_info) else: return error_utils.invalid_chainid_type() if result == {}: return error_utils.error_response("Cannot create transaction.") return {'chainId': chainId, 'data': result}
def zchain_crypt_verify_message(chainId, addr, message, signature): chainId = chainId.lower() logger.info('Zchain.Crypt.VerifyMessage') if type(chainId) != unicode: return error_utils.mismatched_parameter_type('chainId', 'STRING') result = False if sim_btc_plugin.has_key(chainId): result = sim_btc_plugin[chainId].sim_btc_verify_signed_message(addr, message, signature) elif chainId == "hc": result = hc_plugin.hc_verify_signed_message(addr, message, signature) else: return error_utils.invalid_chainid_type() return { 'chainId': chainId, 'data': result }
def zchain_trans_CombineTrx(chainId, transactions): logger.info('Zchain.Trans.CombineTrx') chainId = chainId.lower() if type(chainId) != unicode: return error_utils.mismatched_parameter_type('chainId', 'STRING') result = "" if sim_btc_plugin.has_key(chainId): result = sim_btc_plugin[chainId].sim_btc_combine_trx(transactions) elif chainId == "hc": result = hc_plugin.hc_combine_trx(transactions) else: return error_utils.invalid_chainid_type() if result == "": return error_utils.error_response("Cannot combine transaction.") return {'chainId': chainId, 'data': result}
def zchain_Trans_sign(chainId, addr, trx_hex, redeemScript): logger.info('Zchain.Trans.Sign') if type(chainId) != unicode: return error_utils.mismatched_parameter_type('chainId', 'STRING') signed_trx = "" if sim_btc_plugin.has_key(chainId): signed_trx = sim_btc_plugin[chainId].sim_btc_sign_transaction( addr, redeemScript, trx_hex) elif chainId == "hc": signed_trx = hc_plugin.hc_sign_transaction(addr, redeemScript, trx_hex) else: return error_utils.invalid_chainid_type() if signed_trx == "": return error_utils.error_response("Cannot sign trans.") return {'chainId': chainId, 'data': signed_trx}
def zchain_trans_broadcastTrx(chainId, trx): logger.info('Zchain.Trans.broadcastTrx') if type(chainId) != unicode: return error_utils.mismatched_parameter_type('chainId', 'STRING') result = "" if sim_btc_plugin.has_key(chainId): result = sim_btc_plugin[chainId].sim_btc_broadcaset_trx(trx) elif chainId == "hc": result = hc_plugin.hc_broadcaset_trx(trx) else: return error_utils.invalid_chainid_type() if result == "": return error_utils.error_response("Cannot broadcast transactions.") return { 'chainId': chainId, 'data': result }
def zchain_query_getBlockHeight(chainId): logger.info('Zchain.Query.getBlockHeight') if type(chainId) != unicode: return error_utils.mismatched_parameter_type('chainId', 'STRING') chainId = chainId.lower() result = {} if 'erc' in chainId: result = eth_utils.eth_get_block_height() elif 'eth' == chainId: result = eth_utils.eth_get_block_height() elif 'hc' == chainId: cache_record = db.get_collection("b_config").find_one({"key" : "hcsyncblocknum"}) if cache_record is not None: result = int(cache_record["value"]) else: result=0 else: return error_utils.invalid_chainid_type() if result == {}: return error_utils.error_response("Cannot eth trx count.") #print result return result
print "query confirmation failed", ex elif chainId == "btm": result = btm_plugin.btm_get_transaction(trxid) if "outputs" in result: is_cache = True elif chainId == "eth" or "erc" in chainId: source,respit = eth_utils.get_transaction_data(trxid) so_re_dic = {'source_trx':source,'respit_trx':respit} if "input" in source: is_cache = True if source != None and respit != None: result = so_re_dic else: return error_utils.invalid_chainid_type(chainId) if result == "": return error_utils.error_response("Cannot query transaction.") if result.has_key("vin"): for i in range(len(result["vin"])): result["vin"][i]["scriptSig"]={"asm":"","hex":""} if is_cache: db.get_collection("b_query_trans_cache").insert_one( {"chainId": chainId, "trxid": trxid,"result":result}) return { 'chainId': chainId, 'data': result } @jsonrpc.method('Zchain.Trans.queryTransBatch(chainId=str, trxids=list)')