Blockchain Essentials | Part 2


Ethereum is an open-source, blockchain-based, decentralized software platform that enables the creation of smart contracts and decentralized applications (dApps). It provides a virtual machine that can execute scripts using an international network of public nodes. Ethereum was first proposed in 2013 by Vitalik Buterin, a programmer and co-founder of Bitcoin Magazine. The platform went live in July 2015 with 72 million coins pre-mined. The native cryptocurrency of the Ethereum platform is called Ether (ETH), and it is used to pay for transaction fees and computational services on the Ethereum network.


Ethereum is the community-run technology powering the cryptocurrency ether (ETH) and thousands of decentralized applications.

Ethereum has experienced several instances of downtime in its history. These downtimes have been caused by a variety of factors, including network congestion, software bugs, and hard forks. Some of the most notable instances of downtime include the DAO hack in 2016, which caused the Ethereum network to split into two separate chains, and the Cryptokitties craze in 2017, which caused severe congestion on the network.

Additionally, Ethereum 2.0 is still under development. This transition is planned to be made in multiple phases, and each phase could result in some form of downtime.

However, compared to other blockchain networks, Ethereum has a relatively high degree of uptime and its developers have been working to improve its scalability, security, and reliability.

Currently, there are thousands of nodes all over the world that are participating in the Ethereum network, and this number continues to grow as the network becomes more popular. These nodes communicate with each other to validate and process transactions, and they work together to maintain a copy of the Ethereum blockchain. This decentralized architecture helps to ensure the integrity and security of the network, as well as its ability to process a large number of transactions quickly.

Difference between Ethereum and Bitcoin

Ethereum and Bitcoin are both decentralized, digital currencies, but there are some key differences between the two.

Bitcoin was first created in 2009, and it is primarily used as a store of value and a medium of exchange. The primary purpose of Bitcoin is to act as a digital alternative to traditional, government-issued money. The maximum supply of Bitcoin is capped at 21 million coins.

Ethereum, on the other hand, was first created in 2015. In addition to acting as a digital currency, Ethereum is also a platform that enables the creation of decentralized applications (also known as dapps) and smart contracts.

Ethereum’s token, Ether (ETH), can be used to pay for transaction fees and services on the Ethereum network. Ether has no limit on maximum supply, which will be capped at the network’s demand and usage.

Both let you use digital money without payment providers or banks. But Ethereum is programmable, so you can also build and deploy decentralized applications on its network.

Ethereum being programmable means that you can build apps that use the blockchain to store data or control what your app can do.

This results in a general purpose blockchain that can be programmed to do anything. As there is no limit to what Ethereum can do, it allows for great innovation to happen on the Ethereum network.

While Bitcoin is only a payment network, Ethereum is more like a marketplace of financial services, games, social networks and other apps that respect your privacy and cannot censor you.

The main difference between Bitcoin and Ethereum is the purpose and capability of the network. Bitcoin was designed as a digital currency, while Ethereum was designed to be a platform for decentralized applications. Therefore, Ethereum has a more varied use case than Bitcoin, which is primarily a digital store of value.

Ethereum Terminology

1. Ether (ETH): Ether (ETH) is the native cryptocurrency of the Ethereum network. It is used to pay for transaction fees and services on the Ethereum network, such as the execution of smart contracts and the creation of decentralized applications (dapps). Ether is created through a process called mining, which is similar to the process used to create Bitcoins. Miners use their computer power to validate transactions on the Ethereum network and are rewarded with Ether for each block they add to the blockchain.

2. Ethereum Wallet: An Ethereum wallet is a digital wallet that allows you to store, manage, and send Ether (ETH) and other Ethereum-based tokens. It is similar to a traditional wallet in that it can be used to hold and spend your cryptocurrency, but it exists entirely online.

3. The Ethereum Virtual Machine (EVM): The Ethereum Virtual Machine (EVM) is the runtime environment for smart contracts on the Ethereum network. It is a virtual machine that executes code on the Ethereum blockchain, making it possible for decentralized applications (dapps) to run on the network. The EVM specialised in preventing Denial-of-service attacks and ensures that programs do not have access to each other’s state, ensuring communication can be established without any potential interference.

4. Nodes: In the Ethereum network, a node is a device or program that participates in the network by connecting to other nodes and helping to maintain the network’s decentralized infrastructure. Nodes in Ethereum perform different functions and have different characteristics, but generally, they all help to validate, store, and propagate information about the Ethereum blockchain.

