Smart Contracts: Definition, Working, Writing & Deploying

Hello friends, Hope you are doing fine and having a good time in your life. The topic that I am going to discuss today is a very interesting and important one in the context of blockchain. I will discuss smart contracts in this article and I am sure you will learn the concept by the end of this tutorial. I have mentioned smart contracts in my previous articles and defined them before.

Before discussing smart contracts, let’s first revise what a contract is, and then we will talk about smart contracts.

Contract

  • When two persons or two parties want to carry out a deal or a transaction such as buying property, they need some proof for future reference.
  • So, a contract between two or more individuals is a legal document that serves as proof for the transaction.
  • All conditions of the transaction are mentioned in the contract and must be fulfilled by the involved parties.
This was the basic idea and revision of the concept of a contract. Now, I will introduce a smart contract in the next section.

Smart Contract

When reading about blockchain and decentralized applications, you must have encountered the term “Smart Contract”. The name may indicate to you that it could be a contract that executes smartly or that has smart conditions. Well, in actuality, it is a contract whose conditions fulfill when it executes. If the conditions of such a contract are not met, then the execution fails.
  • In the Ethereum blockchain, a smart contract is actually a program that is deployed on Ethereum.
  • The smart contract contains logic and it is written in some high-level language.
  • An example of a high-level language is solidity that we will discuss in the upcoming tutorials.
  • A smart contract is a set of rules that are coded in the form of a program. These rules govern the transactions between the Ethereum accounts. The transaction could be a transfer of assets, transfer of money, or a change of Ethereum state.
  • In Ethereum, the type of account having a smart contract is called “Contract Account”.
  • Smart contracts can have balance and can also store data. They contain several functions that can be called by other accounts.
I have told you earlier that only an externally owned account can initiate a transaction on Ethereum and call a smart contract. Once initiated, the smart contract can call other smart contracts deployed on Ethereum or it can deploy a new contract.

Writing Smart Contracts

In this part of the tutorial, we are going to discuss writing smart contracts for Ethereum. Various tools are available for writing smart contracts. First, let’s talk about Remix.

Remix

  • The remix is an Integrated Development Environment for writing smart contracts.
  • It is a browser-based IDE and helps in developing contracts easily.
  • The language used is Solidity.
  • It helps in the following functions:
    • Writing and developing smart contracts
    • Deploying contracts on Ethereum networks
    • Troubleshooting contracts
  • A remix is an open-source tool available freely for everyone. So, if you are not comfortable using the online version, you can simply download it and use its functionality.
  • The downloaded version can be used offline on a local computer system.
  • The general steps for writing a smart contract using the online tool are given below:
    • Open your browser and type https://remix.ethereum.org/ in the address bar.
    • The site will show some default contracts. You can use that, study that or you can simply delete that if not needed.
    • On the left bar, there would be an option to create a new file. Use that to create your smart contract.
    • Write the code for your smart contract in the newly made file.
    • The next steps are to compile the contract using a solidity compiler and deploying it on the network.
    • After deployment, the functions written in the contract code can be executed.
This was a brief introduction to remix. Let’s talk about Solidity now.

Solidity

  • Solidity is a high-level programming language used for writing smart contracts.
  • This language has similarities with C and JavaScript languages.
  • Solidity is case-sensitive.
  • The extension of a solidity file is .solc and this file contains code.
  • You can write and read such a file in any text editor.
  • The solidity compiler is used for the compilation of code and named “solc”. The compiler generates the bytecode of the smart contract.
  • This bytecode is generated for the Ethereum virtual machine as it cannot understand code in the high-level language.
  • You can install solc using npm by typing the following command in the command prompt.

npm install –g solc

Remix and Solidity are the two essential tools for writing smart contracts. In the next part, we will discuss the deployment of contracts.

Deploying Smart Contracts

The contracts are deployed after compilation. The solidity compiler performs this task and generates two main outputs that are listed below:
  1. ABI
  2. Bytecode
