i'm trying to call this function:

const nonce = web3.eth.getTransactionCount(myAddress) 

On the testnet of this node:

'https://ropsten.infura.io/'

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?

up vote 2 down vote accepted

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! – Ernane Luis Nov 30 '17 at 14:33

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.