You should never use external message tracking for payment processing purposes. Check out payment processing for more details.
Introduction
The process of seeking a transaction associated with anexternal-in
message is called message lookup. It should only be used for better UX to display, for example, the progress of the operation and its result.
Message normalization
Normalization is a standardization process that converts different external-in message representations into a consistent format. This needs to be done because the structure of external-in messages allows the same message to be constructed in different forms, which results in different possible hashes for the same external message. To address this, the ecosystem defines a standard that ensures consistent hash calculation. The normalization rules are specified in detail in the TEP-467 proposal. Message lookup by its normalized hash is already implemented in most TON RPC providers. How normalization works: The normalized hash is computed by applying the following standardization rules to an external-in message:- Source Address (
src
): set toaddr_none$00
- Import Fee (
import_fee
): set to0
- InitState (
init
): set to an empty value - Body: always stored as a reference
Transaction lookup using external message from TON Connect
Retrying API calls
Sometimes API requests may fail due to rate limits or network issues. Useretry
function presented below to deal with api failures:
Find the transaction by incoming message
ThegetTransactionByInMessage
function searches the account’s transaction history for a match by normalized external message hash:
Transaction
object. Otherwise, it returns undefined
.
Example
Waiting for transaction confirmation
If you’ve just sent a message, it may take a few seconds before it appears on-chain. The functionwaitForTransaction
to poll the blockchain and wait for the corresponding transaction should be used in this case: