i'm trying to call this function:

const nonce = web3.eth.getTransactionCount(myAddress) 

On the testnet of this node:


But I get this error on this node:

cannot unmarshal non-string into Go value of type common.Address

at Object.InvalidResponse (.../node_modules/web3/lib/web3/errors.js:35:16)

at RequestManager.send (../node_modules/web3/lib/web3/requestmanager.js:61:22)

at Eth.send [as getTransactionCount] 

Any ideas why this is happening?

1 Answer 1


Check your variable myAddress. It has to be represented as a hex string, even though it is actually a number. A hex string is a string, starting with 0x. So your definition of myAddress should be something like

const myAddress= "0x....";
  • damm you are correct, so silly of me. thanks a lot! Commented Nov 30, 2017 at 14:33
  • thanks, my mistake was I passed an array instead of a string
    – JP Lew
    Commented Jul 2, 2021 at 5:37

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.