Basic Smart Contract(Learn 'Solidity' - Part 4)

in #ethereum7 years ago (edited)

Time to get started with the Smart Contract development using Solidity. We will begin development using the Remix IDE. It is a browser-based IDE for developing Smart Contracts for Ethereum. Optionally, you can also install it on your machine if you want but we are going to stick with the browser version. So, the first thing you need to do is open Remix IDE.

 
 

At the left-hand side, you will find a file manager, a text editor in the middle and compiler, debugger and other options at the right-hand side.

 
 

Smart Contract Basics

First of all, create a new contract by clicking the '+' sign at the left window pane and name it whatever you like. Make sure that you keep the extension as '.sol'.

 

  • Every smart contract begins by defining the solidity version with

pragma solidity ^0.4.18;

 

  • Then, we will create a contract with

contract firstSmartContract {}

You can keep the name whatever you like.

 
 

After that, we are going to compile and run this smart contract. Just click 'Start to compile' and click 'Deploy' under the 'Run' tab.

 Capture.JPG

 
 

Capture1.JPG

 
 

Now, the Smart Contract lives at an address. You can see more details about your Smart Contract in the debugger window below the text editor.

Capture2.JPG

 
 

The Smart Contract is not live at the Ethereum Blockchain at the moment as we are currently working with the JavaScript EVM.

 
 

'gas' In Ethereum

You could see 'gas' in the debugger window. It is the execution fee for every operation on the Ethereum blockchain. Its price is determined by the miners and expressed in 'ether'. We will cover more on 'gas' later or you can check out the ethereum documentation right away.

 
 


 

Previous Posts

 

Introduction To 'Solidity'(Learn 'Solidity' - Part 1)

 

Ethereum & Smart Contracts(Learn 'Solidity' - Part 2)

 

Tips To Learn 'Solidity' On Your Own(Learn 'Solidity - Part 3)

 
 


 

Upcoming Posts

 

Smart Contract Vs DApp(Learn 'Solidity' - Part 5)