Qubetics IDE User Guide
How to Deploy Contract on Qubetics IDE
Last updated
How to Deploy Contract on Qubetics IDE
Last updated
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.
Before you start, ensure you have:
Basic knowledge of Solidity and smart contracts.
A EVM-compatible wallet such as metamask with Quebtics blockchain network.
Open Metamask: Launch the Metamask extension
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".
Add a Custom RPC Network: In the "Add a network" screen, click "Add a network manually" to input the custom details.
Fill in Network Details Enter the required blockchain network information:
Network Name: Qubetics Testnet or Qubetics Privnet.
RPC URL: The endpoint URL for the blockchain for Devnet: “https://alphatestnet-evm-rpc.qubetics.work“
Chain ID: The unique ID for the Qubetics blockchain (9003).
Currency Symbol: The native token symbol (TICS).
Tools: Qubetics IDE.
To add Qubetics network in the metamask, there are 2 options:
k Connect MetaMask to Qubetics Network
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:
Network Name: Qubetics Testnet
Default RPC URL: https://alphatestnet-evm-rpc.qubetics.work
Chain ID: 9003
Currency Symbol: TICS
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.
Open Qubetics IDE
Visit Qubetics IDE IDE, link: https://qubetics-ide.qubetics.work
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.
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.
// 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);
}
}
// 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;
}
}
// 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, "");
}
}
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:
Language: Solidity
Compile the Contract Click "Compile MyContract.sol" to ensure there are no syntax or configuration errors.
Set Up for Deployment
Go to the "Deploy & Run Transactions" tab.
Under "Environment", select "Injected Provider - MetaMask" to connect your wallet.
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.
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”
Click the "Verify & Publish" button to proceed.
The contract address will be pre-filled.
Complete the following fields:
Compiler Type: Select "Solidity - Single File".
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".
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.
A prompt will confirm that the verification has been initialized.
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.
Partially Verified: The contract is partially verified.
Rejected Verification: The verification failed (e.g., ByteCode mismatch).
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.
Open the Qubetics Explorer.
Click on "Add Qubetics Network" to automatically connect your wallet to the Qubetics blockchain.
EVM Version: London
Ensure your MetaMask wallet is connected to the Qubetics Network and displays the account address and available balance.
Click "Deploy" and confirm the transaction in MetaMask.
Once deployed, the contract address will appear in the Qubetics IDE terminal.