6

Do you know Ethereum, Smart contracts with Solidity?

 3 years ago
source link: https://blog.knoldus.com/do-you-know-ethereum-smart-contracts-with-solidity/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Do you know Ethereum, Smart contracts with Solidity?

Reading Time: 2 minutes

Solidity is an object-oriented programming language for writing smart contracts on various blockchain platforms, most notably Ethereum.

Ethereum

Ethereum is an open-source, blockchain-based software platform. It has its own cryptocurrency called Ether. It enables the creation of smart contracts and decentralized applications, known as dapps. In addition, Ethereum is also a programming language that is executed on EVM.

In simple words, Ethereum is “codify, decentralize, secure, and trade just about anything.”  

One of the big projects around Ethereum is Microsoft’s partnership with ConsenSys. It offered Ethereum Blockchain as a Service (EBaaS) on Microsoft Azure. Therefore, Enterprise clients and developers can have a single click cloud-based blockchain developer environment.

What is Ethereum Virtual Machine (EVM)

EVM allows programmers to execute Smart contracts generally written in higher-level languages, like Solidity. In addition, we have more languages like Vyper and Bamboo also.

EVM cannot directly execute the higher-level language code. They need to be first converted into low-level languages as opcodes. 

Moreover, there are 140 unique opcodes that make EVM “Turing complete”. This means EVM is able to solve any computation problem. As every opcode is 1 byte in size which means there can be a maximum of 256 opcodes. 

Smart Contracts

“Smart-contracts are a way for people all across the globe to do business with each other even if they don’t speak the same language or use the same currency.”

Mihai Alisie

Smart contracts are where the transactions between the buyer and seller directly write in lines of code. And which is available over a distributed, decentralized blockchain network. Results in removing the implications of legal or external enforcement mechanisms.

For instance, It follows the concept of if and then logic that if x happens then y occurs.

Solidity : The Programming Language

Solidity was developed by Gavin Wood, Yoichi Hirai, Christian Reitweissner. Above all, It is one of the highly used contract-oriented programming languages replaced by Mutan, LLL, and Serpent. 

  1. Solidity is a statically-typed, object-oriented programming language.
  1. Developed around the idea of ECMAScript syntax which makes it easier to adapt by the developers.
  1. It supports inheritance including multiple inheritance also. Additionally it supports complex user defined types and more. Therefore it gives you all features to develop an automated blockchain application.

NOTE: Keep in mind always while deploying contracts use the latest released version of solidity because new updates and bug fixes are introduced on any new release.

// My First Smart Contract 
pragma solidity >=0.5.0 <0.7.0;
contract HelloWorld {
    function get()public pure returns (string memory){
        return 'Hello Contracts';
    }
}

Most importantly, In solidity, the first statement is always pragma declaring the version of the compiler that the code should use.

Note: The source file will not compile if the version is earlier than  0.4.0 or with the compiler starting with 0.5.0.

Summary

In this article, we learned about an entirely new world of world computers, Ethereum, EVM. And, Additionally, we had an introduction on how smart contracts can be wrote in Solidity with a small snippet of code.

Happy Learning!!

References

https://wp.me/p1D2XH-mu1

https://consensys.net/knowledge-base/about-ethereum-eth/

https://www.investopedia.com/terms/e/ethereum.asp


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK