Deploying a Contract Using Remix-IDE

Remix Project is a development tool that provides developers with the necessary technologies and features for the entire smart contract development process. It also serves as an educational platform for learning and experimenting with Ethereum.

When deploying a contract on any blockchain, the native token of that chain must be used to pay for deployment gas fees. This applies to dKargo Chain as well. Before deploying on the dKargo testnet (Warehouse), developers can obtain $DKA testnet tokens via the faucet. Remix interacts with the blockchain using the wallet registered in MetaMask.

STEP 1 - Getting Started with Remix

  1. Access Remix and navigate to File Explorer, then click ≡ (menu icon). Select [ + Create Blank ] to create a new Workspace.

  2. Create a new file named counter.sol and enter the contract code or use the provided sample code.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
 
contract Counter {
    uint256 public number;
 
    function setNumber(uint256 newNumber) public {
        number = newNumber;
    }
 
    function increment() public {
        number++;
    }
}
  1. Go to the [ Solidity Compile ] sidebar option and select counter.sol to compile the contract.

STEP 2 - Deploying the Contract

  1. Navigate to the [ Deploy & Run Transactions ] sidebar option.

  2. Change the ENVIRONMENT dropdown to "Injected Provider - MetaMask".

  3. In MetaMask, click [ Connect ] to grant Remix access.

  1. Once MetaMask is connected, click the [ Deploy ] button to deploy the contract.

  1. The deployed contract can be verified in the Verified Contracts section of dScanner.

STEP 3 - Interacting with the Contract

  1. After deploying the contract, interaction is available in the bottom-left tab of Remix.

  1. Click [ number ] to retrieve the stored number in the contract. The default value after deployment is 0.

  1. Click [ increment ] to send a transaction that increases the number by +1. Confirm the transaction in MetaMask, which will then be sent to the dKargo Chain.

  1. Click [ number ] again to verify that the stored number has increased by 1.

Last updated