The main function of a node is to hold a copy of the Ethereum blockchain and to validate the transactions that are included in blocks. Nodes also communicate with other nodes in the network to propagate information about new blocks and transactions.

There are different types of nodes in Ethereum, including full nodes, light nodes, archive nodes, and mining nodes.

  • Full nodes hold the entire history of the Ethereum blockchain and validate transactions and blocks and relay them to other nodes.
  • Light nodes rely on full nodes to get the current state of the network, they are useful for low-powered devices or for users who do not have the resources to run a full node.
  • Archive nodes also hold the entire history of the Ethereum blockchain and provide users with access to historical state and transactions of the Ethereum blockchain at any time.
  • Mining nodes are full nodes that are responsible for adding new blocks to the blockchain, by solving mathematical problems (proof-of-work) and getting rewarded in Ether.

In summary, Nodes in Ethereum are devices or programs that hold a copy of the Ethereum blockchain, validate and propagate transactions, and communicate with other nodes to help maintain the network’s decentralized infrastructure.

5. Accounts: In Ethereum, an account refers to a user’s address on the Ethereum blockchain, which is used to hold Ether (the native cryptocurrency of Ethereum) as well as interact with smart contracts on the network. Accounts are identified by their public address, which is a string of letters and numbers that is generated using a one-way cryptographic function. Accounts can also be associated with a private key, which is used to sign transactions and grant access to the account’s balance and contract interactions. There are two types of account : external owned account (EOA) and contract account.EOA is controlled by private key and contract account is controlled by code.

6. Blocks: In Ethereum, a block refers to a group of transactions that are added to the blockchain in a sequential manner. Each block contains a certain number of transactions, and once a block is added to the chain, the transactions within it are considered to be confirmed and irreversible.

A block in Ethereum also contains a reference to the previous block, which forms the chain of blocks and ensures the integrity and chronological order of the transactions.

Ethereum block also contains some extra information as well such as :

  • The block number
  • The miner’s address (i.e. the address that mined the block)
  • The hash of the previous block
  • The timestamp of when the block was mined
  • The nonce (i.e. a random number used in the mining process to find the block’s hash)
  • The gas used and its limit.
  • The state root (i.e. the root of the state trie, which stores the current state of the Ethereum network)
  • The transaction root (i.e. the root of the transaction trie, which stores all the transactions in the block)
  • The receipts root (i.e. the root of the receipt trie, which stores the receipts of all the transactions in the block)
  • The bloom filter (i.e. a bit array that allows for quick filtering of the transactions in the block)
  • The difficulty (i.e. a value that represents the difficulty of mining the block)
  • The total difficulty (i.e. the sum of the difficulties of all the blocks in the chain up to and including this block)

With the help of these field, block in Ethereum forms the backbone of the Ethereum network and enables the decentralized, trustless execution of smart contracts and the transfer of Ether and other assets.

7. Transactions: In Ethereum, a transaction refers to a message that is sent from one account to another on the Ethereum blockchain. Transactions are used to transfer Ether, to interact with smart contracts, or to execute smart contract functions.

A transaction in Ethereum is composed of several components, such as:

  • The nonce: a counter that keeps track of the number of transactions sent from a given account
  • The gas price: the amount of Ether that the sender is willing to pay per unit of gas to execute the transaction
  • The gas limit: the maximum amount of gas that the sender is willing to pay to execute the transaction
  • The to address: the address of the account to which the Ether or assets are being sent
  • The value: the amount of Ether being sent in the transaction
  • The data: any additional data that is being included in the transaction, such as function calls to a smart contract
  • The v,r,s : digital signature that confirms the authenticity of the transaction, which is produced by the sender’s private key

These fields are hashed together to form the transaction hash.

When a transaction is broadcasted to the network, it is verified by the nodes, and then added to the transaction pool. Miners will then include the transactions from the pool in the blocks they mine, and when the block is added to the blockchain, the transaction is confirmed and the changes it makes to the state of the blockchain take effect.

It’s important to note that In Ethereum, a transaction is only considered confirmed if it is included in a block, and the number of confirmations is the number of blocks that have been added to the blockchain after a given transaction. The more confirmations a transaction has, the more secure it is considered.

