When I call the "setStartTime" function, it works but when I check "_startingTime" I get this error:

call to timeTracker._startingTime 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)

Why am I getting this? If I am able to set time, then the mapping should have something to return?

contract timeTracker {

    mapping(address => uint256) public _startingTime;
    uint256 constant ONE_DAY = 86400;

    function setStartTime() public returns (uint time) {

        _startingTime[msg.sender] = block.timestamp;
        return _startingTime[msg.sender];

    //checks if 24 hours have passed
    function checkIfDayPassed() public {
         //86400 seconds in a day
        require(block.timestamp - _startingTime[msg.sender] >= ONE_DAY, "Claim not ready");
  _startingTime[msg.sender] = block.timestamp;

1 Answer 1


In your code above, _startingTime is defined as a mapping. When calling it, you need to pass it a correctly formatted address as an input for it to return anything meaningful. Apparently, you were calling it without passing in any value.

  • ah yeah, I see where I went wrong. I had thought that remix might have passed an address for me, but I had to enter it manually. Cheers!
    – Gabriel
    Commented Jun 9, 2021 at 7:08
  • I'm having a similar problem with the same error. What kind of address do I need to be passing? Thanks. Commented Mar 3, 2022 at 0:40
  • Just any valid Ethereum address. You could learn more about what makes an address valid here: info.etherscan.com/what-is-an-ethereum-address Commented Mar 3, 2022 at 9:03

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.