Tron-IDE

Online editor of smart contract

Overview

Tron-IDE is an online editor that helps developers develop smart contracts. It has the characteristics of modularity and provides editing, compiling, and deploying smart contracts in the form of plugins.

What will you learn?

Through this article, you will learn how to compile and deploy contracts to the TRON network through Tron-IDE.

What will you do?

  • Create files on TRON-IDE
  • Compile smart contract
  • Deploy smart contracts

Getting started with Tron-IDE

TRON-IDE is an online IDE focused on developing smart contracts on the TRON network. You can try it immediately here.

Install TronLink chrome extension

TRON-IDE needs to interact with TRON account 、node through the TronLink wallet. The installation and operation of TronLink are as follows:

  • Install TronLink Chrome Extension
  • Create an account by creating wallet, importing wallet, or linking a hardware wallet
  • For testnet, you can obtain test coins through faucet
  • Select the corresponding network on the TronLink chrome extension

Write the HelloWorld contract

To start building the smart contract, click New File and name it to HelloWorld.sol:

Copy and paste the following code into the newly created HelloWorld.sol file:

// Specifies that the source code is for a version
// of Solidity greater than 0.5.10
pragma solidity ^0.5.10;

// A contract is a collection of functions and data (its state)
// that resides at a specific address on the Ethereum blockchain.
contract HelloWorld {

    // The keyword "public" makes variables accessible from outside a contract
    // and creates a function that other contracts or SDKs can call to access the value
    string public message;

    // A special function only run during the creation of the contract
    constructor(string memory initMessage) public {
        // Takes a string value and stores the value in the memory data storage area,
        // setting `message` to that value
        message = initMessage;
    }

    // A publicly accessible function that takes a string as a parameter
    // and updates `message`
    function update(string memory newMessage) public {
        message = newMessage;
    }
}

Compile the contract

Use the SOLIDITY compiler plugin (Solidity compiler), select the corresponding compiler version, and compile the smart contract. After the compilation is successful, the compilation result information, including ABI, Bytecode will be returned, else, the detailed error information in red will be returned.

Now, we compile the above HelloWorld contract, and for the compiler version, here selects 0.5.16:

Deploy the contract

After the compilation is successful, using the deployment plugin (DEPLOYMENT) to deploy the compiled HelloWorld contract to the TRON Shasta testnet:

Once TronLink is connected to TRON-IDE, when you click the "Deploy" button on TRON-IDE, TronLink will pop up a signature window for creating a smart contract, then you should confirm the signature.

After the deployment is successful, the transaction information will be returned on the terminal of TRON-IDE.

So far, you have successfully deployed the HelloWorld contract. Now you can check the deployment status on the Shasta testnet browser according to the contract address and interact with the deployed contract.