What is the account model?
- Author
- CRYPTO PORT Editorial
- Published
- Updated
- Reading time
- 5 min
In short
In the account model each address stores a balance, and a transfer simply decreases one number and increases another. Ethereum works this way, and it is what lets smart contracts hold persistent state. The key difference from UTXO chains is that a balance genuinely exists as stored data.
Key points
- Each address stores a balance and a nonce
- A transfer is a subtraction on one side and an addition on the other
- Contract accounts additionally hold code and storage
- The nonce distinguishes identical transfers and blocks replays
Definition
A design in which chain state is held as per-address balances that transactions update. Ethereum and most smart-contract chains use it.
Ethereum has two kinds of account: externally owned accounts controlled by a private key, and contract accounts that hold code. Both carry a balance and a nonce; contract accounts additionally hold bytecode and persistent storage. The chain's state is the set of all of them.
A transfer is expressed as a state update — subtract from A, add to B. There is no change output to construct, and any contract can read a current balance directly, which makes lending, automated trading and similar logic far easier to write than under UTXO.
Sending the same amount to the same address twice produces nearly identical transaction data, so something must distinguish the two. That is the per-account nonce, incremented on every send, which also means a third party cannot replay your signed transaction a second time.
Watch out for
- · Because state is shared and directly readable, a contract bug can corrupt it broadly
- · Fees are charged on computation used (gas), which is a different model from UTXO byte-size fees
- · The same address may exist on several chains, but each balance is separate and does not move between them