Web3.js throws an error "Transaction w/ invalid nonce." when I try to call contract methods from JavaScript console. The same methods from the same contracts work fine from Mist, or, what is strange when I 'geth attach' to geth started by Mist - web3.js works with the same mehtods, but on 'pure' Mist - not. It's not a problem of Mist, I tried the same wit geth on the server without Mist.

For example:

I have a contract on https://etherscan.io/address/0x80f84866d4872f1ea412ddf10e2ed7af0b8ca8fb

Contract code: https://etherscan.io/address/0x80f84866d4872f1ea412ddf10e2ed7af0b8ca8fb#code

In JavaScript console I have a contract object ProofOfExistence (web3.eth.contract - https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethcontract ). When I try to call contact function from JavaScript console using web3.js I get an error like this:

Transaction w/ invalid nonce. tx=0  state=3) 

web3.eth.getTransactionCount(web3.eth.accounts[0]) returns 3

I tried (https://github.com/ethereum/wiki/wiki/JavaScript-API#contract-methods):



ProofOfExistence.docIndex({nonce: web3.eth.getTransactionCount(web3.eth.accounts[0])});




ProofOfExistence.docIndex.call({nonce: web3.eth.getTransactionCount(web3.eth.accounts[0])});

with the same error: Transaction w/ invalid nonce. tx=0 state=3)

How to access contract methods from web3.js to avoid this error?

1 Answer 1


This 'Transaction w/ invalid nonce' was a problem on Geth/v1.5.0-unstable/linux/go1.5.1

On Geth/v1.4.9-stable/linux/go1.5.1 works fine.

The solution:

sudo apt-get autoremove ethereum geth # Geth/v1.5.0-unstable/linux/go1.5.1
sudo add-apt-repository -r ppa:ethereum/ethereum-dev # Geth/v1.5.0-unstable/linux/go1.5.1 
sudo apt-get update && sudo apt-get install ethereum # Geth/v1.4.9-stable/linux/go1.5.1

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.