I am trying to write tests for a smart contract and am having trouble transferring funds to the contract's address.
I'm using web3.py app which (if I understand correctly) runs its own TestRPC
, like this:
w3 = Web3(TestRPCProvider())
Then I deploy contract, after which I try to send funds to it:
ACCT_PASSPHRASE = 'KEYSMASH FJAFJKLDSKF7JKFDJ 1530'
acct_addr = w3.personal.newAccount(ACCT_PASSPHRASE)
w3.personal.unlockAccount(acct_addr, ACCT_PASSPHRASE, 1000)
txn_hash = w3.eth.sendTransaction(transaction={
"from": acct_addr,
"to": crowdsale_contract_address,
"value": 5,
"gas": 3000000,
})
txn = w3.eth.getTransaction(txn_hash)
Result is of course an exception:
ethereum.exceptions.InsufficientBalance: <Transaction(b'30c4')>: 'balance' actual:0 target:3000005
So, how do I create an account with sufficient balance?
Alternatively, how do I use one of the preexisting accounts? What are their passwords? Do they have any balance?