trying to send a very simple contract creation transaction that includes a value with it so that the created contract already contains an ether balance. Is this not possible. Basically I'm sending a transaction like this using the web3 console API,

web3.eth.sendTransaction({from:web3.eth.coinbase, data: <some contract data>, value: web3.toWei(1, 'ether')})

however I get a revert error.

I know that I can create the contract, and as long as the fallback function is payable in the contract I can then deposit ethers, but I'd like to be able to do this in one go when the contract is created. Is this possible?

In case it makes a difference I'm doing this in a truffle development chain console.

1 Answer 1


When deploying and sending value at the same time, your constructor needs to be "payable", otherwise it cannot receive value.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.