Module 7 - Deploying Smart Contract on Router Chain
Router Rust Optimizer
After Building your Smart Contract it is essential to Deploy them. Deployment is done via the .wasm
file you get in the target
Directory. There are Two ways of Deploying the Contract -
- Router Station
routerd
CLI
Before We Upload .wasm
file to Chain, we need to ensure the Smallest Output Size Possible, as this will be included in the Body of a Transaction. We also want to have a Reproducible Build Process, so third Parties can Verify that the Uploaded Wasm Code did indeed come from the Claimed Rust Code.
To Solve Both these issues, we have Produced rust-optimizer
, a Docker Image to Produce an extremely Small Build Output in a Consistent Manner. The Suggest way to Run it is this -
- Windows
- macOS
Or, if you’re on an arm64 machine (M1/M2 Macs), you should use a Docker Image Built with arm64.
Deployment via Router Station
On Router Station, you can Directly Upload the .wasm
file of your Project and Deploy the Contract. Follow the Below Steps -
-
Keep the Funds field blank.
-
Add a Label to your Contract.
-
In the Instantiate Message enter the Value which is present in Brackets of the
pub struct InstantiateMsg {}
ofmsg.rs
file in your Project.
Now, Click on Upload and Instantiate Button to Deploy the Contract. After doing this, you’ll be able to Query & Execute the Smart Contract on Router Chain.
To view your Transaction on Routescan, Copy the transactionHash
and paste it here.