How to verify a transaction on the Ethereum network

Why is Ethereum not just another cryptocurrency? Let's try to explain its advantages and principle of operation.

Although Bitcoin and Ethereum are often mentioned together, they are actually very different. Their common feature is that both can act as means of payment and are built on blockchain technology . However, beyond its role as a cryptocurrency (like Bitcoin), Ethereum has properties that make it a huge decentralized computer.

In order to understand how Ethereum works, you need to understand how the blockchain works.

What is blockchain?

In a nutshell, it is a distributed ledger. This is an ever-growing database filled with certain information and having the following properties :

— Once data is entered into the blockchain, it cannot be changed or deleted. Each entry remains in the database forever.

— There is no single organization supporting and administering the blockchain. Thousands of users do this, each of whom stores their own copy of the registry.

To understand the mechanism for synchronizing thousands of versions of the blockchain, we will resort to 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 of paper in front of them. Every time someone makes any important transaction (for example, transferring money to another person), he tells everyone else about it.


Each person sitting writes down the announced announcements on their sheet until the sheet is full. Once the sheet is completed, the person puts it in a folder after solving the math problem. The completed solution ensures that the entries on all sheets are the same and cannot be changed. The one who solves the problem first receives a bonus in cryptocurrency. A seal is placed on the sheet, guaranteeing that it will not be changed in the future.

After the page is filed away, participants take out new sheets and the process continues.


Over time, sheets (blocks) containing important information (transactions) are added to a folder (chain), forming a database (blockchain).

What is stored on the blockchain?

Blockchain can be used to store any type of data.

The Bitcoin blockchain stores data about financial transactions, allowing Bitcoin to act as conventional currencies such as dollars and rubles. Bitcoin is no different from the dollar by design, which is not the case with ether .

Ether is not just a currency like dollars, rubles or bitcoins.

In fact, this is a huge computer, although very slow - about 100 times slower than current PCs. Besides, it's very expensive. “Ethereum Computer” is comparable in parameters to a mobile phone from the nineties; it is only capable of very trivial and undemanding operations.

Many people won't find this description exciting, so why is there so much hype around Ethereum? Precisely because it is the first decentralized computer distributed throughout the globe. Let's understand the principles of operation of the Ethereum blockchain.

How does Ethereum work?

Like any other blockchain product , Ethereum needs its software to run continuously on thousands of computers. Each computer (node) of the network runs Ethereum Virtual Machine ( EVM – Ethereum Virtual Machine). 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 need to pay, but not in dollars, but in the cryptocurrency of this system, that is, ether.

Both the person and the smart contract are users of the Ethereum network, since both are capable of performing the same function.


Smart contracts behave exactly like live users: they can send and receive ether.


However, unlike people, smart contracts can also execute certain programs if necessary. Let's look at an example to understand the power of smart contracts.

What is Gas and how is it calculated

Gas is a specific monetary unit that denotes the price of the commission in an ETH transaction. The price of Gas is closely correlated with the amount of Ethereum that people are willing to give for it. The initiator of the transaction himself fixes the restriction on the use of Gas and its price. The sender's balance must have the required number of Gas. When the transaction is completed, the unused gas is returned back to the account.

All funds paid for Gas usually go to miners’ accounts as a reward for supporting the network with the help of equipment. There is a close relationship here: the higher the price of Gas specified by the sender, the more likely the miner will choose this deal first, since the procedure will give the greatest reward.

Payment for data storage

Gas is used in storing information. The total storage cost is always directly proportional to the smallest multiple of 32 bytes used.

Increasing the storage volume correspondingly increases the size of the state database for all network nodes. This encourages users to reduce their space footprint to the minimum possible.

What is the purpose of collecting commissions?

Key operations in the Ether system are performed simultaneously by all nodes. Executing calculations in an EVM (virtual machine) is not a cheap pleasure. Smart contracts are more often used for everyday tasks than for high-complexity scenarios. The commission helps reduce the load on the system.

If there were no fees in the system, it would be easy for hackers to hack the network: just start a transaction that initiates a loop calculation. This is possible in Ethereum because its programming language is Turing complete.

The Power of Smart Contracts

Imagine that you enter into a $100 bet about tomorrow's weather with a pen pal : he believes that tomorrow there will be sun, and you believe that it will rain. The loser must give the winner $100. How to ensure that the loser keeps his word? 3 ways come to mind:

Mutual trust

The easiest thing 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 contract

It would seem that a solution has been found: you sign a formal agreement obliging the loser to pay the stated amount to the winner. We reassure him and calmly place our bets. In practice, in the event of a conflict between the parties, you will spend a lot of time in court and a lot of money on lawyers, which will make the whole process too drawn out and expensive.

Help from a trusted person

Well, the third option is that we could find a “mutual friend,” a reliable guarantor whom you both trust. The next day he would look out the window and give $200 to the winner of the bet. Everything is easy and simple. But what if the guarantor still steals the money?

When considering three possible ways to conclude a dispute deal, it becomes obvious that often the main disadvantage is the problem of trust between people , especially if these are two strangers who have never seen each other in real life.

This is where the Ethereum smart contract comes to your aid. A smart contract is a “mutual friend”, a guarantor of a transaction represented by executable code. Ethereum allows you to use a program that will charge you both $100, then check the weather the next day and transfer $200 to the winner of the bet.

A smart contract cannot be changed or added to after it has been programmed. Therefore, you can be sure that it will work in any case according to pre-established rules.

