8

I'm implementing a back end with different Ethereum features. I need to be able to create raw transactions. I've successfully did it using Web3 sendRawTransaction from Node.JS, but I wonder how should I calculate the first transaction Nonce when the address didn't send any. If there is a previous transaction I calculate previous + 1 (as it's established in the paper) but when there isn't previous my understanding was that I should put 1, but I see that they start on 0x100000 for some reason I don't get.

Anyone know the answer?

1 Answer 1

8

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

The reason this is used is to prevent replay attacks on the main net, where transactions on the testnet are relayed to main net nodes, causing real ether to be sent.

By setting the initial nonce higher than it could conceivably reach on the main network, we prevent testnet transactions from being valid on the live network.

To calculate the nonce, just add what you would expect the nonce to be to 0x100000

Details: https://github.com/ethereum/wiki/wiki/Morden#details

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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