Module 6: Understanding Forwarders and How They Work?
Welcome to Module 6 Of Router Nitro CookBook. In this Module, we’ll be Understanding what are Forwarders, how do they Work, and how Router Protocol has been Implementing it. Let’s Begin…
Picture a Scenario where you need to Transfer Funds from Bank A to Bank B. In this process, Router Nitro acts as an intermediary, collecting the money from Bank A, and then its Partners, referred to as Forwarders, personally convey the Funds to Bank B. Following the Transfer, Router Nitro undertakes a Crucial Verification Step to ensure that the amount you Originally Deposited in Bank A Matches the amount that arrives at Bank B. If the Verification is Successful, Router Nitro’s Partners retrieve the funds they initially Transferred to your Bank B, Effectively Completing the Transaction.
Router Nitro has three Flows with which it enables this Swapping -
In the Forwarder flow, first of all, a user invokes the Nitro Contract to Transfer Funds from Chain A (Source) to Chain B (Destination). The Source Chain Nitro Contract will Validate the Request, Deduct Funds from the User’s Account, Increment Event Nonce and emit a FundsDeposited event. Whenever a FundsDeposited event is emitted from a Nitro Contract, Orchestrators listen to this event and Submit the event to the Router Chain along with their Attestation. Parallely, the Forwarders also listen to the FundsDeposited event.
After 2/3+1 Validation, the Router Chain will invoke the Middleware Nitro Contract with the event info, and after this, the Middleware Contract will Persist with the Request! While the event was being Processed on the Router Chain (Attestation, Validator, Submission on the Middleware Contract), in parallel, the Forwarder also listens to the FundsDeposited event and invokes the Nitro Contract on the Destination Chain.
Upon Receiving the Transaction, the Nitro Contract on the Destination Chain will (a) Transfer the Defined amount from the Forwarder Address to the Receiver Address, (b) Create a Hash of the Fields included in the Request and Persist it in the Status Map (to skip the replays), and © emit a FundsPaid event Confirming the Execution. Orchestrators on the Router Chain listen to the FundsPaid event from the Destination Chain Nitro Contract and Submit it to the Router Chain with their Attestation. Upon Receiving the FundsPaid event, the Middleware Contract Verifies that the Message generated from the Request Data is the same as the Message Hash from the Executed event, marks the Request as Completed and Persists the Forwarder Address and Amount.
So, just like that, Router Nitro Bridges your Assets from Chain A to Chain B Efficiently, Securely, and with Minimal Cost using the Reverse Verification Flow!
In conclusion, Module 6 of Router Nitro CookBook provided an in-depth Understanding of Forwarders and how they function within the Router Protocol Ecosystem. By Leveraging Forwarders, Router Nitro facilitates cross-chain Asset Transfers Efficiently and Securely. The Module outlined three key flows utilized by Router Nitro, namely the Forwarder Flow, Burn and Mint Flow, and the USDC Circle Flow, each Catering to specific Token Transfer Scenarios.
Moreover, the Module introduced essential terms such as Orchestrators, Middleware contracts, IBC, and Gateway Contracts to better Comprehend the intricacies of the Forwarder Flow. It elucidated the step-by-step process involved in Transferring Funds from one Chain to another, highlighting the Crucial Roles played by Orchestrators and Forwarders in ensuring Transaction Validity and Execution.
Through a Detailed Examination of the Forwarder Flow implementation, Module 6 illustrated how Router Nitro Bridges assets Seamlessly Across different Chains while Maintaining Security and Minimizing Costs. By employing a Reverse Verification Flow, Router Nitro Completes Asset Transfers with Accuracy and Reliability, thus Offering users a Robust Solution for Interoperability in the Blockchain Space.
Play Nitro Quiz and earn Rewards.
Share your learnings on Twitter. Click here