Now let’s explore these two concepts.

ABI

  • ABI stands for Application Binary Interface.
  • ABI of a smart contract contains a declaration of all public and external functions. It also contains their parameters and returns types.
  • ABI is the definition of a contract. Any account that wants to execute a contract function uses its ABI.
  • After deployment, the contract instance is created using its application binary interface.

Bytecode

  • The bytecode is understandable by Ethereum and helps in deploying the contract on the Ethereum virtual machine.
  • Ethereum virtual machine cannot understand solidity so bytecode is a must.

ABI definition and bytecode both are necessary for deployment. The transaction for deploying a contract on EVM takes place and an address is generated for the smart contract. This address is the identifier of the contract. Any function of the contract can be called and executed using the contract address.

So, guys, this was all about smart contracts. We discussed the main idea and some steps to create a smart contract. The two main tools for creating a contract are also discussed in this tutorial. I hope you have learned these concepts and enjoyed reading them. That’s all for today. Take care and have fun.

dApps: Definition, Features, Comparison & Developing Tools

Hello friends, hope you are doing fine and enjoying your life. In today’s article, I am going to discuss decentralized applications that are abbreviated as dApps. With the invention of blockchain technology and afterward Ethereum, the idea of decentralized applications has gained a lot of attention. So let’s get into the details and learn what a dApp is.

Decentralized Applications (dApps)

 
  • An application built on a decentralized platform such as Ethereum is called a Decentralized Application(dApp).
  • A dApp generally consists of a backend and a frontend.
  • The backend of a dApp is a smart contract mostly written in solidity language.
  • The front end of a decentralized application is the user interface. The user can interact with the application using the frontend.
  • Smart contracts available on Ethereum are open for anyone. So, a dApp can use the smart contracts present on Ethereum other than its own backend.
  • Now l am going to give you the similarity and differences between a centralized application and a decentralized application in the next section.

Centralized vs Decentralized Application

In the traditional internet system, there is a central server and various computer systems connected with it. The backend program of centralized applications runs on that central server. While in decentralized applications, the backend program runs on a decentralized network. I have discussed the decentralization concept in my previous articles.

The front end of a centralized application can be written in various languages such as HTML. The front end of the application connects the user with the functionality of the backend. Similarly, in decentralized applications, the front end can be written in any programming language and that will help the user in interacting with the backend.

In the upcoming section, I am going to discuss smart contracts. We have already discussed them before. So we will try to make a connection of a dapp with smart contracts.

Smart Contracts

  • A smart contract is simply a program that is controlled by its logic.
  • The logic given in the code controls the execution of the smart contract.
  • It is deployed on the Ethereum network by an account.
  • The backend of a dApp is written in the form of smart contracts. Thus, smart contracts control the execution of a dApp.

Features of a dApp

In this part of the tutorial, I will talk about the characteristics of a DApp that make it so useful. These are listed below:

Decentralization

  • As a dApp runs on a decentralized platform, it is independent.
  • No central authority controls it. A dApp is controlled by the backend logic.

Deterministic

  • The output of the dApp is known. It will always produce the same result with the same conditions.

Open Source

  • The dApps are open source and available for anyone. The dApp’s operation is autonomous.

Transparency

  • Dapps provide transparency, trust and audibility. The data is secure and accessible to anyone.

Turing Compatibility

  • As Ethereum is Turing complete, a dApp on Ethereum is Turing compatible.

Isolation

  • All dApps on Ethereum virtual machines are executed independently in a virtual environment.
  • Any errors in one code do not break the functions of the rest of the network.

Privacy

  • While using or deploying a dApp, the user does not have to provide his real identity and that helps in privacy.

Data Integrity

  • Data is secure and immutable in dApps. No hacker or malicious entity can change the data.

No Downtime

  • When a decentralized application is deployed on the peer-to-peer network, it is available for everyone.
  • Not like traditional systems, where a failure in the central server makes the app unavailable.
