2. How to Use Chain33 IDE?
Set the entire process of writing contracts, compiling contract files, deploying, interacting, querying, using truffle and ganache, etc.
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
- 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.
! Suggestion: 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.
Note! In this tutorial, we will create a smart contract to store the value on the Ethereum blockchain and access the stored values from Ethereum Blockchain.
First of all, you need to go to the ChaiIDE for the Ethereum blockchain. Solidity is the most commonly used for blockchain. ChainIDE provides built-in templates also. Users can use them for understanding and can change 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.
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
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. Contract Compilation Using Compile Module
Click the Deploy&Interaction button on the right, 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 for Contract Deployment
5. Contract Deployment
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 for both, 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, delete buttons can perform corresponding operations on the contract).
6. Interaction with Deployed Smart Contact
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