I am using Python web3
in order to deploy and test a Solidity contract.
Here are my initial steps:
from web3 import Web3
from web3 import RPCProvider
from json import loads
eth = Web3(RPCProvider()).eth
abi = open(ABI_FILE_NAME).read()
bin = open(BIN_FILE_NAME).read()
transaction = {'from':eth.accounts[0]}
contract = eth.contract(abi=loads(abi),bytecode=bin)
tx_hash = contract.deploy(transaction=transaction)
address = eth.getTransactionReceipt(tx_hash)['contractAddress']
handle = contract(address).transact(transaction)
At this point, I invoke a function in the contract:
tx_hash = handle.some_func()
And this is what I get when I call eth.getTransactionReceipt(tx_hash)
:
{
'transactionHash' : '0x...',
'transactionIndex' : 0,
'blockHash' : '0x...',
'blockNumber' : 3710,
'gasUsed' : 72597,
'cumulativeGasUsed' : 72597,
'contractAddress' : None,
'logs' : [],
'status' : 1
}
How can I retrieve the actual value that some_func
has returned?
I found a very detailed answer which seems to refer to this issue, but I have not been able to conclude the actual steps required.
Thank you.