合约代码
function withdraw() public {
require(owner == msg.sender);
msg.sender.transfer(address(this).balance);
}
python 代码
transaction = contracts.functions.withdraw()
signed_tx = w3.eth.account.signTransaction(transaction, private_key=private_key)
tx_hash = w3.eth.sendRawTransaction(signed_tx.rawTransaction)
print(tx_hash)