I am very new to Ethereum, and just working through some early tutorials using the testnet. My version is up to date; the blockchain is also up to date; and I have only one account in the keystore, the main account.

As I try to deploy a simple contract (or any contract for that matter - including the examples on ethereum.org), the code compiles correctly:

enter image description here

When I go ahead and hit deploy contract, the confirmation popup gives me this error: "it seems this transaction will fail. If you submit it, it may consume all the gas you send"

enter image description here

It gives me this error irrespective of whether I send 1 eth or 20eth, and regardless of the fee amount I choose.

If I press on regardless, the contract appears to be created on the mist wallet UI, but sits with another error message under the transaction saying basically that no data reached the blockchain: " No data is deployed on the contract address!".

My apologies if this is basic. I have scanned previous questions and they either didn't quite cover this scenario, or had a fix that didn't work for me (like reselecting the FROM account just before deploying)

Many thanks in advance.


You can't send ether to this constructor or it will fail by design. If you want the opposite behavior then you specify the keyword "payable" in the function. It helps prevent errant transactions sending ether to contracts with no hope of recovering it.

Hope it helps.


Example for clarity.

pragma solidity ^0.4.2;
contract Example {

   string public brandName;

   function Example(string yourCompanyName) payable { // <--- here    
       brandName = yourCompanyName;


As eluded to earlier, there is no way to make the contract send ether, so any funds deposited there are marooned. We could fix that with a simple indiscriminate withdraw function.

function withdraw(uint amount) public returns(bool success) {
   if(!msg.sender.send(amount) throw;
   return true;
  • Cheers Rob, the bytes 32 comments went over my head at this stage, however omitting an ether amount did prevent the error message and it did allow me to deploy the contract on the public test net. Many thanks for your answer - it fixed the problem i was having. – Benc93 Jan 28 '17 at 8:45
  • Thanks for the feedback. I updated my answer to concentrate on the solution that worked in this case. – Rob Hitchens Jan 28 '17 at 15:01
  • if you provide some code examples with payable that would be good – dark_ruby Jun 24 '17 at 12:17
  • @dark_ruby. Added example. – Rob Hitchens Jun 24 '17 at 18:23
  • As mentioned stackoverflow.com/questions/40750913/…, From Solidity 0.4 onwards: A throw consumes all gas, so use function t() payable returns (uint) – Rajesh Oct 16 '17 at 6:09

having same issue using mist and testrpc , my code is

contract sampletoken{
mapping(address=>unit256) public balances;
function sampletoken(unit256 initialsupply) payable

get the same error when i deploy , you can find the screenshot at https://i.stack.imgur.com/R5BLz.png

  • 1
    This is not an answer and should not be in the answer field. Please move it to a comment for it to be more helpful. – Omkar Khair Aug 10 '17 at 6:46
  • @omkar khair i dont have that much reputation – Ether Aug 10 '17 at 13:15
  • Comments shouldn't require reputation. Either ways, posting a question in the answer field isn't an option either. That would lead to a penalty in reputation. – Omkar Khair Aug 11 '17 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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