Skip to main content

Transaction layout

info

To maximize your comprehension of this page, familiarizing yourself with the TL-B language is highly recommended.

The TON Blockchain operates using three key parts: accounts, messages, and transactions. This page describes the structure and layout of transactions.

A transaction is an operation that processes inbound and outbound messages related to a specific account, altering its state and potentially generating fees for validators.

Transaction

transaction$0111 account_addr:bits256 lt:uint64
prev_trans_hash:bits256 prev_trans_lt:uint64 now:uint32
outmsg_cnt:uint15
orig_status:AccountStatus end_status:AccountStatus
^[ in_msg:(Maybe ^(Message Any)) out_msgs:(HashmapE 15 ^(Message Any)) ]
total_fees:CurrencyCollection state_update:^(HASH_UPDATE Account)
description:^TransactionDescr = Transaction;
FieldTypeRequiredDescription
account_addrbits256YesThe hash part of the address on which the transaction was executed. More about addresses
ltuint64YesRepresents Logical time. More about logical time
prev_trans_hashbits256YesThe hash of the previous transaction on this account.
prev_trans_ltuint64YesThe lt of the previous transaction on this account.
nowuint32YesThe now value that was set when executing this transaction. It's a Unix timestamp in seconds.
outmsg_cntuint15YesThe number of outgoing messages created while executing this transaction.
orig_statusAccountStatusYesThe status of this account before the transaction was executed.
end_statusAccountStatusYesThe status of this account after executing the transaction.
in_msg(Message Any)NoThe incoming message that triggered the execution of the transaction. Stored in a reference.
out_msgsHashmapE 15 ^(Message Any)YesThe dictionary that contains the list of outgoing messages that were created while executing this transaction.
total_feesCurrencyCollectionYesThe total amount of fees that were collected while executing this transaction. It consists of a Toncoin value and possibly some Extra-currencies.
state_updateHASH_UPDATE AccountYesThe HASH_UPDATE structure. Stored in a reference.
descriptionTransactionDescrYesA detailed description of the transaction execution process. Stored in a reference.

AccountStatus

acc_state_uninit$00 = AccountStatus;
acc_state_frozen$01 = AccountStatus;
acc_state_active$10 = AccountStatus;
acc_state_nonexist$11 = AccountStatus;
  • [00]: Account is not initialized
  • [01]: Account is frozen
  • [10]: Account is active
  • [11]: Account does not exist

HASH_UPDATE

update_hashes#72 {X:Type} old_hash:bits256 new_hash:bits256
= HASH_UPDATE X;
FieldTypeDescription
old_hashbits256The hash of the account state before executing the transaction.
new_hashbits256The hash of the account state after executing the transaction.

TransactionDescr Types

Ordinary

This is the most common type of transaction and it fulfills most developers' needs. Transactions of this type have exactly one incoming message and can create several outgoing messages.

trans_ord$0000 credit_first:Bool
storage_ph:(Maybe TrStoragePhase)
credit_ph:(Maybe TrCreditPhase)
compute_ph:TrComputePhase action:(Maybe ^TrActionPhase)
aborted:Bool bounce:(Maybe TrBouncePhase)
destroyed:Bool
= TransactionDescr;
FieldTypeRequiredDescription
credit_firstBoolYesA flag that correlates with bounce flag of an incoming message. credit_first = !bounce
storage_phTrStoragePhaseNoContains information about storage phase of a transaction execution. More Info
credit_phTrCreditPhaseNoContains information about credit phase of a transaction execution. More Info
compute_phTrComputePhaseYesContains information about compute phase of a transaction execution. More Info
actionTrActionPhaseNoContains information about action phase of a transaction execution. More Info. Stored in a reference.
abortedBoolYesIndicates whether the transaction execution was aborted.
bounceTrBouncePhaseNoContains information about bounce phase of a transaction execution. More Info
destroyedBoolYesIndicates whether the account was destroyed during the execution.

Storage

Transactions of this type can be inserted by validators at their discretion. They do not process any inbound messages and do not invoke any code. Their only effect is to collect storage payments from an account, affecting its storage statistics and balance. If the resulting Toncoin balance of the account drops below a certain amount, the account may be frozen, and its code and data replaced by their combined hash.

trans_storage$0001 storage_ph:TrStoragePhase
= TransactionDescr;
FieldTypeDescription
storage_phTrStoragePhaseContains information about storage phase of a transaction execution. More Info

Tick-tock

