2. How to Use Ethereum IDE?
Set the entire process of writing, compiling, deploying, interacting, and querying with smart contracts
Steps to Create Your First APP
- 1.First of all, you need to select the blockchain of your interest. ChainIDE will provide the environment according to the chosen blockchain.
- 2.The second step is to write down a smart contract according to your requirements.
- 3.Once you finish writing, you need to compile the smart contract using the appropriate compiler version to check if your contract has any errors. If there is any error the compiler will highlight it in the output panel. During compilation, the IDE will show the "
Compiling Contract" message in the output panel.
- 4.After the successful compilation, it's time to deploy the smart contract. To deploy, we need to have a MetaMask wallet and some dummy ethers to pay the gas fee for deploying on the blockchain.
- 5.After deployment, you can interact with the deployed smart contract from the "
Deploy and Interaction" panel or you can create your own interface for the interaction using web3.
Users are suggested to go through the output panel and read the output in the panel if any error occurs.
We will discuss all these steps in detail, and we will create, compile, deploy, and interact with a smart contract using ChainIDE for Ethereum.
In this tutorial, we will create a smart contract to deploy on the Ethereum blockchain. The smart contract stores the value on the Ethereum blockchain and accesses the stored values from Ethereum Blockchain.
First of all, you need to go to the ChainIDE for the Ethereum blockchain. Solidity is the most commonly used blockchain. ChainIDE provides built-in templates also, users can use them for understanding and can make changes to them according to their requirements. You can either click on the Ethereum button from the homepage or you can click on Try Now button. If you click any of the blockchain buttons, it will redirect you to that blockchain and all the environment settings will be ready according to the chosen blockchain.
1. ChainIDE Homepage
Once the blockchain is chosen, the user can create, compile and deploy the smart contract using that blockchain IDE.
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. ChainIDE project creation
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. Smart contract compilation using ChainIDE
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.
2. Smart contract deployment + Gas fee payment using MetaMask wallet
5. Deployed contract information on ChainIDE
6. View Deployed smart contract infromation on Etherscan (Ropsten Network)
After the contract is successfully deployed, we can interact with the deployed smart contract, 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 whenever deploy a smart contract and make a transaction to the deployed smart contract, but no need to pay the gas fee when retrieving the stored data from the blockchain. 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 show all the functions of the deployed smart contract. You can use these functions and interact with the deployed smart contract through these functions. If the interaction is successful, the log information will be printed on the console as well as in the "Transaction Panel". An example is shown in Figure 7, a simple storage smart contract is deployed on the Ethereum blockchain in section 4, Under the "Transaction Panel", all the functions of the storage smart contract are shown and users can use the "Submit" button to store the value on the blockchain and the "Get" button to get the result from the blockchain.
7. Interacting with th deployed smart contract using ChainIDE
As mentiond above, a transaction costs some gas fee, and 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.
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