Deploy on Vexon

Here is a structured guide for deploying a smart contract on the Vexon Smartchain Testnet using the provided sample contract.

Guide: Deploying a Smart Contract on Vexon Testnet

Step 1: Prepare Environment

  1. Install MetaMask: Make sure you have MetaMask installed as a browser extension. It's needed to connect to the Vexon Testnet.

  2. Connect to Vexon Testnet:

    • Go to MetaMask, click on your profile icon and choose "Settings."

    • Navigate to "Networks" and add a new network with the following details:

  3. Obtain Testnet tVEX:

    • Claim some test tVEX from the Vexon Faucet to fund transactions on the Vexon Testnet.

Step 2: Write Your Smart Contract

Use the following sample contract code as a base to deploy on Vexon Smartchain. You can modify the contract details according to your needs (token name, supply, decimals, etc.).

pragma solidity ^0.4.4;

contract Token {
    function totalSupply() constant returns (uint256 supply) {}
    function balanceOf(address _owner) constant returns (uint256 balance) {}
    function transfer(address _to, uint256 _value) returns (bool success) {}
    function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {}
    function approve(address _spender, uint256 _value) returns (bool success) {}
    function allowance(address _owner, address _spender) constant returns (uint256 remaining) {}

    event Transfer(address indexed _from, address indexed _to, uint256 _value);
    event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}

contract StandardToken is Token {
    function transfer(address _to, uint256 _value) returns (bool success) {
        if (balances[msg.sender] >= _value && _value > 0) {
            balances[msg.sender] -= _value;
            balances[_to] += _value;
            Transfer(msg.sender, _to, _value);
            return true;
        } else { return false; }
    }

    function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
        if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
            balances[_to] += _value;
            balances[_from] -= _value;
            allowed[_from][msg.sender] -= _value;
            Transfer(_from, _to, _value);
            return true;
        } else { return false; }
    }

    function balanceOf(address _owner) constant returns (uint256 balance) {
        return balances[_owner];
    }

    function approve(address _spender, uint256 _value) returns (bool success) {
        allowed[msg.sender][_spender] = _value;
        Approval(msg.sender, _spender, _value);
        return true;
    }

    function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
      return allowed[_owner][_spender];
    }

    mapping (address => uint256) balances;
    mapping (address => mapping (address => uint256)) allowed;
    uint256 public totalSupply;
}

contract TestToken is StandardToken {
    string public name = "Test Token";
    uint8 public decimals = 18;
    string public symbol = "Test";
    string public version = "1.0";

    function TestToken() {
        balances[msg.sender] = 100000000000000000000000000; // Initial token supply
        totalSupply = 100000000000000000000000000;
    }
}

Step 3: Deploy Your Contract

  1. Use Remix IDE:

    • Open Remix and paste the above contract code.

    • Choose the Solidity Compiler from the sidebar and ensure it’s set to 0.4.4.

    • Compile your smart contract.

  2. Deploy to Vexon Testnet:

    • In Remix, go to the "Deploy & Run Transactions" tab.

    • Under "Environment," select "Injected Web3" (MetaMask).

    • Ensure MetaMask is connected to the Vexon Testnet.

    • Deploy the contract by clicking the "Deploy" button. You will be prompted to confirm the transaction in MetaMask.

Step 4: Verify Contract

  1. Once deployed, copy the contract address.

  2. Visit the Vexon Explorer (once available) to verify the contract and ensure it's successfully deployed.

Step 5: Interact with the Contract

  1. In Remix, after deployment, you'll see the contract functions.

  2. You can test:

    • Transferring tokens

    • Checking balances

    • Approving and transferring from other addresses

This guide will help you deploy and test your smart contract on the Vexon Testnet using the sample code provided.

Last updated