Message Passing
Overview
Message Structure
Basic Message Format
struct CrossChainMessage {
bytes32 messageId; // Unique message identifier
string sourceChain; // Source blockchain name
string destinationChain; // Target blockchain name
address sourceAddress; // Sender contract address
string destinationAddress; // Target contract address
bytes payload; // Function call data
uint256 gasLimit; // Gas limit for execution
uint256 timestamp; // Message creation time
bytes32 payloadHash; // Hash of the payload
}Message Types
Message Lifecycle
Implementation
Sending Messages
Example Usage
Receiving Messages
Example Implementation
Security Considerations
Message Validation
Access Control
Anti-Replay Mechanisms
Gas Management
Gas Estimation
Gas Payment Models
1. Prepaid Gas
2. Token-Based Gas Payment
Error Handling
Execution Failures
Retry Mechanisms
Advanced Features
Conditional Execution
Batch Message Processing
Message Scheduling
Best Practices
For Senders
For Receivers
General Guidelines
Integration Examples
Simple Cross-Chain Counter
Cross-Chain Token Vault
Resources
Last updated