These are some features of a decentralized application. Along with these features, some other points make Ethereum dApps different and usable. I am listing some of those exciting features below:
  • A dApp is uncensored as no party has control over it.
  • A dApp is able to create digital assets.
  • A dApp can create a new currency.
  • A dApp allows you to use the functionality of decentralized systems in any application.
  • Any node can use a dApp and connect to the Ethereum network.

Tools for Developing dApps

A variety of tools are available for developing dapps. Some of them are listed below:
  • Programming Language
  • Web3 Library
  • Development Frameworks
  • Integrated Development Environment
  • Blockchain
  • Ethereum Network
  • Wallet

Programming Language:

  • A programming language for writing smart contracts is needed while developing a dApp.
  • The most common one is solidity.
  • Vyper and LLL are two other options for writing contracts.

Web3 Libraries:

  • Web3 library provides an interface for interaction with Ethereum nodes. They are available in different language options. Such as web3.js and ethers.js for javascript and web3.py for python.

Development Framework:

  • The development framework helps you in performing operations such as compilation, ABI generation and testing etc.
  • The most common development framework is Truffle. It is node-based and the most used one.

IDE:

  • IDE or Integrated Development Environment also helps in dApp development.
  • The Remix is an online IDE that you can use from your web browser. It is the most convenient option.
  • You can also use the Visual Studio extension for solidity.

Blockchain:

  • While testing your dApp, you need some development blockchain where you can quickly deploy your contracts and test them.
  • Ganache is the tool for that facility. It creates a local blockchain on your system.

Ethereum Network:

  • While working on the dApps, you have the option to deploy it on the network of your choice.
  • For example, while testing you can use the test network.
  • There is no value of ether on the test network, so you can easily test your dApp.
  • Ether has value on the main Ethereum network, named Mainnet.

Wallet:

  • A wallet is a software application that is used for keeping track of the balance and managing keys.
  • Various wallets are available with different functions and security levels. The common one is Metamask, a web-based wallet.
These are some of the tools that you need for developing a dApp. With that, I am concluding this article. I am hoping you have got some good information from this tutorial. Let me know if you have any queries. Take care, bye!

Ethereum Wallet: Definition, Working and Types

Hello friends, hope you are doing good and enjoying your life. Today, I am going to introduce you to the Ethereum wallets. I have given you an introduction to blockchain, its characteristics, and an introduction to accounts in my previous tutorials, so let’s get started with today’s tutorial on Ethereum wallets.

What is Ethereum Wallet???

In this section, I will introduce you to the Ethereum wallet and then we will move into its further details.
  • A blockchain wallet is just like a real-life wallet but in software form. It is the digital form of a wallet.
  • A wallet is application software that acts as a user interface to the Ethereum network.
  • The wallet is a system to manage and store the keys.
  • This digital wallet allows transferring cryptocurrencies from one account to another.
  • The functions that can be performed by using a wallet are:
    • Access to your money
    • Access to accounts
    • Management of keys
    • Management of addresses
    • Management of cryptocurrencies such as bitcoin or ether
    • Tracking and viewing the user’s balance in different accounts
    • Initiating transactions
    • Signing transactions
    • Interacting with contract accounts
This was some basic idea of wallet technology. Let’s move towards an important feature of wallets i.e., key management in the next section.

Key Management in Ethereum Wallet

  • The actual function of a wallet is managing keys.
  • If you think that your wallet will contain money then it is not true. You can view your balance via your wallet but this balance is actually residing on the Ethereum blockchain.
  • Your wallet contains keys (both private and public) and by using these keys, you can sign transactions on Ethereum.
  • To transfer ether or any cryptocurrency to other accounts, you need keys stored in your wallet.
  • In centralized systems such as banks, your money is saved under your account. You can check the account balance and perform transactions with the involvement of banks. While in the blockchain you can control your money with your wallet yourself.

