All about the ETH Blockchain

Ethereum Blockchain

The Ethereum Blockchains took a major step towards transforming the blockchain into a computational framework that opened up a whole world of opportunities in the decentralized realm.

Ethereum supports smart contracts and a virtual machine on which these smart contracts execute.

The Smart Contracts enabled decentralized application that accomplished more than a transfer of value.

Since, Smart contracts are pretty much important when it comes to Ethereum Blockchain. Let’s talk some more about Smart Contracts.

Smart Contracts

A Smart contract is a piece of code that are deployed in the blockchain node. The executions that are done in the smart contracts are initiated as a message and is embedded into the transaction.

As we know, some the simple digital currency transfer will have the value and some information of the sender and receiver. In Ethereum, it enables transactions that may carry out more sophisticated operations.

  • For Example, a transaction could require a conditional transfer or it may need some more signatures for transfer of assets, or it also may involve waiting for a specific time and date.
  • Let’s take an example for what Smart Contracts can do, Consider a Auction bidding system. If the age of a bidder is greater than 18 and the bid is greater than the minimum bid, then accept the bid, or else reject the bid. These things or the conditions can be easily done by a Smart Contract.

How do we write a smart contract?

The smart contracts are written using basic programming language which resembles a class definition in an object oriented design like java or C++, it has data, functions with modifiers and specifiers like public or private along with getter and setter functions.

There are some specific programming languages that are designed for coding smart contracts. Solidity is one example.

  • A simple Solidity program will contain the Solidity version as a header ex. pragma solidity ^0.4.0;
  • Contract definitions like the name of the contract and the variable declarations with the type.

ex, contract myContract { // myContract is the name of the contract

uint storedData; /* This is declared variable of type uint, uint is a data type that stores 32- bit unsigned integer */

}

  • Then at last two functions are defined for writing and reading the data i.e. Set and Get

Set, ex. function set(uint a) {

storedData=x; /* a simple set function which assigns value of x to storedData */

}

Get, ex. function get() constant returns (uint) {

return storedData; } } // A simple get function which reads the data stored in storedData

So, this is a simple illustration of a basic code of smart contract, I will try to write more about these smart contracts and its coding with solidity in my future posts.

Each Ethereum node in the network should be able to execute the code irrespective of what operating systems they use. For this, there is EVM i.e. Ethereum Virtual Machine, it provides run anywhere layer for the contract.

A Smart Contract which is written in high level programming language is converted to EVM byte code and then its deployed on the Ethereum network.

Structure Of Ethereum

ery type of transaction requires fees. An account must have sufficient balance to meet the fees which is needed for the transaction.

Fees are paid in Wei, 1 Ether= 10¹⁸ Wei or 1 Wei= 0.000000000000000001 Ether.

A transaction in Ethereum includes,

  • The Recipient of the message.
  • Digital signature of the sender authorizing the transfer.
  • Amount of Wei to transfer.
  • An optional message to a Contract.
  • STARTGAS : it is the value representing the maximum number of computational steps the transaction is allowed.
  • GASPRICE : it is the value of representing the fee which sender is willing to pay for the computations.

The Smart Contract execution incurs fees, the amount available is specified by the various gas fields.

THNAK YOU

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store