7

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 ?

2 Answers 2

7

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.

1
  • Last question, is it reset after the message call or at the end of the transaction hash ? Commented Oct 12, 2021 at 23:18
-1

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

1
  • 7
    Incorrect. Contract addresses start with a nonce of 1 since EIP 160. Additionally the contract nonce is incremented each time it creates another contract (ref: yellow paper). Commented Oct 5, 2019 at 14:34

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.