Ethereum Wallet Design

  • While designing or choosing a wallet, two factors are considered that are convenience and privacy.
  • There is always a trade-off between the two.
  • With more convenience comes privacy issues and with strict privacy, convenience is compromised.

Types of Wallet

The wallets are classified into two main types depending upon the relationship between the keys they hold. These types are given below:
  1. Deterministic Wallet
  2. Non-deterministic Wallet
Now, I will explain these types a little bit. The first one is the deterministic wallet.

1.      Deterministic Wallet

  • In this kind of wallet, all wallet keys are generated from a single key.
  • This single key is called the master key and it is derived from a seed.
  • All of the keys are related to each other. Here, the original seed value is very important.
  • These keys can be generated again with the use of seed value.
  • Commonly, these keys are linked in the form of a tree structure where the root is the seed value.

2.      Non-deterministic Wallet

  • The second type of wallet is a non-deterministic wallet. In this kind, the keys are not related to each other.
  • Each key of such a wallet is generated independently from different seed values.
  • This wallet is also termed a random wallet and it is better than a deterministic wallet in terms of security.

Mnemonic Words

  • There is a concern about security in deterministic wallets as all keys are related.
  • If anyone gets a hold of the seed value, he can generate the master key and then all other keys of the wallet. It will give access to the balance.
For unfortunate data loss accidents, when a person loses his seed, the seed value is converted to mnemonic codewords. The mnemonic code words are a bunch of English words that the wallet holder has to keep safe. This word list can be saved in the form of a hard copy by writing that on a piece of paper and then storing it in a secure place. This concludes the section here. I will now discuss different wallet applications available for you in the next part.

Different Forms of Wallet

There are different kinds of wallet applications for you to select from. The interesting thing about wallets is that you can switch from one type of application to the other. If you do not like the wallet that you are using, you can change your wallet easily and there is no loss in doing so. All the funds in your current wallet would be transferred to the new wallet. Your keys would be moved from the old wallet to the new one. The wallet applications are classified into three types that are listed below.
  1. Mobile Wallet
  2. Desktop Wallet
  3. Online Wallet
  4. Hardware Wallet
  5. Paper Wallet

Mobile Wallet

  • A mobile wallet is simple a phone application.
  • You install the wallet application on your mobile phone and then access your account.
  • These wallets can be used anywhere and are safer than online wallets.
  • The only problem arises when there is a phone breakdown when you can lose your money.

Desktop Wallet

  • A desktop wallet is also a safer option than online wallets.
  • You can download a desktop wallet on your personal computer and access it anytime from the same device.
  • The issue with this type of wallet arises when your desktop gets out of order, gets hacked, or is infected by a virus.

Online Wallet

  • An online wallet is a convenient option to use.
  • It can be opened anywhere from any device having an internet connection.
  • These wallets reside on the cloud. Online wallets have higher security issues and can be used wisely.

Hardware Wallet

  • In this kind of wallet, the keys are stored on some hardware device such as a flash drive.
  • The hardware wallet remains offline mostly which provides security features.
  • This wallet is a convenient and safe option although expensive among others.

Paper Wallet

  • The last type of wallet is a paper wallet. This is the safest option among all options.
  • The public and private keys are written or printed on a sheet of paper to make a physical copy and that copy is called a paper wallet.
  • The transactions are done by entering private keys or you can also scan the QR code of your paper wallet.
These were the types of wallet applications and you can choose any of them depending on the features you prefer the most. So, guys, this was all about wallets. I hope you have learned something new from this article. That was all for today, Take care!

Ethereum Accounts: Definition, Types and Fields

Hello friends, hope you are doing good and enjoying your life. Today, I am going to introduce you to Ethereum accounts. I have given you an introduction to blockchain in my previous tutorials, so let’s get started on the essentials of this technology. I am going to start with accounts.

