Ethereum uses account-based model. It means that if account A has 50 ETH and sends 10 ETH to account B, transaction will look like "send 10 ETH from A to B" (no inputs and outputs as in UTXO).

With this model, at some step Ethereum should check if account A really has 10 ETH to prevent double-spending.

My question is how, where (module/code/contract), and when Ethereum verifies that?

1 Answer 1


This is probably what you're looking for,


Each account has a globally accessible nonce which prevents double spends. The nonce is the sequence number, which miners check, because a block that has a transaction with an incorrect nonce is an invalid block (other miners won't build on top of it). (The nonce does not protect against replay attacks.)

Second message (with higher nonce) can't be confirmed before the first.

See this for complementary details such as:

a global state stores a list of accounts with balances, code, and internal storage

a transaction is valid if the sending account has enough balance to pay for it, in which case the sending account is debited and the receiving account is credited with the value

See https://myetherwallet.groovehq.com/knowledge_base/topics/what-is-nonce aswell.

  • Account A has 50 ETH. It sends 30 ETH with nonce=1, and immediately after again 30 ETH with nonce=2. Miners then sort these transactions by nonce, and apply them one-by-one (at the same time they do check "if banalce(A) >= X ETH"), right?
    – warchantua
    Sep 12, 2017 at 8:55

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.