Blockchain | Programming | Photography | Boyi

Understanding Ethereum Core Technology


Bitcoin, as a decentralized digital currency, has been extremely successful. However, due to the limitations of Bitcoin script (which is not Turing complete and can only handle simple logic), it cannot handle complex business operations. Ethereum introduced smart contracts, which allowed the concept of decentralization to be applied to a wider range of applications, earning it the title of "Blockchain 2.0". This article will provide an interpretation of the core technologies of Ethereum. If there are any errors or omissions, please feel free to provide feedback.

Ethereum System#

In January 2014, Russian developer Vitalik Buterin published the Ethereum whitepaper and formed a team with the aim of creating a blockchain platform that integrates a more general-purpose scripting language. One of the team members, Dr. Gavin Wood, published a yellow paper that covered the Ethereum Virtual Machine (EVM) and other related technologies, which led to the birth of Ethereum.


In simple terms, Ethereum is an open-source decentralized system that uses blockchain to store changes in system states, earning it the nickname "world computer". It supports developers in deploying and running immutable programs called smart contracts on the blockchain, enabling a wide range of applications. Ethereum uses the digital currency Ether to measure system resource consumption, incentivizing more people to participate in the development of the Ethereum system.

Decentralized Applications (DApps)#

Narrowly defined, a DApp is an application that integrates a user interface, supports smart contracts, and runs on the Ethereum blockchain.


As shown in the above diagram, Ethereum applications are deployed on the blockchain network (smart contracts run in the blockchain virtual machine), while web programs only need to make RPC (Remote Procedure Call) to the blockchain network through Web3.js. This allows users to access decentralized service applications through a browser (DApp browser or plugin tools like MetaMask).


The Ethereum blockchain is a decentralized ledger (database) where all transactions in the network are stored. All nodes in the network must locally store a copy of the data and ensure the trustworthiness of each transaction. All transactions are public and immutable, and all nodes in the network can view and verify them.


When we need to log in to a website or system (such as email), we often need an account and a password. The password is stored in a centralized database in encrypted form using encryption algorithms. However, Ethereum is a decentralized system, so how are accounts generated?

Similar to the Bitcoin system:

  1. First, generate a private key that only you know, let's call it "sk", using the Elliptic Curve Digital Signature Algorithm (ECDSA) to generate the corresponding public key "pk".
  2. Use the keccak256 algorithm to hash the public key "pk".
  3. Take the last 160 bits as the Ethereum address.

A user's private key and address together form an Ethereum account, which can store balances, initiate transactions, and more (unlike Bitcoin, where balances are calculated by summing all UTXOs and not stored directly in accounts).

In fact, Ethereum accounts can be divided into two types. The ones generated using the above method are called Externally Owned Accounts (EOA), which are external accounts owned by regular users. They are mainly used to send/receive Ether tokens or send transactions to smart contracts (i.e., invoke smart contracts).

The other type is Contract Accounts, which are different from external accounts. These accounts do not have corresponding private keys and are generated when contracts are deployed. They store smart contract code. It is worth noting that contract accounts can only send or receive Ether when called by external accounts or other contracts, and they cannot execute transactions on their own.


Software/plugins that store and manage Ethereum accounts are called wallets. They provide functions such as transaction signing and balance management. Wallets can be generated in two ways: non-deterministic random generation or generation based on a random seed.


Operations on the Ethereum network also require "fees" called Gas. Deploying smart contracts and transferring funds on the blockchain both require a certain amount of Gas. This is an incentive mechanism to encourage miners to participate in the construction of the Ethereum network, making the entire network more secure and reliable.

Each transaction can set the corresponding amount of Gas and the price of Gas. Setting a higher Gas fee often results in faster processing of your transaction by miners. However, to prevent excessive Gas consumption from multiple transaction executions, a Gas Limit can be set. Gas-related information can be queried using the Ethereum Gas Tracker tool.

If START_GAS * GAS_PRICE > caller.balance, halt
Deduct START_GAS * GAS_PRICE from caller.balance
Run code, deducting from GAS
For negative values, add to GAS_REFUND
After termination, add GAS_REFUND to caller.balance

Smart Contracts#

As mentioned earlier, the Ethereum blockchain not only stores transaction information but also stores and executes smart contract code.

Smart contracts control application and transaction logic. In the Ethereum system, smart contracts are written in the dedicated Solidity language, which has syntax similar to JavaScript. In addition to Solidity, there are other programming languages such as Vyper and Bamboo. Smart contract code is compiled into bytecode and deployed on the blockchain, where it becomes immutable. The EVM serves as the execution environment for smart contracts, ensuring the determinism of execution results.

Smart Contract Example: Crowdfunding#

Let's imagine a more complex scenario. Suppose I want to crowdfund 10,000 yuan to develop a new product. Existing crowdfunding platforms charge high fees and it is difficult to address trust issues. Therefore, a crowdfunding DApp can be used to solve this problem.

First, set some rules for the crowdfunding:

  1. Anyone who wants to participate in the crowdfunding can donate an amount between 10 and 10,000 yuan.
  2. If the target amount is reached, the amount will be sent to me (the initiator of the crowdfunding) through the smart contract.
  3. If the target is not reached within a certain period of time (e.g., 1 month), the funds will be returned to the crowdfunding participants.
  4. Other rules can also be set, such as allowing users to apply for a refund if the target amount is not reached after one week.

Because these crowdfunding terms are implemented through a smart contract deployed on a public blockchain, even the initiator cannot tamper with the terms. Anyone can view them, solving the trust issue.

The complete code can be found here: Demo


In Ethereum, what does a typical transaction look like?

  1. Developers deploy smart contracts to the blockchain.
  2. DApps instantiate contracts and pass in the necessary values to execute the contracts.
  3. DApps digitally sign the transactions.
  4. Local verification of the transactions.
  5. Broadcast the transactions to the network.
  6. Mining nodes receive and verify the transactions.
  7. Mining nodes broadcast the confirmed blocks to the network.
  8. Local nodes synchronize with the network and receive new blocks.



Ethereum adopts an "Order - Execute - Validate - Update State" system architecture. In this architecture, when a new transaction is generated, miners perform Proof of Work (PoW) calculations. After verification, the block is broadcasted to the network using the gossip protocol. Other nodes in the network receive the new block and verify it. Finally, it is submitted to the blockchain to update the state.

Specifically, the Ethereum system consists of core components such as the consensus layer, data layer, and application layer. The interaction logic is as follows:


As shown in the above diagram, Ethereum data consists of a Transaction Root and a State Root. The Transaction Root is a tree composed of all transactions, including From, To, Data, Value, Gas Limit, and Gas Price. The State Root is a tree composed of all accounts, including Address, Code, Storage, Balance, and Nonce.


The above is an interpretation of some of the core technologies of Ethereum. The introduction of smart contracts has brought more possibilities to blockchain applications, but there are still many security, privacy, and efficiency issues to consider. For complex enterprise-level application scenarios, private/consortium blockchains are a better choice. A detailed analysis of Hyperledger Fabric will be provided in the future, so stay tuned!


  1. COMP7408 Distributed Ledger and Blockchain Technology, Professor S.M. Yiu, HKU
  2. Udacity Blockchain Developer Nanodegree, Udacity
  3. 区块链技术与应用肖臻,北京大学
  4. 区块链技术进阶与实战蔡亮 李启雷 梁秀波,浙江大学 | 趣链科技
  5. Ethereum Architecture, zastrin
  6. Learn Solidity: Complete Example: Crowd Funding Smart Contract, TOSHBLOCKS
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.