-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Description
When I run the Python file, it is connected with the smart contract as follows:
ganache_url = "HTTP://127.0.0.1:7545"
web3 = Web3(Web3.HTTPProvider(ganache_url))
web3.eth.defaultAccount = web3.eth.accounts[0]
abi =json.loads('')
bytecode=''
address= web3.toChecksumAddress('0xE8CCd1042ebe30c3F24952FfC7D16eC83a02f09f')
Courses = web3.eth.contract(abi=abi, bytecode=bytecode)
rusalt = Courses.constructor().transact()
rusalt_receipt = web3.eth.waitForTransactionReceipt(rusalt)
contract = web3.eth.contract(address=rusalt_receipt.contractAddress,abi=abi,)
app =Flask(__name__)
@app.route('/',methods=['POST', 'GET'])
def header():
abi = json.loads('')
address= web3.toChecksumAddress('0xE8CCd1042ebe30c3F24952FfC7D16eC83a02f09f')
contract = web3.eth.contract(address=address,abi=abi,)
if request.method == "POST":
server_number= request.form["server_number"]
meter_number = request.form["meter_number"]
x = contract.functions.get(int(server_number),int (meter_number)).call()
print("esraa")
print(contract.functions.get(int(server_number),int (meter_number)).call())
print(server_number,meter_number)
print(x)
#return render_template('header.html', res=x)
return render_template('header.html')
if (__name__)==("__main__"):
app.run(debug=True)
I get this error:ValueError: {'message': 'VM Exception while processing transaction: invalid opcode', 'code': -32000, 'data': {'0xbf973af40fd404802791ad76df890672564456efd9be22b51dd4e646e46763d9': {'error': 'invalid opcode', 'program_counter': 1177, 'return': '0x'}, 'stack': 'RuntimeError: VM Exception while processing transaction: invalid opcode\n at Function.RuntimeError.fromResults (/tmp/.mount_ganachoxVwo7/resources/static/node/node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)\n at /tmp/.mount_ganachoxVwo7/resources/static/node/node_modules/ganache-core/lib/blockchain_double.js:573:26', 'name': 'RuntimeError'}}
Metadata
Metadata
Assignees
Labels
No labels