2. How to Use Conflux IDE?

Set the entire process of writing contracts, compiling contract files, deploying, interacting, querying, using truffle and ganache, etc.

1. Create and Write down a smart contract

Users need to click the New File button at the top of the file system to create a new contract file (currently supported file types are 'txt', 'sol',' md', 'compiled', 'deployed', 'json', 'txt', ' js', 'css', 'html', 'go', 'sum', 'mod'), here we click on the Storage.sol file, this is a very simple deposit contract prepared by ChainIDE for everyone, users can make modifications based on their requirements. Users are free to create new folders and supported files.
2. Create your project in ChainIDE

2. Compile the Smart Contract

Once you have finished writing down your smart contract, then click the Compile button on the right menu bar to open the compilation module, then select the Compiler compilation tool, and then click the Compile Storage.sol button to compile the solidity file. After the compilation is successful, the following ABI and bytecode contents will appear, and at the same time, they will be displayed on the console. Compile contract success is output.

3. Deploy the Smart Contract

Click the Deploy&Interaction button on the right, and the compilation page and the interaction page will appear. Set the gas limit(1000000) and gas fee(20), then click Deploy and confirm on the Metamask. You can also click the Import Deployed Contract button to fill in the contract correlation information and click Import to import the deployed contract. The Successful deployment will display contract-related information on the console and contract-related information on the interactive page.
4. Procedure of Contract deployment
5. Contract Deployment

4. Contract Interaction

After the contract is successfully deployed, we can easily interact with the contract, deployed it on the blockchain, and perform operations that we created in our smart contract, e.g., a storage contract for storing the integer value has two operations, one is to store the value on the blockchain and second is to retrieve the stored value from the blockchain. Users need to pay the gas fee both times, whenever they deploy a smart contract, and whenever they make a transaction on the deployed smart contract. Let's see how to interact with a simple built-in smart contract that is available in ChainIDE templates, Storage. When a user tries to make a transaction using the "INTERACT" module from the "Deploy & Interact" button, it will prompt the user to pay the gas fee for the transaction. If the interaction is successful, the log information will be printed on the console as well as in the "Transaction Panel". Under the "Transaction Panel", users can use the "Submit" button to store the value on the blockchain and the "Get" button to get the result from the blockchain. (Query, copy, and delete buttons can perform corresponding operations on the contract).
Once a user has paid the fee for the transaction, the transaction would be successful and the user can access the information regarding the transaction from the output panel as well as from the transaction panel. Now, we will see how a user can access the information regarding the transaction such as the gas fee used for the transaction, transaction hash, transaction log, etc.

5. Contract Query

Click the "Transaction" button on the right to display the transaction details page, where you can view the specific information of each transaction. Select one of the contracts and click the more button to view specific information.
7. Contract Query Procedure