arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

Qubetics IDE User Guide

How to Deploy Contract on Qubetics IDE

hashtag
Introduction

This guide provides step-by-step instructions to deploy any smart contract on the Qubetics blockchain. You’ll learn how to set up your development environment, write and compile the contract, and deploy it using the Qubetics IDE.

hashtag
Prerequisites

Before you start, ensure you have:

  • Basic knowledge of Solidity and smart contracts.

  • An EVM-compatible wallet such as MetaMask with the Qubetics blockchain network.

Link:

hashtag
Steps to add Qubetics Network to Metamask Wallet

  1. Open Metamask: Launch the Metamask extension

  1. Access Network Settings:

  • Click on the Network Selector dropdown at the top of the MetaMask interface (usually showing "Ethereum Mainnet" by default).

  • Select "Add Network" or "Add a Network Manually".

  1. Add a Custom RPC Network: In the "Add a network" screen, click "Add a network manually" to input the custom details.

  2. Fill in Network Details Enter the required blockchain network information:

Properties
Network Details- Mainnet
Network Details- Testnet

hashtag
Part 1: Connecting to the Qubetics Network

To add the Qubetics network in MetaMask, there are 2 options:

Method 1: To add the network with a single click Connect MetaMask to Qubetics Network

  • Open the Qubetics Explorer.

  • Click on "Add Qubetics Network" to automatically connect your wallet to the Qubetics blockchain.

Method 2: Manually Adding Network Alternatively, if you want to add the network manually, ensure your MetaMask is upgraded to version 12.9.2 or higher. Enter the following details in MetaMask:

Properties
Network Details- Mainnet
Network Details- Testnet
  • Confirm Connection: Once the network is added, your MetaMask wallet will connect to the Qubetics blockchain. Ensure you can see your wallet address and balance.

hashtag
Part 2: Deploying Contracts Using Qubetics IDE

  1. Open Qubetics IDE

  • Visit Qubetics IDE, link:

  • To open the File Explorer module, click on the Workspace option in the left-side menu. The File Explorer helps you manage your workspaces and files easily.

  • You can also right-click on any file or folder to see a menu with quick options for different actions.

  1. Create a New File

  • In the Qubetics IDE dashboard, click on "New File" and name it MyContract.sol.

  • Write or paste your Solidity smart contract code into the editor.

hashtag
Code for ERC-20:

// contracts/GLDToken.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract GLDToken is ERC20 {

constructor(uint256 initialSupply) ERC20("Gold", "GLD") {

_mint(msg.sender, initialSupply);

}

}

hashtag
Code for ERC-721:

// contracts/GameItem.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";

import "@openzeppelin/contracts/utils/Counters.sol";

contract GameItem is ERC721URIStorage {

using Counters for Counters.Counter;

Counters.Counter private _tokenIds;

constructor() ERC721("GameItem", "ITM") {}

function awardItem(address player, string memory tokenURI)

public

returns (uint256)

{

uint256 newItemId = _tokenIds.current();

_mint(player, newItemId);

_setTokenURI(newItemId, tokenURI);

_tokenIds.increment();

return newItemId;

}

}

hashtag
Code for ERC-1155:

// contracts/GameItems.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";

contract GameItems is ERC1155 {

uint256 public constant GOLD = 0;

uint256 public constant SILVER = 1;

uint256 public constant THORS_HAMMER = 2;

uint256 public constant SWORD = 3;

uint256 public constant SHIELD = 4;

constructor() ERC1155("https://game.example/api/item/{id}.json") {

_mint(msg.sender, GOLD, 10**18, "");

_mint(msg.sender, SILVER, 10**27, "");

_mint(msg.sender, THORS_HAMMER, 1, "");

_mint(msg.sender, SWORD, 10**9, "");

_mint(msg.sender, SHIELD, 10**9, "");

}

}

  1. Set the Compiler Version

  • Navigate to the "Solidity Compiler" tab on the left sidebar.

  • Choose the compiler version matching the pragma solidity version in your contract, e.g., 0.8.26+commit.8a97fa7a.

  • Expand the "Advanced Configurations" dropdown and set the following:

  1. Compile the Contract Click "Compile MyContract.sol" to ensure there are no syntax or configuration errors.

  2. Set Up for Deployment

  • Go to the "Deploy & Run Transactions" tab.

  • Under "Environment", select "Injected Provider - MetaMask" to connect your wallet.

  • Ensure your MetaMask wallet is connected to the Qubetics Network and displays the account address and available balance.

  1. Deploy the Contract

  • For an ERC-72/ERC-1155 contracts, click "Deploy" directly.

  • For an ERC-20 contract, input the wallet address in the field next to the Deploy button. This address will also act as the contract owner.

  • Click "Deploy" and confirm the transaction in MetaMask.

hashtag
Verifying the Contract on TICS Scan

Navigate to the Verification Section

  • Open the TICS Scan.

  • Select "Contract List" from the navbar.

  • Locate and click on the deployed contract address to open its details page. “0x386559f6a6C00E99ff18733416B297cA6e9EAb38”

hashtag
Step 1: Enter Contract Details

  • The contract address will be pre-filled.

  • Complete the following fields:

    • Compiler Type: Select "Solidity - Single File".

hashtag
Step 2: Upload Contract Source Code

  • Convert your MyContract.sol file into a flattened version:

    • Right-click on MyContract.sol and select "Flatten" to generate a file named MyContract_flattened.sol.

  • Copy the flattened code and paste it into the "Upload Contract Source Code" field.

Miscellaneous Settings

  • Expand "Misc Settings (Runs, EVM Version Settings)" and set:

    • EVM Version: London

  • Click "Done" and Submit.

Review Verification Status

  • Return to the "Contract List" on the Explorer and select the verified contract address.

  • The verification status will display one of the following:

    • Verified: The contract is successfully verified.

hashtag
Troubleshooting Verification Errors

If the verification fails, review the error message, correct the indicated issue (e.g., mismatch in the compiler version), and repeat the process.

Congratulations! Your contract is now deployed and verified on the Qubetics chain and ready for use.

Explorer URL

https://ticsscan.com

https://testnet.qubetics.work

Explorer URL

https://ticsscan.com

https://testnet.qubetics.work

Language: Solidity

  • EVM Version: London

  • Once deployed, the contract address will appear in the Qubetics IDE terminal.

    Click the "Verify & Publish" button to proceed.

    Compiler Version: Choose the version used during deployment (e.g., 0.8.26+commit.8a97fa7a).

  • License Type: Choose the open-source license type (e.g., "MIT").

  • Agree to the Terms of Service and click "Next".

  • A prompt will confirm that the verification has been initialized.

  • Partially Verified: The contract is partially verified.

  • Rejected Verification: The verification failed (e.g., ByteCode mismatch).

  • Network Name

    Qubetics Mainnet

    Qubetics Testnet

    New RPC Url

    https://rpc.qubetics.com

    https://rpc-testnet.qubetics.work

    Chain ID

    9030

    9029

    Currency Symbol

    TICS

    Network Name

    Qubetics Mainnet

    Qubetics Testnet

    New RPC Url

    https://rpc.qubetics.com

    https://rpc-testnet.qubeticswork

    Chain ID

    9030

    9029

    Currency Symbol

    TICS

    https://ide.qubetics.com/arrow-up-right
    https://qubeqode.qubetics.comarrow-up-right

    TICS

    TICS