This code gives a TransactionFailed. If I change value to 0, it works, but then I can't actually have contracts use send/transfer. It also doesn't work to do a send transaction with the to being the contractAddress.
from testrpc.client import EthTesterClient
from solc import *
from solc.exceptions import SolcError
c = EthTesterClient()
ac = sorted(c.get_accounts())
contract = """
contract c {
function f() returns (int) {
return 10;
}
}
"""
bin = compile_source(contract,optimize=True).values()[0]['bin']
txnHash = c.send_transaction(_from = ac[0], data = bytes(bin), value=1000)
txnReceipt = c.get_transaction_receipt(txnHash)
contractAddress = txnReceipt['contractAddress']
print (contractAddress), c.get_balance(contractAddress)
This code gives a TransactionFailed. If I change value to 0, it works, but then I can't actually have contracts use send/transfer. It also doesn't work to do a send transaction with the to being the contractAddress.