Ethereum Accounts

  • An account is an important component of the Ethereum system.
  • It is the main building block and has a balance in ether (ETH) (Ethereum currency).
  • An account is capable of sending transactions on the Ethereum network.
  • The interactions between different accounts create transactions that are stored in the distributed database.
  • Each transaction involves the sender account, receiver account and contract account.
  • An account can be controlled by a user or it can be a program deployed on the Ethereum blockchain.

Types of Ethereum Accounts

In this section, I am going to describe the two types of accounts in Ethereum, namely externally owned and contract.
  • Each account has a balance property that shows how much balance the account currently holds.
  • Therefore, accounts are classified into two main types:
    1. Externally Owned Accounts
    2. Contract Accounts

Externally Owned Accounts

  • Externally Owned Account is abbreviated as EOA. This is the type of account that is owned by people on the Ethereum network.
  • An individual makes an account on Ethereum and a public-private key pair is generated for the account. The account is not identified by the person’s name or any personal information.
  • The private key of EOA gives control and access to one’s assets and contracts. The private key is kept secured by the user.
  • While, as the name suggests, the public key of the account is open. This key acts as the identity of the account.
  • The public key is generated from the private key via a one-way cryptographic function.
  • As an example, if you create an account on Ethereum, you will keep the private key to yourself while the public key would be shared. Transactions between accounts are carried out through public keys.
  • The address of an Ethereum account is generated through its public key.
  • This type of account interacts with other externally owned accounts and contract accounts. It carries out transactions with the former one and interacts with the latter one by calling and executing its functions.
  • This type of account has no code. It has balance in ether.
  • Now, let’s talk about the second type of Ethereum accounts.

Contract Accounts

  • In this section, I am going to tell you about the second type that is contract accounts.
  • In some ways, contract accounts are similar to externally owned accounts but there are some differences between them too that I will mention later.
  • First, let’s define a contract account. A contract account has a code for a smart contract.
  • The contract account is identified by its public address.
  • This account does not own a private key.
  • These accounts also have balance property and they can hold ether too but these accounts have smart contract code. This code contains functions to execute and state variables.
  • The logic of the smart contract controls this account. The smart contract that is deployed on the Ethereum blockchain is the owner of the contract’s account.
  • When an externally owned account initiates a transaction with a contract account, the code of that contract runs in Ethereum virtual machine. The transaction contains data other than ether that tells information about what functions to run and what parameters should be given to the functions for execution.
This was some introduction to both accounts. Now, I am going to highlight some key differences and similarities between these two types.

Difference in Externally Owned Account and Contract Account

  • An externally owned account (EOA) does not have a code while a contract account has a code.
  • Externally owned accounts have a private key associated with them that contract accounts do not have.
  • An externally owned account can initiate a transaction with another externally owned account or a contract account. But a contract account cannot initiate transactions.
  • A contract account responds to transactions and in doing so it can call further contracts and their functions.
  • Transaction between two EOAs is only of one kind that is the transfer of ether while transactions with a contract account can be of any kind, for example, calling other contract’s functions, deploying another contract, etc.
  • An externally owned account is free to create while creating a contract account has a cost.

Similarities in Externally Owned Account and Contract Account

  • Contract and externally owned accounts both are identified by their public addresses.
  • Both types of accounts can have a balance and are capable of sending and receiving ether.
  • Both of these accounts can interact with smart contracts deployed on Ethereum.
This was a comparison between externally owned and contract account. In the upcoming section, I am going to tell you about the components of an account.

Fields of an Ethereum Account

Any Ethereum account, whether an EOA or a contract account contains four fields which are given below:
  1. Nonce
  2. Balance
  3. CodeHash
  4. StorageRoot
I am going to give you an introduction to each of them. The first one on the list is Nonce.

Nonce:

  • The nonce of an account is actually a counter that tells us about the number of transactions sent from that account for an externally owned account.
  • While, for a contract account, this counter indicates the number of contracts created by that account.

