跳到主要内容

Accounts

Actor model and accounts

In TON, an account is an actor - an isolated computational entity that communicates exclusively through message passing. This design follows the actor model of concurrent computation, which is based on:

  • Actor isolation - accounts cannot access each other’s internal state.
  • Asynchronous communication - interactions happen through messages that may be delivered and processed at different times.
  • Universality - any computational abstraction can be implemented as an actor.

Components

Each account consists of:

  • Account properties — basic information such as the account’s ID, balance, status, and its last transaction. These properties let users track their funds and activity.
  • Data — user-defined storage, holding variables or contract-specific information. This is where an account keeps its custom data.
  • Code — the logic that determines how the account reacts to incoming messages and generates outgoing ones. This defines the account’s behavior on the blockchain.
备注

Accounts that include both code and data, in addition to their properties, are considered smart contracts on the blockchain.

Data layout

TON accounts store information in a structured format to ensure accurate tracking of balances, states, and transactions. Each account contains several key elements:

  • Address or MsgAddressInt - the unique identifier of the account.
  • Balance or CurrencyCollection - the amount of Toncoin held by the account.
  • State or AccountState - defines the account’s behavior, including its code and data.
  • Logical time of the last transaction or last_trans_lt - tracks the sequence of updates to the account.
  • Storage statistics or StorageInfo - information about how much space the account uses on-chain.

These structures are formally defined using TL-B schemas, which describe how account data is represented at the bit level. A simplified TL-B example of an account looks like:

account_none$0 = Account;
account$1 addr:MsgAddressInt storage_stat:StorageInfo
storage:AccountStorage = Account;

Account status

Every account in TON has a state that reflects its readiness and activity on the blockchain:

StatusDescription
Uninitialized (uninit)The account exists but has no code or data yet. It may hold a balance but cannot process messages.
Frozen (frozen)The account’s code and data are removed, but a hash of the previous state is kept. It cannot be used, but it can potentially be restored.
Active (active)The account has deployed code and data (StateInit). It is a fully initialized smart contract, ready to process incoming messages.
account_uninit$00 = AccountState;
account_active$1 _:StateInit = AccountState;
account_frozen$01 state_hash:bits256 = AccountState;

See also

Was this article useful?