I've been getting this error when I try and deploy a contract with a constructor on multiple pieces of code. I use the correct complier version too

creation of MyContract errored: Error encoding arguments: Error: invalid address (argument="address", value="", code=INVALID_ARGUMENT, version=address/5.1.0) (argument=null, value="", code=INVALID_ARGUMENT, version=abi/5.1.2)

can anyone help?

pragma solidity 0.5.1;

contract MyContract {
    mapping(address => uint256) public balances;
    address payable wallet;
    constructor(address payable _wallet) public {
        wallet = _wallet;
    function buyToken() public payable{
        //buy token
        balances[msg.sender] += 1;
        //send eth to wallet

edit: this is happening when I pass in address payable _wallet into my constructor. If I take out address payable I can deploy. This happens on my other computer too. So I know this isnt a machine related error

  • Hi there. Please edit your question to include at least the constructor and the way you're invoking it (i.e. your deployment parameters). Commented May 8, 2021 at 7:23
  • can you please show me how to and where i need to paste the wallet address Thanks in adbance Commented Dec 21, 2021 at 21:07

1 Answer 1


Your code is all good. Your problem is that the editor you are using is having some different version of solidity compiler installed in it. Try using that same version in your code too or else you can always use Remix editor for writing Smart Contracts.

Hope your problem is resolved

Okay so just checked it again, everything is fine. The thing is since you are passing an argument inside the constructor, so you need to provide that before deploying your smart contract. Since you are not providing it any address of an account, it throws invalid argument error.

Just copy an address, it can be the one from which you are deploying your smart contract too, paste it in arguments field next to deploy and then proceed. It will work without any problem.

All the best!

  • 1
    I am using the same complier version that I have stated in code on remix. Is there any other reason this would be happening. Can I call a function to change the abi version or something?
    – Merc
    Commented May 8, 2021 at 21:20
  • I have updated my previous answer you can check it Commented May 9, 2021 at 6:48
  • I would up vote but I need more rep. You have solved my problem. You are the best. I've been at this for 3 days. THANK YOU. It was a huge aha moment
    – Merc
    Commented May 9, 2021 at 10:34
  • I know.. There have been times when I also used to get stuck like this In fact, I'm also a beginner like you so yeah Good Luck !! Commented May 9, 2021 at 12:00

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.