Balance:

  • This property shows the balance of the account as the name suggests.
  • The balance is actually in Wei, a unit of ether (ETH) where 1 eth = 1x10e18 Wei.

CodeHash:

  • This field gives the hash value of the contract code of the account.
  • In the case of contract accounts, the smart contract code is hashed and the resulting value is stored in this field.
  • While for externally owned accounts, this field contains the hash value of an empty string.

StorageRoot:

  • The data of an account is stored in the world state trie.
  • Each leaf of this trie represents one account.
  • The storageRoot contains the hash value of the root of the storage trie.
  • This field of account is empty by default.
These are the four fields of an Ethereum account. I hope this article has given you an understanding of Ethereum accounts. I will bring another interesting topic next time for you. Till then, take care!

Blockchain Mining: Definition, Process, Pooling & Miners

Hello Friends, Hope you are doing fine and having fun in your lives. In my previous tutorials on blockchain and Ethereum, I have talked about mining a few times. So, in today’s article, I am going to discuss the concept of mining with you. This is an important part of learning the working of blockchain to see how the decentralization of blockchain happens. Let’s start today’s article by defining mining.

Blockchain Mining

  • As blockchain is a peer-to-peer network. Mining is also a peer-to-peer process.
  • Blockchain (or Ethereum) mining is used to verify transactions on the network.
  • In this process, miners (the person or node who performs mining) add transaction records to the decentralized distributed ledger of the blockchain.
  • The transactions are added to the blocks, and the blocks are secured and linked after mining in the form of a chain.
  • Mining requires computational power and effort from miners. And basically, it is the process of adding blocks.
  • In this way, the transactions get confirmed and money and assets move from one account to another.
This was the idea of mining. In the next part, I am going to define the miner and discuss its role in the Ethereum blockchain network.

Blockchain Miner

  • As defined earlier, a miner is a person or computer that performs the mining process.
  • Miners provide their time, efforts, and computer resources for mining and serve the blockchain system.
  • As a reward for their contribution, miners get transaction fees. The sender (or initiator) of the transaction pays this fee to the miner.
  • A miner adds a number of transactions in the new block and collects the transaction fee for each of them.
  • Any person can become a blockchain miner. A blockchain mining software needs to be installed and executed by the miner. This allows them to communicate with the blockchain network.
  • A computer performing this process then becomes a node. The nodes interact with each other to collaborate for verifying transactions.
This was all about the miners and their importance. Now, I will explain the idea of decentralization in the context of mining in the upcoming section.

Mining and Decentralization

I have discussed the concept of decentralization in previous articles. Decentralization means no central server or no central authority to manage and control the data. An example of centralization is our traditional banking system. And an example of decentralization is blockchain. Decentralization is related to the mining process. Miners contribute to the blockchain system by providing their computing powers in verifying the blocks of transactions. This verification process is mining and it eliminates the need for a central entity. The agreement of everyone on the state of the Ethereum network is essential for this system. Miners make this possible by solving the blocks and this increases the trust and security in this system. The decentralized process and consensus happen from these four processes.
  • Each transaction is verified by every node independently. The verification is done based on complete criteria.
  • The addition of these verified transactions into new blocks by miner nodes independently. The addition is done with a computation via a proof of work algorithm.
  • The new blocks are then verified by all nodes independently. The next step is assembling these blocks into the chain.
  • The selection of the chain having computation via proof of work, by every node independently.
In the next part, I will discuss the step by step process of mining via nodes.

Mining Process

