How does Ethereum blockchain work?

Not sure what is Ethereum or what is Ether? Read our complete guide about what is Ethereum and find all your questions answered.

If you want to know what is Ethereum, how it works, and what it can be used for, without going deep into the technical abyss, this guide is perfect for you.

Why Ethereum is not just another average cryptocurrency? Right now it is the second most famous digital asset and ETH actually can solve real problems.

Although Bitcoin and Ethereum are often mentioned together, in fact, they are very different. Their common feature is that they can both act as payment tools and are built on blockchain technology. However, apart from the role of the cryptocurrency (as Bitcoin), Ethereum has properties that make it a huge decentralized computer.

To understand how Ethereum works, first, we need to understand how blockchain works.

What is blockchain?

In short, it’s a distributed registry. It is an ever-growing database filled with certain information and has the following properties:

  • If data is recorded in a blockchain, it cannot be changed or deleted. Each entry remains in the database forever.
  • There is no single organization that supports and governs a blockchain. This is done by thousands of users, each of whom has its copy of the registry.

To understand the mechanism of synchronization of thousands of versions of the blockchain, let us use a simplified analogy. Imagine a team of 10 people. They all sit at the same table, and each has a file folder and a blank sheet in front of them. Every time someone performs any important operation (for example, transfers money to another person), he tells everyone else about it.

Each sitting person writes down the announcements on his or her own sheet until the sheet is filled. Once the sheet is full, the person puts it in a folder, solving a mathematical problem beforehand. The complete solution ensures that the entries on all sheets are the same and cannot be changed. The person who solved the problem first gets a bonus. The sheet is stamped to ensure that it will not be changed in the future.

After the page is placed in the folder, the participants take out new sheets and the process continues. Over time, sheets (blocks) containing important information (transactions) are added to the folder (chain), forming a database (blockchain). Blockchain can be used to store any type of data. Bitcoin blockchain stores data about financial transactions, allowing BTC to act as ordinary currencies like dollars or pounds.

Ethereum is not just a currency. It is a huge computer, although very slow — about 100 times slower than current average PC. Besides, it’s very expensive. The Ethereum computer is comparable in parameters to a cell phone from the 90s; it is only capable of very trivial and undemanding operations.

Many people will not find this description fascinating, so why is there so much hype around Ethereum? Exactly because it’s the first decentralised computer distributed around the globe. Let’s look at how the Ethereum blockchain works.

Inside of Ethereum blockchain

In the Ethereum network, a new block is created every 12–15 seconds and then saved forever in the blockchain. The data is then updated for all network nodes and cannot be changed by anybody from that moment on. Only a correct block is written to the blockchain.

The block header contains information about the previous correct block that was written to the blockchain. When one of the miners manages to find a new block, the information about its correctness is checked for compliance — it is checked against the blockchain. At the same time, transactions are checked as well. Correct transactions are written to the block and considered completed.

What is block hash?

A hash function is a mathematical function that works as an encoder. It converts any data string in such a way that it is impossible to know the original value from the result. The result of processing a hash function is called a hash or hash sum.

The hash function, which is used in the Ethereum mining, is called Ethash, and the value, which the miner is looking for, is a certain nonce number. Finding the correct nonce is essentially a quick search. The higher the computational power of a node, the more probable it is that it is the node that will find nonce the fastest and write a new block into the blockchain.

Thanks to this property the Ethex.bet lottery is provably fair. You are trying to guess the last symbols of the next block hash. Their generation is completely random, and no one can interfere with the process of creating hash functions.

The computational power of a node is determined by the hashrate, which is an indicator that shows the speed at which the device processes information and shows the number of hashes the computer finds per second. Users of the Ethereum network with a high hashrate are more likely to add new blocks and, accordingly, are more likely to receive a reward — ETH coins. The reward is distributed among the participants on a Proof-of-Work basis.

Ethereum Virtual Machine

As with any other blockchain, Ethereum needs its software to run on thousands of computers continuously. Ethereum Virtual Machine (EVM) is running on every computer (node) in the network. In fact, EVM is an operating system that uses a special programming language and executes specific programs. These programs are called “smart contracts”. In order for this huge computer to perform any operation, you have to pay, but not in dollars — in cryptocurrency of this system, ETH.

Both a person and a smart contract are users of the Ethereum network, as both are capable of performing the same function. Smart contracts behave in the same way as user: they can send and receive ETH. However, unlike people, smart contracts can also execute certain programs if needed. Let’s look at an example to understand what the power of smart contracts is.

The power of smart contracts

Imagine you’re making a bet for $100 about tomorrow’s weather with your pen-friend: he thinks tomorrow will be sunny and you think it’s gonna rain. The loser must give the winner $100. How do you guarantee that the loser will keep his word? Three ways come to mind:

Mutual trust

The easiest thing to do would be to rely on each other’s honesty. However, since you do not know each other and have never met in person, and the amount is not small, it is better to resort to a more reliable method.

Signing a formal agreement

It would seem that a solution has been found: you sign a formal agreement obliging the loser to pay the declared sum to the winner. You assure him and he calmly places his bet. In practice, in case of a conflict between the parties, you will spend a lot of time on trial and a lot of money on lawyers, which will make the whole process too long and expensive.

A trustee

And the third option — you could find a “common friend”, a reliable person, whom you both trust. The next day, he’d look out the window and give $200 to the winner. It’s as simple as that. But what if the trustee decides to steal the money?

When considering the three possible ways of making a deal about a dispute, it becomes clear that often the main drawback is the problem of trust between people, especially if they are two strangers who have never seen each other in real life.

This is where an Ethereum smart contract will come in handy. A smart contract is a “common friend”, the guarantor of the deal in the person of the executable code. Ethereum allows you to use a program that will charge you both $100, and the next day will check the weather and transfer $200 to the winner.

The smart contract cannot be changed or modified after it has been programmed. Therefore, you can be sure that it will work in any case according to predetermined rules.

What is gas?

A person using a smart contract must pay the system for the operation. The recipient of this payment is a node that uses its memory and electricity to execute a smart contract. Each action inside a smart contract has its own price. For example, you will have to pay a certain price if you want to take up some memory space of the node.

The means of payment for all such operations is the so-called gas. Subsequently, the gas is converted to ETH at a certain rate. To execute a smart contract, the maximum amount of gas to be paid must be determined in advance. There are two conditions to stop the execution of the contract:

  • Bringing it to the end and completing the algorithm;
  • Lack of gas.

So the Ethereum isn’t just another average cryptocurrency. It’s a huge distributed computer made up of thousands of coordinated nodes. It can’t boast of high speeds because the slightest operation has to be coordinated with every node. In addition, information from it is not erased, which makes it bigger, more expensive and slower.

By relying on a centralized server and trusting it with our data, we become vulnerable to factors beyond our control — hacker attacks, power outages, disaster risks. Decentralized computer, opposite to centralized cryptocurrency Libra from Facebook, will be held “to the last node”, that is its main advantage.

--

--

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
Jeffrey Hancock

Blockchain enthusiast developer and writer. I love video games, blockchain and the hot symbiosis of these two worlds.