Account-based model

Apr 28, 2024 1:13:57 AM

The account model is currently more widely used than the UTXO-based model. In this, all accounts are registered on the blockchain, what means that they are recorded in the database. The type of information that is recorded depends on the network protocol, but in general, the account’s native token balance is stored, and a script is executed. Usually, accounts are classified into user accounts and contract accounts.

One of the most significant advantages of the accounts model is that the balance of an account can be quickly retrieved by querying the database. Tracking all unspent transactions from an account is no longer necessary. However, this model also has disadvantages. One downside is keeping track of all accounts that have ever interacted with the blockchain, even if they are no longer used. This causes the disk space that store the state of the blockchain to grow indefinitely.

Blockchains that use the account model need a mechanism to track the number of transactions that each account has already made. As mentioned, a nonce can be used for this. The protocol does not accept two transactions with the same nonce, thus preventing the same signature from being reused.

Neo used to have a model based on UTXO, but with the arrival of Neo 3, the most recent version of the protocol, the UTXO model has been replaced by the accounts one. Ethereum also uses an account-based model. Such accounts are identified by an address generated from the account’s public key. This state is an extensive key-value database, where the key is the account address. When a user receives tokens for the first time, their balance is recorded in the database, and we can consider that the account is registered on the network.