For explaining the procedure of mining in steps, let’s start with the transaction generation.
  1. The first step is the initiation of a transaction by an account.
  2. A person (an externally owned account) starts a transaction by providing all the necessary data and then signing it via his private key.
  3. The transaction is transmitted to the Ethereum network via some node requesting to be confirmed by miners.
  4. When nodes of the network get a request from a transaction, they add that unconfirmed transaction to the pool of other such transactions.
  5. All unconfirmed and unadded transactions will wait in that pool.
  6. Any miner starts the process of mining by adding hundreds of different transactions in its block. More number of transactions means a more rewarding fee for the miner.
  7. The miner verifies each transaction in its block and executes any code with it.
  8. The miner would change the state of the Ethereum virtual machine and produce the proof of work certificate for its block.
  9. The miner also produces a checksum of the new Ethereum virtual machine (EVM) state.
  10. When the computation is complete and a certificate has been produced for the block, it would be transmitted to the network.
  11. When other nodes receive the new block, they check the authenticity of the block certificate.
  12. Then execute all transactions included in the new block and check the state of the Ethereum virtual machine.
  13. They produce a checksum of their EVM state and match it with the checksum of the EVM state provided by the miner.
  14. If the checksum matches, the new block is added to the blockchain. The resulting EVM state is accepted as the new state.
  15. The transaction confirmed via a new block is then removed from the pool of unconfirmed transactions.
  16. Every new node that joins the blockchain network downloads the complete blockchain starting from the genesis block.
  17. Each transaction of every block is executed again until the final state of EVM is obtained. This state matches with the EVM of all other nodes.
  18. In this way, transactions get verified again and again increasing trust and security features.
So, guys, this was the process of mining. I tried to make this easy to understand for beginners. Before concluding this article, I want to introduce you to another concept related to mining and that is “Mining Pools”.

Mining Pool

  • With time, the mining competition has been increased.
  • Mining a block requires a lot of electricity and hardware resources and the likelihood of successful mining is very low.
  • Therefore, miners now group and work together in mining pools where they share their resources and also the reward.
  • In this way, everyone gets something out of their input.
In conclusion, I hope you have got an idea of how mining works from this article. Next time, I will present another new concept to you. Till then, take care!

Ethereum Blockchain: Definition, Currency, Working & Components

Hello friends, Hope you are doing good. In my last tutorial, I gave you an introduction to blockchain technology and this article is the second one of this series. Today I am going to talk about Ethereum. In simple words, Ethereum is an open-source platform of blockchain technology. But unlike the bitcoin blockchain, it offers more functionality. The blockchain in bitcoin tracks bitcoins only. It tracks the ownership and transfer of bitcoins. While Ethereum is not only a payment network for cryptocurrency but also termed as the world computer due to its wide functionality. First, let’s go through the key introductory points of Ethereum, and then we will dive into the details:

What is Ethereum Blockchain?

  • Ethereum blockchain is an open-source global platform that supports decentralized applications.
  • It offers a programmability feature, coding is done in smart contracts.
  • It runs its own currency named Ether and is abbreviated as ETH.
Now let’s take a look at its invention history, and then I will talk about its features in the next sections.

History of Ethereum

In this section, I will give you an idea that how Ethereum was invented and why there was a need of developing such a platform. When bitcoin was invented and people realized the power of blockchain, developers tried to design new applications other than cryptocurrency. The limited functionality of the existing blockchain made it difficult to build different types of projects and hence, arose the need for a new blockchain.

In 2013, Vitalik Buterin presented a white paper giving the idea of the Ethereum blockchain. Afterward, Vitalik and Gavin Woods worked together and built upon that idea. And guys, finally in 2015, the first block of the Ethereum blockchain was mined. So, this was a little history and now before getting you bored, I will move towards the next section explaining the programmability of Ethereum.

Ethereum Programmability

  • The main function of Ethereum is that it is programmable, which means applications can be built on it.
  • It is a general-purpose blockchain capable of executing code.
  • The language offered by bitcoin was very limited with limited data types and size, but this is not the case with Ethereum.
  • Ethereum is also called Turing complete and I will explain the concept of Turing completeness in the upcoming sections.

Working of Ethereum Blockchain