However, another question arises: how is a smart contract executed and how is it integrated into the blockchain?

Ethereum 2.0 to solve the scaling problem

One of the long-awaited scaling solutions on the Ethereum roadmap is Sharding, an optimization of the main Ethereum blockchain.

The problem with Sharding and scaling in blockchain in general is that changing the underlying protocol (from Proof-of-Work to Proof-of-Stake) is technically difficult.

Thus, the community is not willing to rely solely on scaling on the underlying Ethereum blockchain.

Moving activity to layers above the main chain provides a fast path to scalable applications.

Ethereum has more or less decided on its next steps. Ethereum 2.0 is turning out to be one of the most ambitious endeavors in the blockchain space, but if it works as intended, it will be one of the most significant advances in decentralization.

At the heart of Ethereum 2.0 are three scalability solutions designed to make Ethereum more widely used.

How is a smart contract integrated into the blockchain?

Every time a smart contract is executed, information about this is recorded on a sheet (block) as a transaction. At a high level the process looks like this:


The process of recording smart contract information as a transaction is unique, and it is this feature that sets Ethereum apart from other platforms.

There are three types of transactions in Ethereum:

Translation from person to person

Ether transfer using the “human sender – human recipient” type is no different from Bitcoin transfer. In this case, the data field remains empty.

Transfer of ether without a recipient

The purpose of a beneficiaryless transaction is to create a smart contract on the network using entries in a data field. In this case, it contains executable code that turns the smart contract into a regular Ethereum user.

Transfer of ether to a smart contract from a network user

If a person (or a smart contract) needs to start the execution of a smart contract, the transaction must be sent to the latter’s address and the conditions for its execution must be specified in the data field.

As with any blockchain network, when one of the above three actions is performed, all participants become aware of it and “make their record.” In addition, each node executes smart contract code to synchronize with the entire network.

Each node executes smart contract code, which is what makes Ethereum a giant distributed computing machine. Subsequently, a record of each action remains forever in the blockchain.

How do transactions take place on the network?

Transaction (operation, transfer) is the process of sending a signed package with information from one network participant (sender) to another (recipient). In the situation with Ether, the role of the data packet is played by a complex code, which is a digital coin.

The composition includes the following elements:

  1. Unique address (assigned for Ethereum).
  2. Electronic signature. The presence of the element indicates the readiness to conduct a transaction in relation to another person.
  3. Valua is an indicator indicating the number of Gwei sent. Many sites that work with Ether automatically convert this parameter to ETH.
  4. Gas Limit - limitation of calculations for a specific operation with ETH.
  5. Gas Price is the user’s commission payment for sending Ether. In a simplified form, one unit of Gas allows one computational operation.

There are two types of accounts on Ether: external and internal. The first ones have a personal account and are controlled using keys. Their capabilities include activating smart contracts and conducting transactions on the network. The latter have a personal account and receive messages for further processing using a built-in algorithm.

Unlike external accounts, internal accounts have an associated code, which is activated after receiving a special message.

Any transactions on the Ethereum network are launched by external accounts. After the operation is entered into the smart contract, the underlying algorithm is launched and data is transferred. The work is done using a virtual machine (EVM). This construction makes it easy to check the fate of the listed coins.

What is "gas"? I heard something about him

As stated earlier, the person using the smart contract must pay the system for the transaction. The recipient of this payment is the node, which uses its memory and electricity to execute the smart contract.

Each action within a smart contract has its own price. For example, you have to pay a certain price if you want to occupy a certain amount of node memory.

The means of payment for all such operations is the so-called gas, translated by the Russian-speaking community as “gas” (although the original name is an obvious reference to automobile fuel, which will become clear below).

Subsequently, the gas is converted into ether at a certain rate.

To execute a smart contract, it is necessary to determine in advance the maximum possible amount of gas to be paid. There are two conditions for stopping the execution of a contract:

— Bringing it to the end and completing the algorithm;

— Lack of gas.

Gas

Full nodes spend their power on confirming transactions, computing and executing smart contracts. Ethereum was originally conceived as a platform for smart contracts. To provide a runtime environment for them, Ethereum uses an EVM (decentralized virtual machine). Contracts are launched in EVM on each node, and all calculations on them are duplicated. This makes their execution very resource intensive.

Therefore, Ethereum transactions are not free. For their execution, a commission is charged from the account that initiated the transaction in favor of the miners. The fee was introduced to prevent network load and deliberate attacks. Programmable smart contracts can create infinite loops. Entering payment limits the number of actions performed and prevents such a threat.

The commission has its own unit of measurement called “gas” (from the English gas - fuel, fuel). The sender himself sets the price of gas in Ethereum for each transaction and indicates it when sending. Transactions consist of operations, each of which is subject to separate payment. Also indicates the gas limit, i.e. its maximum amount that the sender is willing to spend.

The limit is designed to protect the user from software errors and situations where the number of transactions is difficult to predict, so that the commission does not “eat up” the entire balance. You can safely indicate the amount of gas with a reserve; all unused fuel will be returned to the sender’s account. However, it may happen that the allocated fuel runs out during one of the operations. Then the transaction is completely rolled back, and no one will return the gas already spent on its execution. Therefore, it is necessary to carefully calculate the fuel limit.

Rating
( 2 ratings, average 4 out of 5 )
Did you like the article? Share with friends:
For any suggestions regarding the site: [email protected]
Для любых предложений по сайту: [email protected]