8. Gas: Gas refers to the unit that measures the amount of computational effort required to execute specific operations on the Ethereum network. Gas is used to pay for the execution of transactions and smart contract code on the Ethereum blockchain. It acts as a way to prevent spamming or denial-of-service attacks by requiring the sender to pay for the computational resources needed to process their transaction or contract. Gas is measured in “gas units,” and the cost of gas is denoted in Ether (ETH), the cryptocurrency used on the Ethereum network. It’s used to pay for the computational work done by the nodes in the network who validate and execute the smart contract or transactions.

9. Smart Contracts: A smart contract is a self-executing contract with the terms of the agreement between buyer and seller being directly written into lines of code. It exists on a blockchain network and allows for the automation of digital assets’ transfer. Smart contract enables trustless trust, mean the code executes exactly as written. Ethereum is a blockchain network that supports the creation and execution of smart contracts. Ethereum’s smart contracts are written in Solidity, a programming language specifically designed for the Ethereum platform.

10. Solidity Programming: Solidity is a programming language for writing smart contracts on the Ethereum blockchain. It is a high-level language that is similar in syntax to JavaScript, and it is designed to be used for implementing smart contracts on the Ethereum Virtual Machine (EVM). Solidity contracts are compiled into bytecode that can be executed on the EVM, and they can interact with other contracts, perform complex logic, and store and retrieve data on the blockchain. Solidity also includes a number of built-in functions and data types that are specific to the EVM and the blockchain environment. Solidity is used to write the code for these smart contracts and define the rules and logic that govern their behavior. This code is then compiled and deployed to the Ethereum blockchain, where it can be stored and executed.

11. Pragma: The pragma keyword is used to enable certain compiler features or checks. In the Ethereum ecosystem, “pragma” refers to the version of the Solidity compiler that is being used to compile the smart contracts. Pragma is specified at the top of a Solidity contract file using a line that starts with “pragma”. For example, ” pragma solidity0.7.0 ” specifies that the contract should be compiled using the latest version of the Solidity compiler that is compatible with version 0.7.0. It helps to maintain the backward compatibility and test the smart contract with different solidity version to confirm it’s working as expected.

11. Version Pragma: A version pragma specifically refers to a type of pragma that is used to specify the version of the programming language or environment that a particular script or file is written in. In simple terms, all version pragma is a pragma but all pragma is not version pragma. The version pragma is used as follows:  pragma solidity >= 0.7.0 < 0.9.0

Structure of a Smart Contract

The structure of a smart contract can vary depending on the programming language and blockchain platform used, but in general, a smart contract can be broken down into the following components:

  1. Variables: Variables store the data and state of the contract, they can be of different types (e.g. integers, strings, boolean, etc.).
  2. Functions: Functions are the building blocks of a smart contract, they are used to execute certain actions or calculations, they can be public, private or internal.
  3. Modifiers: Modifiers are used to change the behavior of functions based on certain conditions, they can be used to check if a user has the necessary permissions to execute a certain action, or to enforce certain rules on the contract’s variables.
  4. Events: Events allow for the contract to emit a message that is recorded on the blockchain and can be listened to by external parties, they can be used to track changes in the state of the contract, or to inform external parties of certain actions that have occurred.
  5. Constructor: A constructor is a special function that is executed when a smart contract is created, it can be used to set the initial state of the contract, or to perform any other necessary setup tasks.
  6. Fallback function: A fallback function is a special function that is executed when a contract receives a transaction without any data or a function signature.
  7. Library: Library is a collection of functions that can be imported by the contract to be reused, libraries can be a way to separate concerns and make the contract more readable.
  8. Inheritance: Smart contract can inherit properties and behaviors from other contracts, it allows the use of reusable code, and it can be used to make smart contracts more modular.

This is a general overview of the different components that a smart contract might include, depending on the requirements of the specific use case and the programming language used. Complex smart contracts can include multiple functions, variables, and other components, and can even call other smart contracts.

Layout of Solidity Source file