I am going to tell you about the working of Ethereum Blockchain in this section.
  • The memory in Ethereum stores data and code.
  • The Ethereum blockchain tracks the changes in data and thus it tracks the changes in its memory.
  • Ethereum first loads the program, executes it and finally stores the results in its blockchain.
This procedure is the same as in the computers that we use in our daily life. The difference is that the data in our computer is stored locally while in Ethereum blockchain, the changes in state are distributed and each node has data stored in it. Also, the changes in data are according to the consensus rules. The process can be summarized as:
  • Accepting transactions from different nodes or accounts.
  • Updating the state for accepted transactions.
  • Storing and maintaining the state in its memory.
  • The states are maintained until another accepted transaction happens.
  • This process is repeated for each change.
Now let’s list down some main components of ethereum technology. I am going to give you a simple definition of each one for a basic understanding.

Components of Ethereum Blockchain

The components of Ethereum are given below:

Peer to peer network:

  • Ethereum blockchain is a peer to peer network, all computers or nodes are connected with each other.

Nodes:

  • Any device whether a computer or a mobile, connected to the blockchain containing the data are called nodes. All nodes are connected to each other.

Transactions:

  • The messages exchanged on the network are called transactions. A transaction involves a value, a recipient, a sender, and a data payload.

Consensus Rules:

  • The set of rules that is followed for considering the validity of a transaction and a block in Ethereum I called consensus rules. These rules are enforced by all nodes.

Consensus Algorithm:

  • The consensus algorithm is the procedure to obtain agreement on the longest chain in the distributed Ethereum network. The most commonly used consensus algorithms for Ethereum are proof of work and proof of stake.

State Machine:

  • Ethereum transactions and state changes are processed by the state machine called Ethereum Virtual Machine abbreviated as EVM.
  • Ethereum virtual machine executes the program in machine language.
  • These programs are written in a high level language such as Solidity and then a compile converts the program into bytecode.
  • The program written in a high level language is called a smart contract.
So, these were some components and terminologies associated with Ethereum Blockchain. Next, I am going to introduce the cryptocurrency that Ethereum uses.

Ethereum Currency: Ether

The cryptocurrency used on the Ethereum blockchain is ether (ETH). This cryptocurrency acts as fuel for the execution of smart contracts. This currency is integral and users pay it for using the Ethereum network. The purpose of this currency is:
  • Storing value.
  • Allowing users to perform transactions by exchanging payments.
  • Allowing payments for computational costs of code execution means each transaction executes by paying a small transaction fee.
  • Running applications (Decentralized Applications).
At the time of writing this article, the currency is worth 2355.44 USD. That was some basic idea of the ether, now let’s move towards smart contracts.

Smart Contract

  • A program that executes on Ethereum is called a smart contract.
  • It is a set of rules or codes that control the transfer of value according to programmed conditions.
  • One feature of a smart contract is immutability. Immutability means that the code of a smart contract cannot be changed after its deployment.
  • Smart contracts are deterministic. The outcome of the smart contract execution is the same for anyone running it.
Before concluding this article on Ethereum introduction, I will give you an idea of Turing completeness as I mentioned earlier.

Turing Completeness

  • Ethereum is a Turing complete system.
  • Ethereum can read and write data to memory and execute programs in the Ethereum virtual machine.
  • It can compute any program that a Turing complete machine can.
  • The main difference provided by Ethereum is that it combines computing power with blockchain.
  • All of the characteristic features of blockchain are combined with the programmability feature and that makes Ethereum a useful invention.
That was all for today. I hope you have got an idea about Ethereum. Next time we will move towards the interesting features of this technology and also we would talk about dApps in upcoming articles. Till then, take care!
Syed Zain Nasir

I am Syed Zain Nasir, the founder of <a href=https://www.TheEngineeringProjects.com/>The Engineering Projects</a> (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. <a href=https://plus.google.com/+SyedZainNasir/>My Google Profile+</a>

Share
Published by
Syed Zain Nasir