Skip to main content

Transaction layout

info

It's highly recommended that you familiarize yourself with the TL-B language to better understand this page.

The TON blockchain functions through three main components: accounts, messages, and transactions. This section outlines the structure and organization of transactions.

A transaction is an action that handles incoming and outgoing messages for a particular account, modifying 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 of the address where the transaction was executed. Learn more about addresses
ltuint64YesRepresents Logical time. Learn more about logical time
prev_trans_hashbits256YesThe hash of the previous transaction for this account.
prev_trans_ltuint64YesThe lt of the previous transaction for this account.
nowuint32YesThe now  value set during the transaction execution. It is a UNIX timestamp in seconds.
outmsg_cntuint15YesThe count of outgoing messages generated during the transaction execution.
orig_statusAccountStatusYesThe status of this account before the transaction was executed.
end_statusAccountStatusYesThe status of the account after the transaction was executed.
in_msg(Message Any)NoThe incoming message that triggered the transaction execution. Stored as a reference.
out_msgsHashmapE 15 ^(Message Any)YesA dictionary containing the outgoing messages created during the transaction execution.
total_feesCurrencyCollectionYesThe total fees collected during the transaction execution, including TON coin and potentially some extra-currencies.
state_updateHASH_UPDATE AccountYesThe HASH_UPDATE structure represents the state change. Stored as a reference.
descriptionTransactionDescrYesA detailed description of the transaction execution process. Stored as 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 uninitialized.
  • [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 represents the account state before transaction execution.
new_hashbits256The hash represents the account state following transaction execution.

TransactionDescr types

Ordinary

This is the most common transaction type, meeting most developers' requirements. Transactions of this type have a single incoming message and can generate multiple 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 related to the bounce flag of an incoming message. credit_first = !bounce.
storage_phTrStoragePhaseNoContains information about the storage phase during the transaction execution. More info
credit_phTrCreditPhaseNoContains information about the credit phase during the transaction execution. More info
compute_phTrComputePhaseYesContains information about the compute phase during the transaction execution. More info
actionTrActionPhaseNoContains information about the action phase during the transaction execution. More info. Stored in a reference.
abortedBoolYesIndicates whether the transaction execution was aborted.
bounceTrBouncePhaseNoContains information about the bounce phase during the transaction execution. More info
destroyedBoolYesIndicates whether the account was destroyed during the execution.

Storage

Validators can add transactions of this type as they see fit. They do not handle incoming messages or trigger codes. Their sole purpose is to collect storage fees from an account, impacting its storage statistics and balance. If the resulting TON coin balance of the account falls below a specified threshold, the account may be frozen, and its code and data will be replaced with their combined hash.

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

Tick-tock

Tick and Tock transactions are designated for special system smart contracts that must be automatically invoked in every block. Tick transactions are executed at the start of each MasterChain block, while Tock transactions are initiated 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 that indicates the type of transaction used to distinguish between Tick and Tock transactions.
storage_phTrStoragePhaseYesProvides information about the storage phase of the transaction execution. More info
compute_phTrComputePhaseYesProvides information about the compute phase of the transaction execution. More info
actionTrActionPhaseNoProvides information about the action phase of the transaction execution. More info. Stored as a reference.
abortedBoolYesIndicates whether the transaction execution was aborted.
destroyedBoolYesIndicates whether the account was destroyed during execution.

Split prepare

note

This type of transaction is currently not in use, and details about its implementation are limited.

Split transactions are designed for large smart contracts that must be divided due to high load. The contract must support this transaction type and manage the splitting process to distribute the load effectively.

Split prepare transactions are triggered when a smart contract needs to be split. The smart contract should generate the state necessary to create a new instance that will 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_infoSplitMergeInfoYesContains information about the split process.
storage_phTrStoragePhaseNoProvides details about the storage phase during transaction execution. More info
compute_phTrComputePhaseYesCContains details about the compute phase during transaction execution. More info
actionTrActionPhaseNoProvides information about the action phase during transaction execution. More info. Stored as a reference.
abortedBoolYesIndicates whether the transaction execution was aborted.
destroyedBoolYesIndicates whether the account was destroyed during execution.

Split install

note

This transaction type is currently unavailable, and available information is limited.

Split install transactions are used to deploy new instances of large smart contracts. A split prepare transaction generates the state for the new contract.

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

Merge prepare

note

This transaction type is currently unavailable, and available information is limited.

Merge transactions are triggered for large smart contracts that need to recombine after being split under high load. The contract must support this transaction type and handle the merging process to help balance system resources.

Merge prepare transactions are initiated when two smart contracts are set to merge. The contract should generate a message to the other instance to initiate and facilitate the merge process.

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

Merge install

note

This transaction type is currently unavailable, and available information is limited.

Merge install transactions are used to merge instances of large smart contracts. A merge prepare transaction generates a special message that facilitates the merge.

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 the merge process.
prepare_transactionTransactionYesInformation about the transaction prepared for the merge operation. Stored as a reference.
storage_phTrStoragePhaseNoContains information about the storage phase of transaction execution. More info
credit_phTrCreditPhaseNoContains information about the credit phase of transaction execution. More info
compute_phTrComputePhaseYesContains information about the compute phase of transaction execution. More info
actionTrActionPhaseNoContains information about the action phase of transaction execution. More info. Stored as a reference.
abortedBoolYesIndicates whether the transaction was aborted during execution.
destroyedBoolYesIndicates whether the account was destroyed during execution.

See also