High Level Architecture
Step 1) Once a user initiates a cross-chain action on an application on the source chain, the application smart contract calls a specific function on the Router Gateway contract (iSend
in case of EVM chains, i_send
in case of NEAR).
Step 2) The Gateway contract on the source chain emits an event that is listened to by the orchestrators on the Router chain.
Step 3) Once the event is validated, the Router chain will deduct the fee from the designated feePayer
address for that dApp on the Router chain. The feePayer
address can be set by the dApp while linking it with CrossTalk. A dApp's feePayer
is responsible for paying the fees for all the cross-chain requests generated by that dApp.
Step 4) Relayers pick up the transaction signed by the orchestrator and forward the message to the destination chain's Router Gateway contract.
Step 5) The Gateway contract on the destination chain calls a specific function on the application contract (iReceive
in case of EVM chains, i_receive
in case of NEAR).
Step 6) Based on the data transferred, the application contract on the destination chain will execute the relevant actions.
Step 7) After the function execution is complete on the destination chain, the destination chain’s Gateway contract emits an acknowledgment event that is listened to by the orchestrators on the Router chain.
Step 8) Once the ack event is validated, it is processed on the Router chain, i.e., the cross-chain request corresponding to the ack is marked as completed and excess fee is paid back to the feePayer
.
Step 9) If the dApp opted to receive the ack back on the source chain, it is sent to the source chain's Gateway contract by the relayers. If not, it is discarded.
Step 10) The Gateway contract on the source chain sends the ack to the application's source chain contract.