Cross-chain messaging is the backbone of TAC, enabling secure communication between TON and EVM chains. This system ensures reliable message delivery, asset security, and proper transaction execution across different blockchains.

Message Structure

Every cross-chain message in TAC contains essential information needed for cross-chain operations. The message includes a timestamp from the TON blockchain, target contract address, method name, and arguments. It also tracks token amounts for minting and unlocking operations, ensuring accurate asset transfer across chains.

Message {
   uint32 timestamp;        // Transaction timestamp from TON blockchain
   address target;          // Target smart contract address
   string methodName;       // Method to call on target contract
   bytes arguments;         // Method arguments
   string caller;          // Original caller's address
   TokenAmount mint;       // Tokens locked on TON
   TokenAmount unlock;     // Tokens burned on TON
}

Understanding Message Flow

1

Message Creation

The process begins when a user interacts with a TAC proxy. Their action triggers the creation of a cross-chain message containing all necessary transaction details, including asset information and the intended EVM operation. This message serves as the instruction set for the entire cross-chain operation.

2

Sequencer Processing

Sequencers take over once a message is created. They store these messages in their local databases and perform comprehensive validation. This includes verifying that all asset transfers match the message parameters exactly, ensuring the integrity of the cross-chain operation.

3

Tree Formation

At regular intervals determined by DAO settings, sequencers compile all validated messages into Merkle trees. The root hash of these trees becomes the foundation for network-wide consensus, creating a verifiable record of all cross-chain communications.

4

Message Execution

Once validated through consensus, messages move to execution on the target chain. This final stage includes all necessary asset operations like minting or unlocking tokens, followed by the actual method calls on target contracts.

Message Timing and Epochs

TAC organizes message processing into epochs, providing a structured approach to cross-chain communication. Each epoch is calculated using:

EpochId = (now - protocolDeployDate) / epochDuration

Messages are processed within specific timespans, ensuring orderly handling of cross-chain operations:

[protocolDeployDate + EpochId * epochDuration, 
protocolDeployDate + (EpochId + 1) * epochDuration]

Validation and Security

The CrossChainLayer smart contract serves as the guardian of message integrity. For each message, it performs comprehensive verification by hashing message data, checking execution status, and validating Merkle proofs. This process ensures that only legitimate, consensus-approved messages are executed.

When handling assets, the system maintains strict validation protocols. Every asset transfer mentioned in a message must correspond to actual movements of tokens, with exact matching of amounts and proper locking in bridge contracts.

Handling Message Failures

TAC’s error handling system ensures user assets remain secure even when transactions fail. If a transaction cannot complete, the system automatically returns locked assets to the sender and prevents the message from forwarding to the other chain. A specialized rollback process handles these cases, collecting failed transactions into new Merkle trees for proper resolution.

Cross-Chain Layer Implementation

The cross-chain messaging system comes to life through the CrossChainLayer.receiveMessage() method. This crucial component verifies message uniqueness, validates proofs, and manages asset operations before calling target contract methods. During execution, it handles token minting or unlocking, executes the intended contract calls, and manages any return messages needed.

Common Scenarios

1

Token Transfers

When users transfer tokens between chains, the process begins on TON with asset locking in the bridge. The cross-chain message travels through the sequencer network, resulting in equivalent token minting on the EVM side.

2

Contract Interactions

For EVM contract interactions, users start with the TON proxy. Their request becomes a cross-chain message that sequencers validate and process. The EVM proxy then executes the contract call, with results flowing back to TON.