Ethereum Blockchain — concepts and terminologies

In enterprise level, there is so much happening around the Blockchain Technology. Rather than getting into the concepts of blockchain and blockchain use cases what should we know to start to develop the web or mobile applications using Ethereum platform

This article is more for the people who want start on Ethereum blockchain. It is an introduction part for the series of articles on Ethereum Dapp development.

Terminologies we need to understand on ethereum blockchain environment

  1. Ethereum Client
  2. Mist Wallet
  3. Accounts
  4. Smart Contracts and solidity Program
  5. Web3js and RPC protocols
  6. Miners
  7. Transaction and Block
  8. Front End Development.

All of these will play the role to develop any application on top of the Ethereum Blockchain

Decentralized + Application = DAPP

Ethereum Client

To create or to connect to a Blockchain we need ethereum software. Running the Ethereum software will only create the blockchain. But to connect to the blockchain we need some client software.

For example connecting to WiFI, you device is connected to the internet. To interact with the internet we need any Client browser(Chrome, Firefox), or any other apps(Like FB, Instagram)

There many types of client software which are written in many programming languages https://www.ethereum.org/cli But most popular is Geth software, Which is the go programming implementation of Ethereum. In this article, I’m taking the Geth client. Install the software using the instructions from above link.

Mist Wallet

Mist wallet is the software we can use to connect to the blockchain network using the well-designed UI page. We can use this software to connect with multiple blockchain networks(Private, Public). You can create accounts from this, you do the transaction from one Ethereum account to another ethereum account. It indirectly runs on Top of the Ethereum client software. We can deploy contracts in this software also. We will see what is smart contracts later in this article

For Example, It is like the Chrome Browser. Your machine is connected to the internet. Using this UI, we can use multiple internet banking accounts to send and receive any transactions.

Accounts

To do any transactions in out internet banking we need our user id and password. In ethereum blockchain also we have similar concepts.

Our user id is our blockchain public address, 40 hex characters. cd2a3d9f938e13cd947ec05abc7fe734df8dd826

And our password is our private key, To access your account you need your private key, every transaction is validated with your private key. Like in internet banking we need the IPIN. If you it, you lose everything.

To add that, in blockchain you can create as many accounts you want at free of cost. Now you may have doubt many accounts can be created in a blockchain network.

Possible Number of accounts in a networks is 1.46x10⁴⁸ or 2¹⁶⁰. This is huge right. There is no possibility is someone creates another ones same address. It is completely achieved through Cryptography. You public address is directly linked with your private key. Every transaction you do on blockchain is encrypted with your private key. Using that blockchain validates your transaction.The following is the ways of public address is created.

  1. Create a random private key (64 (hex) characters / 256 bits / 32 bytes)
  2. Derive the public key from this private key (128 (hex) characters / 512 bits / 64 bytes)
  3. Derive the address from this public key. (40 (hex) characters / 160 bits / 20 bytes)

Even though a lot of people call the address the public key, it’s actually not the case in Ethereum. There is a separate public key that acts as a middleman that you won’t ever see.

Start using the ethereum clients, to create multiple accounts. Otherwise get some knowledge to get use the ethereum clients, create some accounts using the CLI.

Smart Contracts and solidity program

The smart contract is the piece of code which is having storage capability running on the blockchain. In client-server model whatever code we write is running on the single server. But in the blockchain, it is a collection of servers(Ethereum nodes). In our deployed code in a traditional server, we will be having the endpoints to interact.

nodes=”Ethereum Clients”

But in ethereum smart contract, if we deploy a smart contract in the blockchain. It can access through all the nodes connected. All the connected nodes virtually create the EVM(Ethereum virtual machine) the codes is deployed and an address is created for the code. We can use the smart contract address to interact with it.

If it is a single node, EVM lies within it. If any other nodes connected to the network. A shared EVM is created between the nodes. If a node is disconnected, still the single node have the access to the EVM. Everything is managed by the ethereum network protocols. The eth protocol maintains the status and connectivity between nodes and availability of the EVM across the nodes.

How a smart contract code will look like?

Like any other coding, the smart contract is written in solidity programming language. Solidity language

Simple Storage Smart contract. It is having the functionality to store and retrieve a number.

pragma solidity ^0.4.0;

