How to do it...

  1. Open Remix (https://remix.ethereum.org) in your desktop browser.
  2. Copy your smart contract to Remix and it will automatically compile your code. Warnings and errors, if any, will be displayed in the right panel.
  3. Remix has an inbuilt JavaScript VM for testing smart contracts. Ensure that you have selected JavaScript VM as the default environment under Run:

  1. Select an account from which the contract will be deployed. You can select an account from the list of default accounts provided by Remix. Each account is loaded with enough Ether for testing. 
  2. The gas limit specifies the maximum amount of gas (unit for calculating the execution cost) that has to be used for deployment. For our HelloWorld contract, the default value should be enough.
  3. To send some Ether to the contract while deploying, use the Value field to specify the amount of Ether to send.
  4. Deploy your contract using the Create button. Ensure that the drop-down menu above the Create button has your contract name selected.
  1. Once you have successfully deployed your contract, you can see the transaction and other logs in the console window. Click on the Details button to view more information:
  1. Once the contract is deployed, Remix will also generate an interactive contract instance UI for you to interact with:

  1. The contract instance UI generated by Remix will display the contract address, along with the relevant controls for all public and external methods. Blue controls are read-only methods, which are free to use, and red controls are used to modify the state of the contract.
  2. Test the printSomething method by clicking its button and it will display the default value, which is "hello world".
  3. Try changing the default value with the help of the changeText method. Input values are provided in the input box, which is next to each button. Ensure that you are entering the string value in double quotes ("new text").
  4. The Account, Gas Limit, and Value fields at the top also apply while interacting with your contract.

Remix will work over both HTTP and HTTPS protocols. This can come in handy if you are connecting to a local node that may not always have an HTTPS connection.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.227.4