• Articles
  • Tutorials
  • Interview Questions

How Smart Contracts work on Blockchain

What is Ethereum?

Ethereum, a distributed open Blockchain network was conceptualized by Vitalik Buterin in November 2013. The development of a Turing-complete language that allows the development of smart contracts for blockchain and decentralized applications, unlike Bitcoin which is non-touring. The “Ether” is the cryptocurrency of Ethereum.

Comparing Wei & Ether:

Unit Wei Value Wei
Wei 1 wei 1
Kwei (babbage) 1e3 wei 1,000
Mwei (lovelace) 1e6 wei 1,000,000
Gwei (shannon) 1e9 wei 1,000,000,000
microether  (szabo) 1e12 wei 1,000,000,000,000
milliether (finney) 1e15 wei 1,000,000,000,000,000
ether 1e18 wei 1,000,000,000,000,000,000

Smart Contracts:

The fundamental blocks of programs composed for the Ethereum platform are called “smart contracts”. A triggering event is hit and the contract(program) is executed.

Get 100% Hike!

Master Most in Demand Skills Now!

Transactions in Ethereum:

A transaction in an Ethereum is considered as the data package which is signed and contains the information which is to be sent from an external block account to another account of any other block which is in a different network.
Ethereum blocks contain both a transaction list and the most recent “state” of the ledger of these transactions. The miners have to approve and validate the transaction. The miners are rewarded in case they generate the correct block and it is currently 5 Ether for successful mining.

Don’t miss out on the blockchain revolution! Enroll in our Blockchain course today.

Consensus in Ethereum:

Consensus is a mechanism by which the entire network is in the same agreement about the supply and division of tokens. Proof-of-work protocol called Ethash is used in the Ethereum network, with the mining same as Bitcoin Blockchain to find a nonce that once hashed the result in a predetermined difficulty level. Ethereum uses SHA-3 for encryption.
Ethash makes Ethereum resistant to high-powered mining chips, and easily accessible to “light” client implementations that allow users without downloading the Ethereum blockchain to their device. However light clients download headers of the blocks for reference.

Know about Ethereum and how to use it for Smart contracts by enrolling in Blockchain Training in Bangalore.

Blockchain masters program

Clients of Ethereum:

There are multiple client implementations across a range of different operating systems and programming languages. This client diversity is important for the long-term health of the Ethereum network. Ethereum clients are like software that allow users to:

  • Approves transactions/blocks
  • Create/manage accounts
  • Send/receive transactions from/to your Ethereum accounts
  • Deploy smart contracts onto the blockchain
  • “Mine” Ether on the Ethereum Blockchain

Few clients of Ethereum are Go-Ethereum, Parity, Cpp-Ethereum, Ruby-Ethereum etc.

Solidity:

Ethereum’s native Programming language is Solidity. Solidity is a “contract-oriented”, statically typed, syntax similar to that of JavaScript. Designed to target the Ethereum Virtual Machine (EVM).  It supports inheritance and libraries. It compiles instructions into bytecode so that they can then be read by the network. The source files may have contract definitions that are random in number and this also has the directives and pragma directives.

The version pragma is “pragma solidity ^0.4.0;”

MetaMask:

MetaMask is a type of digital Ethereum wallet which helps to run Ethereum dApps right in your browser. Setting up an account in MetaMask allows to send and receive Ether and it also allows to deploy Smart Contracts. To receive an Ether you should have an Ethereum account or an Ethereum wallet to send and receive Ether.

Gas transaction:

Once a contract is executed, Ethereum consumes ‘gas’, these are like tokens to run the computations. A transaction fee imposed for miners is charged as some amount of Ether and is taken from the account balance of the transaction originator. The higher the fee, the higher the chances that the transactions will be picked up by the miners for inclusion in the block. Providing too little gas will result in a failed transaction.

Stay ahead of the curve and get ready to ace your blockchain interview with our curated list of blockchain interview questions and answers!

Course Schedule

Name Date Details
Blockchain Course 23 Nov 2024(Sat-Sun) Weekend Batch View Details
30 Nov 2024(Sat-Sun) Weekend Batch
07 Dec 2024(Sat-Sun) Weekend Batch

About the Author

Technical Lead - Blockchain and Cyber Security Professional

Arpit is a Technical Lead in blockchain and cyber security. He has 5+ years of experience helping companies secure their applications via ethical hacking practices and has helped many fintech companies set up their blockchain implementations. In his free time, he provides training on cybersecurity and related domains.