使用Python Web3.py调用Solidity函数>> [

问题描述 投票:0回答:1
我使用以下给出的不同参数组成的稳定性编写了智能合约功能

function addDevice(address _address, string _deviceType, string _deviceName, string _minerID, string _deviceID) public { DeviceData storage device = devices[_address]; device.deviceType = _deviceType; device.deviceName = _deviceName; device.minerID = _minerID; device.deviceID = _deviceID; devicesAddresses.push(_address) -1; }

我正在使用web3.py通过给定的命令调用此函数,如>>

D_Address = input("Device Address ").encode() D_Type = input("Device Type ") D_Name = input("Device Name ") M_ID = input("Miner ID ") D_ID = input("Device ID ") tx_hash = contract_instance.functions.addDevice(D_Address,D_Type,D_Name,M_ID,D_ID).transact() tx_receipt = web3.eth.waitForTransactionReceipt(tx_hash)

在REMIX中,此智能合约工作正常,但是当我运行文件时,它显示以下错误

找到名称为addDevice的1个函数:['addDevice(地址,字符串,字符串,字符串,字符串)']由于没有匹配的参数类型,函数调用失败。

我已经使用由不同参数组成的坚固性编写了智能合约功能,功能如下addDevice(address _address,string _deviceType,string _deviceName,string _minerID,...

python ethereum solidity web3
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.