Simple question, but I couldn’t find the answer in the yellow paper.
Is it reset to 0 or is it kept at the latest value before destruction ?
After a suicide operation, is contract’s nonce reset to 0 ?
It seems the answer is yes.
An easy way to verify such a statement is to find a suicided contract and query a node to check its nonce.
For example take this contract : https://etherscan.io/address/0x45bdac52403cf49f5e45bcb8b3ce71cf5f16ef14.
It has been destroyed at this transaction : https://etherscan.io/tx/0xffd55f831d443ac45c33fb22e1bc2c24a7de49e10c9bf2251a4e0e77b5940ed4.
We get the account nonce with web3js this way :
const nonce = await web3.eth.getTransactionCount("0x45bdac52403cf49f5e45bcb8b3ce71cf5f16ef14");
console.log("nonce : ",nonce);
It returns us 0.
Ethereum addresses with a codesize > 0 should always have a nonce of zero, as the address it sits at is created deterministically from the transaction that adds the code (creates the contract), and not from a private key. Thus the contract itself can never make transactions and its nonce can never be increased.
Nonces only increase with addresses that can make (sign) transactions