Rayls Docs

Message Design Patterns

TypeMessage PatternDescription
Arbitrary MessageOWM➡️ One way message Pattern [A->B]
Arbitrary MessageBFM🔄 Back-and-forth message Pattern [A->B->A]
Arbitrary MessageLMP🔃 Layering message Pattern [A->B->BA->BB]
TELEPORTVT20
TELEPORTAT20

OWM

➡️

One way message Pattern [A->B]

Sender targets any contract on receiver

Sender needs to know the smart contract address on the destination network.


BFM

🔄

Back-and-forth message Pattern [A->B->A]

Sender targets any contract on receiver, receiver replies the sender....

The back-and-forth message pattern builds on this straightforward approach by placing another _raylsSend call inside the _receiver function of the destination contract. Imagine it like a ping-pong game, where a call is sent to a destination chain and then bounced back to the original source, creating a back-and-forth flow (A -> B -> A).


LMP

🔃

Layering message Pattern [A->B->BA->BB]

Sender targets a specific contract on receiver, receiver calls another contract and reply the sender....

This approach showcases the concept of horizontal layering, setting it apart from vertical layering by wrapping the external call in a new message format. This structure allows the application to keep certain response actions distinct from the external call.

With each layering call wrapped as its own message bundle through a specialized process, this approach is scalable to multiple sequential operations as needed by your application (e.g., B1 -> B2 -> B3, and so on).

This method proves to be highly effective for managing intricate transactions and operations on the target chain, requiring separate stages of contract logic, such as:

Multi-Chain Finance Operations: A smart contract could initiate a token move on the target chain and then proceed to interact with a decentralized finance (DeFi) protocol for lending, borrowing, liquidity provision, staking, etc., performing a variety of financial maneuvers across multiple chains.

Cross-Chain NFT Engagements: An NFT transferred to a different chain could prompt a contract to bestow a license, record a domain, or start a subscription service that reflects the NFT's ownership.

Inter-Chain DAO Actions: A DAO might transfer funds to a contract on another chain and send a structured message to carry out particular investments or fund initiatives agreed upon by the DAO, supporting community-driven projects or public initiatives.