1

Hey I'm looking for a simple way to verify that a certain address has executed x number of transactions?

I noticed that this can be accomplished by having them deploy some contract and verifying that the resulting contract address matches x nonce, but I'd like to accomplish this without the address signing anything.

2
  • Why do you need to check the nonce from within a contract? This seems like an XY problem Commented Mar 15, 2019 at 0:25
  • It wasn't just an answer to the larger problem I was looking for, but an answer to this particular problem. Commented Mar 15, 2019 at 7:17

1 Answer 1

1

The nonce of an account is not directly accessible through the EVM. In general, the state of arbitrary accounts is not accessible within the EVM.

One (costly and cumbersome) way to prove that an account has a nonce of X at some past block is to give a merkle proof of the account state at that block. Since the nonce is part of the account state you will need to give several (patricia) merkle proofs, one to prove that the nonce is correct for some account state hash, then one to show that that account state is in some state tree, then finally one to show that the root is correct for some block hash.

This will be somewhat difficult to implement and quite costly. Also, it will not detect changes in account nonce during the same block that the transaction is executed.

On the whole, I do not see any good reason why a contract would need to know the nonce of an account. I think you need to conider why you need this information and whether tracking a separate nonce inside your contract would be a better solution.

5
  • It's for a type of sybil resistance, assuming that to increase a nonce to a certain level you incur a certain cost. Commented Mar 15, 2019 at 7:15
  • That could be much more easily solved by just burning ETH, no? Nonce increase in particular is free for miners. Commented Mar 15, 2019 at 13:58
  • Interesting. How can the miners increase an account nonce for free? I'm guessing it costs a lot of mining power. Commented Mar 18, 2019 at 14:40
  • A miner can include transactions in any block that they mine for free, so they could put 100 useless transactions in a block and increase their nonce by 100 for free Commented Mar 18, 2019 at 17:20
  • I wouldn't exactly call that free. Commented Mar 20, 2019 at 9:12

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.