2. How to use Nervos IDE?

This page discusses how to set up writing contracts, compiling contract files, deploying, interacting, and querying with smart contract

1. Write a Smart Contract

To create a new smart contract we need to click on New File button at the top of the file system, currently supported file types in ChainIDE are txt', 'sol' , 'md' , 'compiled', 'deployed', 'json', 'txt', 'js', 'css', 'html', 'go', 'sum', and 'mod'. The contract shown in the figure below is a very simple storage contract prepared by ChainIDE for its users. Users can make changes in the built-in template according to their requirements.

2. Compile a Smart Contract

Once the user has completed writing down the smart contract, they need to 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 a Smart Contract

To deploy a smart contract, a user needs to click the Deploy& Interaction button on the right, the compilation page, and the interaction page will appear, set the gas limit and gas price, and then click Deploy and sign the Metamask at the same time. 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. Contract Interaction

After the contract is successfully deployed, we need to interact with the contract deployed on the chain to obtain our own wallet address. If the interaction is successful, the log information will be printed on the console. Click the Get button to return the result interaction information. (Query, copy, and delete buttons can perform corresponding operations on the contract).

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.