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 GitHub Repository

  1. Open Remix IDE. The File explorer tab will open.

  2. Go to the Git tab.

    The “Git” tab
  3. On the Git tab, expand the GITHUB SETUP block.

    The “GITHUB SETUP” block in the “GitHub” tab
  4. In the GITHUB SETUP block:

    1. Click Login with GitHub. The instructions on how to connect your GitHub account will appear.

      The “Login with GitHub” button
    2. Follow the given instructions.

  5. On the Git tab, expand the CLONE block.

    The “CLONE” block
  6. In the CLONE block:

    1. Click Load from GitHub. The field with your GitHub account's repositories will open.

      The “Load from GitHub” button
    2. From the field with your account's repositories, select the relevant repository.

    3. From the field with the repository's branches, select the relevant branch.

    4. Click clone USERNAME_REPOSITORY:BRANCH. The dApp script will be available on the File explorer tab.

      The specified repository parameters

Create New Script

  1. Open Remix IDE. The File explorer tab will open.

  2. On the File explorer tab, click Create new file. The field to enter the filename will open.

    The “Create new file” button
  3. In the field, enter the filename. The FILENAME.sol window will open.

    The entered dApp filename
  4. 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

  1. In Remix IDE, go to the Solidity compiler tab.

    The “Solidity compiler” tab
  2. On the Solidity compiler tab, click Compile FILENAME.sol.

    The “Compile FILENAME.sol” button

Step 4: Deploy dApp

  1. In Remix IDE, go to the Deploy & run transactions tab.

    The “Deploy & run transactions” tab
  2. On the Deploy & run transactions tab:

    1. From the Environment drop-down list, select the Injected Provider - MetaMask. The MetaMask extension will open.

      The “Injected Provider - MetaMask” option
  3. In the MetaMask extension, click Connect.

    The “Connect” button in the MetaMask extension
  4. On the Deploy & run transactions tab, click Deploy. The MetaMask extension will open.

    The “Deploy” button
  5. 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
  6. 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.

  1. 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
  2. On the dApp details page, go to the Contract tab.

    The “Contract” tab
  3. Click Read/Write contract. The Contract information block will display the dApp's methods.

    The “Read/Write contract” button
  4. In the Contract information block:

    1. 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
    2. In the method's fields, enter the value in the relevant Solidity Data Type.

    3. Click the button with the relevant call type:

      • Read.

      • Or Write.

      The “Contract information” block with the field data entered and “Write” button
  5. 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