w3.eth.getTransactionReceipt(tx_hash)
函数返回None
。
我的代码:
provider = HTTPProvider('http://0.0.0.0:9945')
w3 = Web3(provider)
contract = w3.eth.contract(contract_interface['abi'], bytecode=contract_interface['bin'])
tx_hash = contract.deploy(transaction={'from': w3.eth.coinbase, 'gas': 250000})
print (tx_hash)
time.sleep(1)
tx_receipt = w3.eth.getTransactionReceipt(tx_hash)
print (tx_receipt)
contract_address = tx_receipt['contractAddress']
tx_hash
是正常值但是tx_receipt
是None
。
所以我的错误:
contract_address = tx_receipt['contractAddress']
TypeError: 'NoneType' object is not subscriptable
我该如何解决这个问题?