I am using populus to experiment my contract. I want to return only gasUsed
for my transaction but it returns complete summary of the transaction.
[Q] How could I obtain only gasUsed
value or should I retrieve that value by trimming the string from the output.
test.py:
def test_linkedlist(web3, accounts, chain, unmigrated_chain):
my_contract = unmigrated_chain.get_contract('Receipt');
set_txn_hash = my_contract.transact().push( 10, 20, 32 );
receipt_txn_hash = unmigrated_chain.wait.for_receipt(set_txn_hash)
print( receipt_txn_hash ); || print( web3.eth.getTransactionReceipt("0x1139cca78666519a834cf40670faa4f01324a04f0ec4e6072863bf4812598a5f") ); #both give the same output.
Output:
tests/test_greeter.py No handlers could be found for logger "testrpc.rpc"
/usr/local/lib/python2.7/site-packages/secp256k1/__init__.py:228: UserWarning: implicit cast from 'char *' to a different pointer type: will be forbidden in the future (check that the types are as you expect; use an explicit ffi.cast() if they are correct)
self.ctx, res_compressed, outlen, self.public_key, compflag)
{'contractAddress': None, 'cumulativeGasUsed': 114325, 'logs': [],
'blockHash': u'0xda17ffe52e074957420554fbf2e3fb86d1ff81db989c6bb50d22a88850ee9495',
'transactionHash': u'0x1139cca78666519a834cf40670faa4f01324a04f0ec4e6072863bf4812598a5f',
'blockNumber': 4, 'transactionIndex': 0, 'gasUsed': 114325}
I want to return only: 114325
___________________________^
Thank you for your valuable time and help.