diet-okikae.com

Understanding the Mechanics of Ethereum: A Deeper Dive

Written on

Chapter 1: The Basics of Ethereum

In the previous article, we provided a high-level overview of blockchain technology. Now, we will delve deeper into key aspects of Ethereum, including accounts, gas, fees, and the proof-of-work mechanism.

Ethereum Accounts

Ethereum features two primary types of accounts: External Accounts and Contract Accounts. Externally owned accounts are managed by individuals who possess the corresponding private keys. These keys serve as a security measure, ensuring that transactions are signed by the legitimate owner, thereby preventing fraudulent activities. By signing transactions with their private keys, users effectively maintain control over their account funds.

On the other hand, Contract Accounts are associated with smart contracts deployed on the Ethereum network. Both account types can receive, hold, and send ETH and tokens while also interacting with smart contracts that have been deployed.

Each account is characterized by four common attributes: nonce, balance, codeHash, and storageRoot.

Types of Accounts

  • Nonce: This indicates the number of transactions initiated from the account. Each transaction is assigned a unique nonce to prevent double spending and replay attacks.
  • Balance: This represents the amount of wei owned by the account, with one ETH equaling 1e+18 wei.
  • CodeHash: This hash pertains to the code of an account on the Ethereum Virtual Machine (EVM). Contract accounts contain operational code, while externally owned accounts have an empty string as the default.
  • StorageRoot: This is the hash of the EVM code associated with the account, represented as a 256-bit hash of the root node of a Merkle Patricia trie that encodes the account's storage contents. It is also empty by default.

Ethereum Gas and Fees

Gas is the unit that quantifies the computational effort needed to carry out a transaction on the EVM. Essentially, gas functions as a fee for executing transactions; more resource-intensive transactions incur higher gas costs.

Smart contracts on the Ethereum blockchain operate on the EVM, which is responsible for executing these contracts. Each execution requires computational resources, such as CPU cycles, memory, and disk access. The more complex the transaction, the greater the gas fee assigned. Gas prices are measured in gwei, where one gwei equals 0.000000001 ETH.

The formula for calculating transaction fees is as follows:

Transaction fee = Gas units used (limit) * (base fees + priority fees)

  • Base fees: This refers to the gas price per unit, representing the fee for each gas unit consumed during a successful transaction.
  • Priority fees: If you wish for your transaction to be processed more swiftly, you can opt to include a priority fee.

A standard ETH transfer typically requires a gas limit of 21,000 units.

Thank you for reading! In the upcoming article, I will cover how to establish a development environment and explore smart contract development.

In this video titled "Blockchain For Beginners #2 - How Does Ethereum Work?", viewers will gain further insights into the workings of Ethereum and its underlying technology.

Chapter 2: Introduction to Smart Contracts

In this chapter, we will explore the development of smart contracts using Solidity, the programming language specifically designed for Ethereum.

The video "Introduction to Ethereum Smart Contract Development with Solidity (Part 2)" provides a comprehensive guide for those interested in creating their own smart contracts.

Share the page:

Twitter Facebook Reddit LinkIn

-----------------------

Recent Post:

Celebrating Xu Ruiyun: China's First Female Mathematician

Explore the life and contributions of Xu Ruiyun, China's pioneering female mathematician, and her journey through education and adversity.

The Essence of Business Personality: More Than Just Branding

A deep dive into the significance of business personality and its influence on brand loyalty and stakeholder engagement.

# The Mind as a Fluid Landscape: Navigating Thoughts and Perspectives

Explore how our perceptions shape our reality and learn to cultivate a positive mindset.