In Solidity, a source file generally has the following layout:

  1. Pragma statement: A pragma statement specifies the version of the Solidity compiler that should be used to compile the code. It is generally the first line of the source file and has the following format: pragma solidity <version>;
  2. Import statements: Import statements are used to include other source files or libraries in the current file. The syntax for an import statement is: import "filename";
  3. Contract definition: A contract in Solidity is defined using the “contract” keyword, followed by the name of the contract. Within the contract definition, various functions and variables can be defined.
  4. Function definitions: Functions are defined within the contract definition and have the following format: function <function_name>(<parameters>) <visibility> <modifiers> <return_type> { <function_body> }
  5. Variable definitions: Variables are defined within the contract definition and have the following format: <type> <variable_name> <visibility> <modifiers> = <value>;

Note that not all of these components are necessary, and a solidity contract can be as simple as just a contract definition with no functions or variables defined or can be as complex as a contract that imports multiple libraries, defines multiple functions and variables, and uses many modifiers and visibility levels.

Since making source code available always touches on legal problems with regards to copyright, the Solidity compiler encourages the use of machine-readable SPDX license identifiers. Every source file should start with a comment indicating its license: // SPDX-License-Identifier: MIT

The compiler does not validate that the license is part of the list allowed by SPDX, but it does include the supplied string in the bytecode metadata.

Related Questions

How smart contracts work?

Smart Contracts are self-executing digital agreements that are written in a programming language called Solidity. Here’s a more detailed explanation of how smart contracts work in Ethereum:

  1. The terms of the contract are defined and written in Solidity code. The code is then compiled and deployed to the Ethereum network.
  2. When a user wants to execute the contract, they send a transaction to the Ethereum network, which includes the address of the deployed smart contract and any data or parameters required to execute the contract.
  3. The Ethereum network then processes the transaction, which triggers the code of the smart contract to run on the nodes of the network.
  4. The code checks the conditions set out in the contract and if they are met, executes the terms of the contract automatically. This can include updating the state of the Ethereum blockchain, such as transferring digital assets, updating data stored in the contract, or triggering other smart contracts.
  5. As the smart contract is stored on the Ethereum blockchain, the terms of the contract and its execution are transparent and visible to all parties involved.
  6. The execution of the smart contract is recorded in a block and added to the Ethereum blockchain, providing immutability and transparency.
  7. The smart contract can also be called by other smart contract, it can be reused and can be connected to other decentralized applications.

In Ethereum, smart contracts are executed by the Ethereum Virtual Machine (EVM) on the nodes of the network. The EVM runs the bytecode of the smart contract and updates the state of the blockchain accordingly. Gas is used to pay for the computation of the contract and the execution of it.

What are the Benefits of Smart Contract?

Smart contracts offer a number of benefits, including:

  1. Automation: Smart contracts can automatically execute the terms of a contract when certain conditions are met, without the need for human intervention. This can help to reduce the risk of fraud, errors, and delays.
  2. Transparency: Smart contracts are stored on a decentralized blockchain, which means that the terms of the contract and its execution are visible to all parties involved. This helps to increase transparency and trust between parties.
  3. Cost savings: Smart contracts can help to reduce the cost of transactions by eliminating intermediaries, such as lawyers and banks, and by automating many of the processes involved in a contract.
  4. Security: Smart contracts are stored on a decentralized blockchain and can be programmed to execute only when certain conditions are met. This helps to increase security and reduce the risk of fraud and hacking.
  5. Decentralization: Smart Contracts enables P2P interactions and it does not require a central point of control, which can help to increase decentralization and reduce the need for trusted intermediaries.
  6. Auditability: Smart contracts are stored on a decentralized and open-source blockchain, this allows auditing of the contract by anyone without the need of a centralized intermediary.
  7. Accessibility: Smart Contracts can be coded to be self-executing and self-enforcing. this allows parties to interact and transact without prior knowledge or trust between parties.

In summary, Smart contracts are self-executing digital agreements with the terms of the agreement between buyer and seller being directly written into lines of code. They have the ability to automate processes, increase transparency, reduce costs, and improve security, decentralization and auditability of transactions.

* The material and content uploaded on this website are for general information and reference purposes only and don’t copy the answers of this website to any other domain without any permission or else copyright abuse will be in action.

Please do it by your own first! Protection Status

To understand more about Solidity language,

0 0 votes
Article Rating
Notify of

Newest Most Voted
Inline Feedbacks
View all comments

[…] Blockchain Essentials | Part 2 […]


[…] Blockchain Essentials | Part 2 […]


[…] Blockchain Essentials | Part 2 […]

close button
Would love your thoughts, please comment.x