[Ethereum] send raw transaction without knowing nonce

nonceraw-transactiontransactions

I want to send raw transactions but I don't want to accidentally overwrite any transactions.

Afaik when using eth.sendTransaction it automatically increments the nonce and doesn't overwrite any transactions (is the node keeping track of the nonce here?). Now I have a script that sends raw transactions to a node (no account listed there for security reasons, obviously).

Is there a way to automatically append transactions without knowing the nonce or accidentally overwriting transactions? Or do I have to keep track of the nonce myself?

Best Answer

The nonce is part of the transaction data, so it contributes to the transaction hash, which is what you sign with the private key.

So you need to know the nonce you want to use before signing the transaction.