The smart contract was written and deployed on Kovan using Remix IDE and injected Metamask Kovan test network account. However, I'll need python to deal with large input of a function in the smart contract. How can I do this? I have tried to register an Infura account and use it to interact with the function, the python code runs smoothly, but I can't see any changes to the smart contract. So I'm wondering how I can realize this goal. Thanks in advance.
My code logic is as follows.
w3 = Web3(Web3.HTTPProvider('https://kovan.infura.io/v3/...(my address)'))
ctr = w3.eth.contract(address=address, abi=abi) # address and abi are both specified previously
ctr.functions.my_func(input).call()
Best Answer
Any smart contract call cannot change the Ethereum state.
You need to perform a transaction and pay the gas fee to make any state changes. There are no free state changes.
Use
transact()
instead ofcall()
. You will also need to set up a local private key.