2

No matter what random address I use, web3.eth.getTransactionCount always prints 1048576

web3.eth.getTransactionCount("0xb222a0f8f77dbbc3a0fc87f77717ddc59cf225d7")

1048576

Let say, I change a simple character in the address (the last character from 7 to 8)

web3.eth.getTransactionCount("0xb222a0f8f77dbbc3a0fc87f77717ddc59cf225d8")

1048576

Shouldn't it display 0? Interestingly, the number 1048576 is 0x100000 in hexadecimal.

Perhaps I'm doing something very stupidly wrong... but I can't get behind it.

5

It looks like you are on a testnet, which implements an initial nonce of 2^20 = 0x100000 = 1048576

More details here: https://github.com/ethereum/wiki/wiki/Morden#details

Initial Account Nonce (IAN) is 2^20 (instead of 0 in all previous networks).

By setting an initial nonce higher than it could possibly reach on the main Ethereum network, they prevent testnet transactions from being valid on the live network (preventing replay attacks).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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