Tick and Tock transactions are reserved for special system smart contracts that are required to be automatically invoked in each block. Tick transactions are invoked at the beginning of each masterchain block, and Tock transactions are invoked at the end.

trans_tick_tock$001 is_tock:Bool storage_ph:TrStoragePhase
compute_ph:TrComputePhase action:(Maybe ^TrActionPhase)
aborted:Bool destroyed:Bool = TransactionDescr;
FieldTypeRequiredDescription
is_tockBoolYesA flag indicating the type of transaction. Used to separate Tick and Tock transactions
storage_phTrStoragePhaseYesContains information about storage phase of a transaction execution. More Info
compute_phTrComputePhaseYesContains information about compute phase of a transaction execution. More Info
actionTrActionPhaseNoContains information about action phase of a transaction execution. More Info. Stored in a reference.
abortedBoolYesIndicates whether the transaction execution was aborted.
destroyedBoolYesIndicates whether the account was destroyed during the execution.

Split Prepare

note

This type of transaction is currently not in use. Information about this process is limited.

Split transactions are initiated on large smart contracts that need to be divided under high load. The contract should support this transaction type and manage the splitting process to balance the load.

Split Prepare transactions are initiated when a smart contract needs to be split. The smart contract should generate the state for a new instance of itself to be deployed.

trans_split_prepare$0100 split_info:SplitMergeInfo
storage_ph:(Maybe TrStoragePhase)
compute_ph:TrComputePhase action:(Maybe ^TrActionPhase)
aborted:Bool destroyed:Bool
= TransactionDescr;
FieldTypeRequiredDescription
split_infoSplitMergeInfoYesInformation about split process.
storage_phTrStoragePhaseNoContains information about storage phase of a transaction execution. More Info
compute_phTrComputePhaseYesContains information about compute phase of a transaction execution. More Info
actionTrActionPhaseNoContains information about action phase of a transaction execution. More Info. Stored in a reference.
abortedBoolYesIndicates whether the transaction execution was aborted.
destroyedBoolYesIndicates whether the account was destroyed during the execution.

Split install

note

This type of transaction is currently not in use. Information about this process is limited.

Split Install transactions are used for creating new instances of large smart contracts. The state for the new smart contract is generated by a Split Prepare transaction.

trans_split_install$0101 split_info:SplitMergeInfo
prepare_transaction:^Transaction
installed:Bool = TransactionDescr;
FieldTypeDescription
split_infoSplitMergeInfoInformation about split process.
prepare_transactionTransactionInformation about the transaction prepared for the split operation. Stored in a reference.
installedBoolIndicates whether the transaction was installed.

Merge prepare

note

This type of transaction is currently not in use. Information about this process is limited.

Merge transactions are initiated on large smart contracts that need to recombine after being split due to high load. The contract should support this transaction type and manage the merging process to balance the load.

Merge Prepare transactions are initiated when two smart contracts need to be merged. The smart contract should generate a message for another instance of itself to facilitate the merge.

trans_merge_prepare$0110 split_info:SplitMergeInfo
storage_ph:TrStoragePhase aborted:Bool
= TransactionDescr;
FieldTypeDescription
split_infoSplitMergeInfoInformation about merge process.
storage_phTrStoragePhaseContains information about storage phase of a transaction execution. More Info
abortedBoolIndicates whether the transaction execution was aborted.

Merge install

note

This type of transaction is currently not in use. Information about this process is limited.

Merge Install transactions are used for merging instances of large smart contracts. The special message facilitating the merge is generated by a Merge Prepare transaction.

trans_merge_install$0111 split_info:SplitMergeInfo
prepare_transaction:^Transaction
storage_ph:(Maybe TrStoragePhase)
credit_ph:(Maybe TrCreditPhase)
compute_ph:TrComputePhase action:(Maybe ^TrActionPhase)
aborted:Bool destroyed:Bool
= TransactionDescr;
FieldTypeRequiredDescription
split_infoSplitMergeInfoYesInformation about merge process.
prepare_transactionTransactionYesInformation about the transaction prepared for the merge operation. Stored in a reference.
storage_phTrStoragePhaseNoContains information about storage phase of a transaction execution. More Info
credit_phTrCreditPhaseNoContains information about credit phase of a transaction execution. More Info
compute_phTrComputePhaseYesContains information about compute phase of a transaction execution. More Info
actionTrActionPhaseNoContains information about action phase of a transaction execution. More Info. Stored in a reference.
abortedBoolYesIndicates whether the transaction execution was aborted.
destroyedBoolYesIndicates whether the account was destroyed during the execution.

See also