Mainnet Deployment
NOTE: Ensure you meet the prerequisites before deploying a dApp.
Deploy your dApp by following the steps:
Step 1: Connect Wallet
Follow the steps to connect your Metamask wallet.
Step 2: Create Script
You can:
Import your GitHub repository with your dApp.
Import GitHub Repository
Open Remix IDE. The File explorer tab will open.
Go to the Git tab.
The “Git” tab On the Git tab, expand the GITHUB SETUP block.
The “GITHUB SETUP” block in the “GitHub” tab In the GITHUB SETUP block:
Click Login with GitHub. The instructions on how to connect your GitHub account will appear.
The “Login with GitHub” button Follow the given instructions.
On the Git tab, expand the CLONE block.
The “CLONE” block In the CLONE block:
Click Load from GitHub. The field with your GitHub account's repositories will open.
The “Load from GitHub” button From the field with your account's repositories, select the relevant repository.
From the field with the repository's branches, select the relevant branch.
Click clone USERNAME_REPOSITORY:BRANCH. The dApp script will be available on the File explorer tab.
The specified repository parameters
Create New Script
Open Remix IDE. The File explorer tab will open.
On the File explorer tab, click Create new file. The field to enter the filename will open.
The “Create new file” button In the field, enter the filename. The FILENAME.sol window will open.
The entered dApp filename Copy and paste the script to the FILENAME.sol window:
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract MessageLogger { // Variable that stores the message. string private currentMessage; // Method that updates the message. function updateMessage(string calldata newMessage) external { currentMessage = newMessage; } // Method that retrieves the current message. function fetchMessage() external view returns (string memory) { return currentMessage; } }
The entered dApp script
Step 3: Compile Script
In Remix IDE, go to the Solidity compiler tab.
The “Solidity compiler” tab On the Solidity compiler tab, click Compile FILENAME.sol.
The “Compile FILENAME.sol” button
Step 4: Deploy dApp
In Remix IDE, go to the Deploy & run transactions tab.
The “Deploy & run transactions” tab On the Deploy & run transactions tab:
From the Environment drop-down list, select the Injected Provider - MetaMask. The MetaMask extension will open.
The “Injected Provider - MetaMask” option
In the MetaMask extension, click Connect.
The “Connect” button in the MetaMask extension On the Deploy & run transactions tab, click Deploy. The MetaMask extension will open.
The “Deploy” button In the MetaMask extension, click Confirm. The Deployed Contracts block will display the address of the deployed dApp.
The “Confirm” button in the MetaMask extension Optional. In the Deployed Contracts block, click Copy Address.
NOTE: This step is mandatory to test the dApp.
The “Copy Address” button
Step 5 (Optional): Test dApp
NOTE: Ensure copying the dApp address after its deployment.
Go to the Unit Zero Mainnet Explorer.
Paste the dApp address into the searchbar and click Enter on your keyboard. The page with the dApp details will open.
The Mainnet Explorer searchbar with the dApp address entered On the dApp details page, go to the Contract tab.
The “Contract” tab Click Read/Write contract. The Contract information block will display the dApp's methods.
The “Read/Write contract” button In the Contract information block:
Click the arrow icon next to the method you want to invoke. The method's fields will be displayed.
The arrow icon next to the dApp's method In the method's fields, enter the value in the relevant Solidity Data Type.
Click the button with the relevant call type:
Read.
Or Write.
The “Contract information” block with the field data entered and “Write” button
In the MetaMask wallet, click Confirm. The Unit Zero Mainnet Explorer interface will return the result of the invoked method.
The “Confirm” button
Last updated