top of page

Ultimate guide to write your first Smart contract...

  • Writer: Avi
    Avi
  • Nov 18, 2020
  • 1 min read


ree


What is a Smart Contract?

A smart contract is the digital version of a contract that runs on the Blockchain nodes and is executed when a set of trigger criteria are met. The transactions that happen in a smart contract are processed by the blockchain, which means they can be sent automatically without a third party.

From a developer's point of view, smart contracts are lines of code that define the business logic.


Steps to design a smart contract:

ree


Languages used to build Smart Contract:

  • Solidity

  • Golang

  • Javascript

  • C++

  • Java


In this post we will write a simple smart contract using Solidity language.

About Solidity:

Solidity is an object-oriented, high-level language for implementing smart contracts. Solidity was influenced by C++, Python and JavaScript and is designed to target the Ethereum Virtual Machine (EVM).

Solidity is statically typed, supports inheritance, libraries and complex user-defined types among other features.



IDE used to test smart contract written in Solidity:

Remix IDE is an open source web and desktop application. It fosters a fast development cycle and has a rich set of plugins with intuitive GUIs. Remix is used for the entire journey of contract development as well as being a playground for learning and teaching Ethereum.



Simple smart contract to print "hello world!" using Solidity:


Code:


//defines the versions of the compiler that particular code is compatible with.

pragma solidity ^ 0.7.4;


//a contract is defined using contract keyword

contract HelloWorld{

//function to return a string, pure => tells that this is a read only function


function helloWorld() pure public returns(string memory){

return "Hello World!";

}

}



Comments


Contact

  • Black Facebook Icon
  • Black Twitter Icon
  • Black Instagram Icon
  • Black YouTube Icon

© 2021 by CyberFit Chronicles

Thanks for submitting!

bottom of page