I recently upgraded Web3JS and Solc. Now every time I pass a zero address to a Solidity contact method the transaction reverts with an "invalid address" message. This message appears to be coming directly from the EVM since I don't have that message in any of my revert error strings. The error message includes the name of the parameter that the EVM thinks is invalid so I'm sure it's from the EVM (_bandAddr). This is from the method:

function payBand(address payable _bandAddr)

You can see that parameter in the error message:

invalid address (arg=\"_bandAddr\", coderType=\"address\", value=0)

I have tried passing "0" and "0x0" and still get that error. Has anybody else seen this and has a fix for it? Before upgrading I could simply pass "0" and would not get that error.

Ganache CLI v6.2.3
    using Ganache Core 2.3.1
Truffle 5.x beta
Web3 v1.0.0.0-beta.37
Solc v0.5.0
  • 1
    Could you share your JavaScript code? Have you tried "0x0000000000000000000000000000000000000000"? (Make sure you're using a quoted string.)
    – user19510
    Dec 16 '18 at 6:17
  • 1
    address payable is not supported in Solc v0.4.24, are you sure that your code compiles? Dec 16 '18 at 8:09
  • @goodvibration Thanks. That was a typo. It's actually Solc v0.5.0. Definitely compiles and migrates. Dec 16 '18 at 15:03
  • 1
    So as the first comment implies, perhaps Web3 v1.0.0.0-beta.37 requires that you pass the address as a 40-digit long hexadecimal string. I know that 34 doesn't require this, but perhaps they've changed something in 35 or 36 or 37. Dec 16 '18 at 15:08
  • 1
    @RobertOschler Done.
    – user19510
    Dec 16 '18 at 17:28

You'll need to use a proper 20-byte address. In this case, you want the quoted string: "0x0000000000000000000000000000000000000000".

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.