1

I am trying to execute the following contract on remixe IDE:

pragma solidity ^0.5.4;
contract GuessTheNumberChallenge {
    constructor() public payable {
        require(msg.value == 1 ether);
    }

}

I am getting the following message and I am showing the Debug message also:

VM error: revert. revert The transaction has been reverted to the initial state. Note: The called function should be payable if you send value and the value you send should be less than your current balance. Debug the transaction to get more information. creation of GuessTheNumberChallenge pending... [vm]from:0xca3...a733cto:GuessTheNumberChallenge.(constructor)value:0 weidata:0x608...00032logs:0hash:0x3c2...162d0 status 0x0 Transaction mined but execution failed transaction hash 0x3c204d4cdd45c410f8ab98cf5db12ea1b31fbde7c35296f6820e2554b4f162d0 contract address 0x08970fed061e7747cd9a38d680a601510cb659fb from 0xca35b7d915458ef540ade6068dfe2f44e8fa733c to GuessTheNumberChallenge.(constructor) (Contract Creation - Step 0) gas 3000000 gas transaction cost 59197 gas execution cost 45 gas hash 0x3c204d4cdd45c410f8ab98cf5db12ea1b31fbde7c35296f6820e2554b4f162d0 input 0x608...00032 decoded input {} decoded output - logs [] value 0 wei

Somebody please guide me.

I am adding the image for execution: Adding 10 Ether in value

Zulfi.

1 Answer 1

1

Top right.

You will have to send 1 ether when you deploy the contract because the contract requires it.

Hope it helps.

5
  • I am already adding 10 in the value text box, I have even tried to select 'Ether' from the drop down list. I have attached the image. But I am still getting the revert message. Note that the deploy button is red. Somebody please guide me.
    – zak100
    Feb 9, 2020 at 15:19
  • 1
    You sent 10 Wei which is nowhere near 10 Eth. Common mistake. Change the unit to Eth. Thanks for accepting my answer. ;-) Feb 9, 2020 at 19:05
  • Excuse me , sir I tried with 10 Ether also but I am still getting revert message. Can i get your email address.
    – zak100
    Feb 9, 2020 at 19:14
  • 1
    Thanks it worked, I have to give just 1 ether.
    – zak100
    Feb 9, 2020 at 21:27
  • I'm on LinkedIn. Feb 9, 2020 at 21:56

Your Answer

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

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