contract SimpleStorage {
uint storedData;

function set(uint x) {
storedData = x;
}

function get() constant returns (uint) {
return storedData;
}
}

How to deploy the smart contract to the blockchain. In traditional servers, we simply copy past the code in the server and start the server. In terms, the code can be HTML, JS, CSS or war files. In blockchain, a byte code needs to be created to deploy.

Go the solidity compiler in the browser using, browser solidity.

byecode:

606060405260a18060106000396000f360606040526000357c01000000000000000000000000000000000000000000000000000000009004806360fe47b11460435780636d4ce63c14605d57603f565b6002565b34600257605b60048080359060200190919050506082565b005b34600257606c60048050506090565b6040518082815260200191505060405180910390f35b806000600050819055505b50565b60006000600050549050609e565b9056

ABI(Application Binary Interface):

[{"constant":false,"inputs":[{"name":"x","type":"uint256"}],"name":"set","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"get","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"}]

This is the code we deploy to the blockchain.

How to deploy the code to blockchain ?

In the traditional way, we use some porting tool to move our code from local machine to server. like WINSCP tools. But in the blockchain, we can do that using the Ethereum clients like geth.

Here we use a tool called web3.js, which will be used to deploy the code. We can see that in web3js topic.

Web3js and RPC protocols

We know that we can interact with blockchain by using the Ethereum Geth clients(terminal).

It is the terminal level access, we can use terminal commands to create accounts, getBalances, deploy contracts and interact with contracts. But when we start develop real world end user web or mobile applications we need nice UI on the front which needs to speak with the Blockchain network.

Web3js is a channel to run the ethereum commands from the front end code or from backend code to interact with the blockchain.

All the terminal level commands are available through web3js which should connect to anyone of the Ethereum nodes. But while starting the node we should give permission to connect through web3 channel by passing the corresponding configuration.

How to connect a webjs to the running ethereum node.

First we need to include the web3js node_module, then include the code below

import Web3 from ‘web3’;
if (typeof web3 !== ‘undefined’) {
web3 = new Web3(web3.currentProvider);
} else {
// set the provider you want from Web3.providers
web3 = new Web3(new Web3.providers.HttpProvider(“http://34.207.18.159:8545"));
}

see the web3js documentation.

Ethereum blockchain is running on Eth and LES protocols. But by enabling the web3 option we could be interacting with blockchain. But is done by rpc protocols.

Webjs runs on top of curl, rpc commands.

Miners

In blockchain, mining is an important concept. In ethereum blockchain, all the transactions are validated by the miners. Miners are nothing but an another ethereum node, we can simply make any node as the miner. By running miner.start() in ethereum console, your node act as the miner.

Every transaction we do on the network is validated by the miners. By miners new blockchain are created and added to the chain of data.

Even smart contracts need to be mined, then we will get the contract address. Also if we do some calculations and changing some state of the smart contracts by storing some value, it will be considered as transaction it needs to be validated by miners. But getting the value from the blockchain is ned not be mined.

Transaction and Block

Everything we do in blockchain is considered as transaction except accounts and getting data from the smart contract. If we do a transfer of ether from one account to another it is considered as a transaction, if it is validated by miners then the balances of corresponding accounts get updated.

Even in smart contracts, if we set some value in smart contract storage it needs to validated by miners because it is considered as a transaction. Every transaction will have the transaction hash. We can get the entire transaction details by anytime using the transactionReceipt command by passing the transaction hash.

Miners will take transactions from the unconfirmed pool, do the math by creating transaction root hash by merging all the transaction message hashes. Once the math is solved it is considered as the next block then it is added in the chain.

Front End Development

we discussed everything in terminals and JSON RPC channels. But to develop the application we need the front end part. The front can be built on any of the frameworks like Angular, React, Meteor. But all will connect with blockchain using the web3js API.

There are some frameworks which helps the team to start the application Dapp boilerplates codes. They are

1. Truffle Framework
2. Embark Framework
3. Dapple

Each gives more features to start develop the applications on top of the blockchain. It contains the UI, smart contract compilation and deploying to the network with one time configuration. Writing test scripts to test of solidity code.


Please hit that heart button if you feel good about this — thanks!

Like what you read? Give Seetharaman Gr a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.