This is my Bank contract. I'm not using any payable function for newAccount still it is giving the error "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."

pragma solidity ^0.4.17;

contract Bank{
    enum gender{MALE, FEMALE, OTHER}
    address manager;
    string bankName;
    mapping(address=>bool) account;
    struct Address{
        string line1;
        string line2;
        string city;
        string state;
        string pincode;
    struct detail{
        string firstName;
        string lastName;
        uint8 age;
        gender Gen;
        Address addr;
    detail[] Details;
    mapping(address=>detail) Info;
    function Bank(string _name) public{
        bankName = _name;
        manager = msg.sender;
    modifier confirmer(){
        require(account[msg.sender] = false);
    function newAccount(string _firstname,
                        string _lastname,
                        uint8 age,
                        gender gen,
                        string Address_line1,
                        string Address_line2,
                        string city,
                        string state,
                        string pincode) confirmer public{
            account[msg.sender] = true;
            Info[msg.sender] = detail(_firstname,_lastname,age,gen,Address(Address_line1,Address_line2,city,state,pincode));
    function showInfo() public view returns(string){
        return Info[msg.sender].firstName;

  • That's just a guess from the system, it doesn't mean it would revert due to payable problems. The main thing is that your transaction reverts, and you need to figure out why Commented Apr 15, 2021 at 18:10
  • The issue comes from the modifier confirmer. It should use a double == and not a single one.
    – clement
    Commented Apr 15, 2021 at 19:45


Your Answer

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

Browse other questions tagged or ask your own question.