I'm following a LinkedIn course on Solidity and creating a simple contract. Code below:

I'm new to solidity so I'm not sure exactly where I'm going wrong but I get the following error:

Transact to Inheritance.Died errored: VM error: revert. The Transaction has been reverted to initial state. The constructor should be payable if you send value.

I have the word payable denoted in my constructor should not sure what is going on. Programming errors can sometimes mean a million things.

Note: I'm compiling and running in remix IDE

//import solidity
pragma solidity ^0.5.1;

contract Inheritance {
    address owner;
    bool deceased;
    uint money;

    constructor() public payable {
        owner = msg.sender;
        money = msg.value;
        deceased = false;

    modifier oneOwner {
        require (msg.sender == owner);

    modifier isDeceased {
        require (deceased = true);

    // setup an array of addresses and call the array wallets
    address payable[] wallets;

    mapping (address => uint) inheritance;

    // needs the modifier oneOwner to run
    // function to setup the wallet
    function setup(address payable _wallet, uint _inheritance) public oneOwner {
        inheritance[_wallet] = _inheritance;

    function moneyPaid() private isDeceased {
        for (uint i=0; 0<wallets.length; i++) {

    function died() public oneOwner {
        deceased = true;

  • Ignore the last sentence of the error message. When you get that message, it just means that the transaction failed. My guess would be you called died, but the contract didn't have a sufficient ether balance to pay out all the inheritances, so one of the transfer calls failed.
    – user19510
    Commented Jul 16, 2019 at 18:36
  • 1
    Can you add more context. Do you get this error when you call a method? Which one? With which account?
    – n1c01a5
    Commented Jul 16, 2019 at 19:02
  • That error message is standard, you will have to debug what went wrong Commented Jul 17, 2019 at 8:41
  • @n1c01a5 It happens when I call the setup function. I'm running on JavaScript VM Environment selected from Remix. Actually, this contract is from a LinkedIn Learning course called 'Blockchain: Learning Solidity'. The instructor advises that we should enter 100 in value (wei). Then to test the inheritance contract, which is supposed to pay all wallets/address not exceeding sum totaling 100 wei where we have setup using the setup function which takes two arguments: address and amount to inherit. The instructor advises that we grab the contract address as one of the wallets which inherits.
    – Shaye
    Commented Jul 21, 2019 at 18:44
  • @n1c01a5. Funny thing is the instructor gets the exact same error on his screen but somehow thinks the wallets have inherited the amounts entered in the setup function when the died function is called.
    – Shaye
    Commented Jul 21, 2019 at 18:52

1 Answer 1


I have this error when I called the function setup when another account than the owner. For info we can only call this function with the owner (creator of the contract).

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.