Learn Ethereum in 2024. #5. Ethereum transactions.

João Paulo Morais
6 min readMar 11, 2024

--

Having established that the ledger is essentially a database of transactions, it’s crucial to delve into the nature of these transactions. However, it’s important to note that transactions differ between Bitcoin and Ethereum. To elucidate these distinctions and underscore the significance of Ethereum in the blockchain ecosystem, let’s initiate our discussion by focusing on Bitcoin transactions.

Bitcoin transactions

The primary and singular purpose of Bitcoin is clear: to serve as a digital currency. While Bitcoin allows for the recording of arbitrary information (as evidenced by Satoshi himself including text from a newspaper cover in the genesis block), its fundamental objective is explicit from the outset — to document transactions involving its currency, known as bitcoin (with a lowercase ‘b’), distinct from the network itself, which is Bitcoin (with a capital ‘B’).

An illustrative example of a Bitcoin transaction operates roughly as follows: Alice sends 2 bitcoins to Bob and 3 bitcoins to Carl. To be more precise, Alice utilizes the 5 bitcoins she owns, and these 5 bitcoins undergo transformation into a new 2-bitcoin coin allocated to Bob and another new 3-bitcoin coin allocated to Carl. Each of these freshly created coins is termed a UTXO (Unspent Transaction Output), essentially representing a coin that has not yet been spent. While Bitcoin transactions can involve additional complexities, at their core, this is the fundamental mechanism by which they operate.

It’s crucial to highlight that Bitcoin operates without the concept of accounts or maintaining a record of account balances. In Bitcoin, there are no individual accounts for entities like Alice or Bob — only coins. Alice’s balance, in this context, is the total value of her coins yet to be spent, represented by her Unspent Transaction Outputs (UTXOs). This stands in stark contrast to Ethereum, which employs the concept of accounts. The intricacies of Ethereum’s account-based model will be explored further in an upcoming article.

In essence, the Bitcoin ledger registers transactions involving a currency known as bitcoins, exchanged among users.

A blockchain for more than one currency

Consider an imaginary experiment: if we can use the ledger to record transactions of one currency, why not extend this capability to multiple currencies? Picture a blockchain featuring two currencies, labeled as currency A and currency B. In such a system, we could record individual currency transactions like ‘Alice sent 2 coins A to Bob’ and ‘Bob sent 3 coins B to Carl.’ Indeed, this is possible, and blockchains were created for precisely this purpose. However, akin to Bitcoin, such blockchains are typically designed with a specific objective: recording transactions between currencies.

A general-purpose blockchain

Vitalik Buterin, the creator of Ethereum, envisioned a general-purpose blockchain. While it retains the fundamental concepts of a ledger and transactions, the transactions in this context are designed to be generic. Essentially, any rule conceivable should be executable. This means a transaction could involve conventional actions, such as ‘Alice sends 2 coins to Bob,’ or more versatile interactions like ‘Alice congratulates Bob on his birthday and expects him to reciprocate.’ This versatility encapsulates the notion of a general-purpose blockchain.

As Ethereum aims to be a blockchain capable of executing any business rule, it cannot come pre-loaded with all possible rules. Instead, these rules need to be incorporated into Ethereum on-demand, much like installing new programs on a computer when needed. To achieve the vision of a general-purpose blockchain, Ethereum includes a virtual machine — a computer within the blockchain — capable of running ‘software’ written by its users.

Smart contracts

Ethereum was conceived as a decentralized global computer, and it has successfully realized this objective. While it is not the sole example today, Ethereum holds significant importance as the pioneer in this domain. The network allows anyone to write and integrate ‘software,’ or new business rules, known as smart contracts. Consequently, Ethereum stands as a public blockchain with the capability to execute smart contracts.

To elaborate on what constitutes a transaction in Ethereum, it’s important to note that, like Bitcoin, Ethereum has its own currency, called ether (ETH), which can be transferred between accounts. Therefore, in Ethereum, a transaction can serve two non-exclusive purposes. The first is to transfer ether from one account to another, and the second is to create or execute a smart contract. This dual functionality marked a significant milestone in the blockchain ecosystem and represented the first revolution in this domain.

Anyone can include a smart contract on Ethereum and define their own business logic. There is no censorship, and no permission is required. However, there is a cost involved. To include a transaction in the ledger — whether it involves transferring ether or creating/executing a smart contract — one needs to pay a fee known as a gas fee, which we’ll explore in detail in future discussions. This fee is paid in ether.

Unlike bitcoin and other currencies, which primarily serve as a store of value, ether has at least one distinctive purpose: paying for the use of the Ethereum network. In this way, ether bears some resemblance to money issued by central banks, which ultimately serves an indispensable purpose — paying taxes. Even if your money isn’t widely accepted, the government is obligated to recognize it. Similarly, even if ether is not universally accepted, you can still utilize it to execute your preferred smart contracts.

The EVM

As a general-purpose blockchain, Ethereum introduces a new element to the ecosystem. In addition to the ledger, which forms the core of the blockchain, Ethereum requires a computational entity to run programs — this virtual machine is known as the Ethereum Virtual Machine (EVM). Therefore, to understand how Ethereum operates, it’s essential not only to grasp its ledger but also to comprehend the functioning of the EVM.

Exploring the EVM will require multiple articles. The term ‘virtual machine’ is commonplace, with the Java Virtual Machine being a classic example. In essence, a virtual machine acts as a computer within a computer. While the true computer is the processor (disregarding graphics cards), virtual machines simulate a computer using the real processor of the machine. The key advantage lies in abstraction, allowing the virtual machine to operate on different operating systems and multiple architectures. Therefore, when using the EVM, concerns about the underlying operating system — be it Linux, Windows, or Mac — are mitigated. The focus is solely on writing code that the EVM comprehends.

Solidity

What code does the EVM understand? It’s a bit intricate. Just like the code your processor comprehends is quite complex — machine language is intricate, whether for a real or virtual machine. Programming languages exist to abstract machine language complexity. Rather than crafting a program in machine language, you use languages like C, C#, Java, Go, Rust, and then transform (compile) these programs into machine language. Similarly, certain programming languages were created to simplify the creation of programs for the EVM. So, instead of writing a smart contract in EVM machine language, you would likely use Solidity. A compiler then transforms your Solidity contract into EVM machine language.

In summary, Ethereum is a general-purpose blockchain functioning as a global computer capable of running programs called smart contracts. Typically written in the Solidity language, these programs are created and executed through transactions recorded in the ledger. Broadly speaking, this encapsulates Ethereum. Yet, the devil is in the details, urging us to embark on further articles to unravel the intricacies and delve deeper into Ethereum’s complexities.

Transactions in block explorers

As an exercise, you can explore transactions on block explorers. I randomly selected a transaction available at the following address: link. Don’t worry about comprehending every detail at this stage. Just take note that each transaction is associated with a specific block, such as 19408192 for this one, involves a sender (from), a recipient (to), a value (e.g., 0.01 ETH), and incurs a transaction fee. Soon, all these components will become clearer to you.

A transaction seen on etherscan

In the next article, we will study in greater depth about Ethereum’s native currency, ether, and its relationship with tokens and cryptocurrencies.

--

--

João Paulo Morais
João Paulo Morais

Written by João Paulo Morais

Astrophysicist, full-stack developer, blockchain enthusiast. Technical Writer @RareSkills.

Responses (1)