Error: invalid address when invoking transferOwnership function from truffle console

Hello all,

I am currently developing an oracle that fetches certain value from an external service and stores it on a public variable on my contract so it can be consumed by others. I am using Provable API to do this.
Recently I decided to add OpenZeppelin’s Ownable contract to manage access control. It all seems fine until I try to invoke transferOwnership function, then I get the following errror:

    { Error: invalid address (arg="newOwner", coderType="address", value="0x72222d032f4D5CCc21637bcAfC64Fc79dd94Ce66")
    at ABICoder.encodeParameters (/Users/marcosirisarri/.nvm/versions/node/v10.16.0/lib/node_modules/truffle/build/webpack:/~/web3-eth-abi/src/index.js:96:1)
    at AbiCoder.encode (/Users/marcosirisarri/.nvm/versions/node/v10.16.0/lib/node_modules/truffle/build/webpack:/~/web3-eth-abi/~/ethers/utils/abi-coder.js:897:1)
    at CoderTuple.encode (/Users/marcosirisarri/.nvm/versions/node/v10.16.0/lib/node_modules/truffle/build/webpack:/~/web3-eth-abi/~/ethers/utils/abi-coder.js:764:1)
    at pack (/Users/marcosirisarri/.nvm/versions/node/v10.16.0/lib/node_modules/truffle/build/webpack:/~/web3-eth-abi/~/ethers/utils/abi-coder.js:604:1)
    at Array.forEach (<anonymous>)
    at /Users/marcosirisarri/.nvm/versions/node/v10.16.0/lib/node_modules/truffle/build/webpack:/~/web3-eth-abi/~/ethers/utils/abi-coder.js:605:21
    at CoderAddress.encode (/Users/marcosirisarri/.nvm/versions/node/v10.16.0/lib/node_modules/truffle/build/webpack:/~/web3-eth-abi/~/ethers/utils/abi-coder.js:467:1)
    at Object.throwError (/Users/marcosirisarri/.nvm/versions/node/v10.16.0/lib/node_modules/truffle/build/webpack:/~/web3-eth-abi/~/ethers/utils/errors.js:68:1)
  reason: 'invalid address',
  code: 'INVALID_ARGUMENT',
  arg: 'newOwner',
  coderType: 'address',
  value: '0x72222d032f4D5CCc21637bcAfC64Fc79dd94Ce66' }

Truffle version: 5.0.26
Solidity compiler: ^0.5.0
Network: RSK Testnet

Let me know if you need any more info.

Thanks!
Marcos

1 Like

Hi @mirisarri welcome to the community :wave:.

The error message is invalid address

Ethereum uses Mixed-case checksum address encoding. (EIP-55)

On Ethereum you can either use an encoded version: 0x72222d032f4d5Ccc21637bCaFC64Fc79dd94cE66 (generated by pasting the address into Etherscan) or use the address unencoded (e.g. lowercase 0x72222d032f4d5ccc21637bcafc64fc79dd94ce66). Though it is safer to use the encoded version.

I don’t know if RSK uses a different encoding for address checksums, so you could try unencoded if it is an issue.

Hi @mirisarri
I wanted to check if my reply solved your issue? If it did, you can mark it as the solution.
Feel free to ask further questions.

Hi @abcoathup, yes that solved my problem. Thank you very much!

1 Like