Ethereum For Beginners

Develop smart contract using solidity

Ethereum is one of the fast growing technology that is set to break all the records. Most of us wanted to explore this technology but due to lack of complete tutorials or beginner guide most of us struggle to get started with this technology. We prepared a beginner guide on the Ethereum blockchain that help you to get started with Ethereum blockchain development.

This is lesson 2 of Ethereum development beginner guide and this lesson focus on smart contract development using solidity language. You can watch the video below to go in more detail.

Before you start with development, you need to make two choices, first is the language to write the smart contract and second is the IDE tool to create smart contract.

Smart Contract Language

Although there are other languages available, Solidity is most popular language to create smart contract so we will use solidity to create smart contract.

IDE

There are many IDE's to write smart contract but Remix is best for beginner. Remix comes in two flavor, one is web browser IDE and second is install-able IDE , we will use web browser based IDE to create smart contract.

Let's see how to create smart contract.

First open the remix IDE using below URL.

https://remix.ethereum.org 

Then create new file under browser folder and name the file as student.sol. .sol is extension for solidity files. Add below piece of the code in that file.

pragma solidity ^ 0.4.20;

 

contract student{

string name;

uint age;

function setStudentDetails(string _name, uint _age) public{

name=_name;

age=_age;

}

function getStudentDetails() public view returns(string, uint){

return (name, age);

}

}

Here name and age are data types defined. There are types of data types available like bytes, bool etc. that can be used as needed.

setStudentDetails and getStudentDetails two functions defined.

setStudentDetails() function is used to set the student name and age, the function is defined as public so that anyone can access it.

getStudentDetails() function is used to get the student name and age, the function is defined as public so that anyone can access it and along with that view is set as this function is query only.

 

 

Lesson Intro Video

Please login to get access to the quiz
Setup Ethereum Development Environment (Prev Lesson)
(Next Lesson) Compile and Deploy smart contracts
Back to Ethereum For Beginners
Inquire Now
close slider