Ethereum: Nền tảng hợp đồng thông minh và ứng dụng phi tập trung thế hệ mới

Ethereum: A Next-Generation Smart Contract and Decentralized Application Platform

Von Vitalik Buterin · 2013

Abstract

Satoshi Nakamoto's development of Bitcoin in 2009 has often been hailed as a radical development in money and currency, being the first example of a digital asset which simultaneously has no backing or intrinsic value and no centralized issuer or controller. However, another, arguably more important, part of the Bitcoin experiment is the underlying blockchain technology as a tool of distributed consensus, and attention is rapidly starting to shift to this other aspect of Bitcoin. Commonly cited alternative applications of blockchain technology include using on-blockchain digital assets to represent custom currencies and financial instruments (colored coins), the ownership of an underlying physical device (smart property), non-fungible assets such as domain names (Namecoin), as well as more complex applications involving having digital assets being directly controlled by a piece of code implementing arbitrary rules (smart contracts) or even blockchain-based decentralized autonomous organizations (DAOs).

What Ethereum intends to provide is a blockchain with a built-in fully fledged Turing-complete programming language that can be used to create "contracts" that can be used to encode arbitrary state transition functions, allowing users to create any of the systems described above, as well as many others that we have not yet imagined, simply by writing up the logic in a few lines of code. A bare-bones version of Namecoin can be written in two lines of code, and other protocols like currencies and reputation systems can be built in under twenty lines. Smart contracts, cryptographic "boxes" that contain value and only unlock it if certain conditions are met, can also be built on top of the platform, with vastly more power than that offered by Bitcoin scripting because of the added powers of Turing-completeness, value-awareness, blockchain-awareness, and state.

Abstract

Ethereum la mot nen tang tien ma hoa va ung dung phi tap trung the he tiep theo, gioi thieu mot blockchain voi ngon ngu lap trinh Turing-complete tich hop san. Dieu nay cho phep bat ky ai viet smart contract va cac ung dung phi tap trung, noi ho co the tao ra cac quy tac tuy y cho quyen so huu, dinh dang giao dich va cac ham chuyen doi trang thai (state transition function).

Su doi moi co ban cua Ethereum la ket hop cong nghe blockchain do Bitcoin khai pha voi mot moi truong lap trinh da muc dich. Trong khi Bitcoin cung cap mot he thong chuyen doi trang thai don gian de chuyen tien tu tai khoan nay sang tai khoan khac, Ethereum cung cap mot nen tang noi cac nha phat trien co the xay dung bat ky loai ung dung phi tap trung nao ma ho co the tuong tuong, tu cac loai tien te thay the va cong cu tai chinh den he thong dang ky ten mien va cac to chuc phi tap trung.

Ethereum dat duoc dieu nay bang cach xay dung nhung gi ve co ban la lop nen tang truu tuong toi thuong: mot blockchain voi ngon ngu lap trinh Turing-complete tich hop san, cho phep bat ky ai viet smart contract va cac ung dung phi tap trung, noi ho co the tao ra cac quy tac tuy y cho quyen so huu, dinh dang giao dich va cac ham chuyen doi trang thai. Mot phien ban co ban cua Namecoin co the duoc viet chi trong hai dong ma, va cac giao thuc khac nhu tien te va he thong danh tieng co the duoc xay dung trong duoi hai muoi dong.

Introduction and Existing Concepts

The concept of decentralized digital currency, as well as alternative applications like property registries, has been around for decades. The anonymous e-cash protocols of the 1980s and the 1990s, mostly reliant on a cryptographic primitive known as Chaumian blinding, provided a currency with a high degree of privacy, but the protocols largely failed to gain traction because of their reliance on a centralized intermediary. In 1998, Wei Dai's b-money became the first proposal to introduce the idea of creating money through solving computational puzzles as well as decentralized consensus, but the proposal was scant on details as to how decentralized consensus could actually be implemented. In 2005, Hal Finney introduced a concept of reusable proofs of work, a system which uses ideas from b-money together with Adam Back's computationally difficult Hashcash puzzles to create a concept for a cryptocurrency, but once again fell short of the ideal by relying on trusted computing as a backend.

In 2009, a decentralized currency was for the first time implemented in practice by Satoshi Nakamoto, combining established primitives for managing ownership through public key cryptography with a consensus algorithm for keeping track of who owns coins, known as "proof of work." The mechanism behind proof of work was a breakthrough in the space because it simultaneously solved two problems. First, it provided a simple and moderately effective consensus algorithm, allowing nodes in the network to collectively agree on a set of canonical updates to the state of the Bitcoin ledger. Second, it provided a mechanism for allowing free entry into the consensus process, solving the political problem of deciding who gets to influence the consensus, while simultaneously preventing sybil attacks. It does this by substituting a formal barrier to participation, such as the requirement to be registered as a unique entity on a particular list, with an economic barrier -- the weight of a single node in the consensus voting process is directly proportional to the computing power that the node brings. Since then, an alternative approach has been proposed called proof of stake, calculating the weight of a node as being proportional to its currency holdings and not computational resources; the discussion of the relative merits of the two approaches is beyond the scope of this paper but it should be noted that both approaches can be used to serve as the backbone of a cryptocurrency.

The Bitcoin blockchain has proven remarkably robust in practice over the subsequent years of operation, but it is inherently limited in what it can accomplish beyond simple value transfer. Bitcoin's scripting language is intentionally designed to be restrictive, lacking loops, Turing-completeness, and many other features that would be necessary to build more complex applications. This limitation, while providing safety from certain classes of attacks, severely restricts what can be built on top of Bitcoin. Over the following years, numerous attempts to extend Bitcoin's functionality emerged: colored coins sought to use the Bitcoin blockchain to track ownership of alternative assets, Namecoin attempted to create a decentralized name registration database, and various metacoin protocols aimed to build additional layers on top of Bitcoin's transaction format. While these approaches showed promise, they were ultimately constrained by Bitcoin's scripting capabilities and the inability to access blockchain data from within scripts.

What Ethereum intends to provide is a blockchain with a built-in fully fledged Turing-complete programming language that can be used to create "contracts" that can be used to encode arbitrary state transition functions, allowing users to create any of the systems described above, as well as many others that we have not yet imagined, simply by writing up the logic in a few lines of code.

Introduction and Existing Concepts

Khái niệm về tiền kỹ thuật số phi tập trung, cũng như các ứng dụng thay thế như đăng ký tài sản, đã tồn tại trong nhiều thập kỷ. Các giao thức tiền điện tử ẩn danh của những năm 1980 và 1990, chủ yếu dựa vào một phương pháp mã hóa nguyên thủy được gọi là làm mù Chaumian, đã cung cấp một loại tiền tệ có mức độ riêng tư cao, nhưng các giao thức này phần lớn không thu hút được sự chú ý do chúng phụ thuộc vào một trung gian tập trung. Năm 1998, b-money của Wei Dai trở thành đề xuất đầu tiên giới thiệu ý tưởng tạo tiền thông qua việc giải các câu đố tính toán cũng như sự đồng thuận phi tập trung, nhưng đề xuất này rất ít chi tiết về cách thức thực hiện sự đồng thuận phi tập trung.

Năm 2009, một loại tiền tệ phi tập trung lần đầu tiên được Satoshi Nakamoto triển khai trong thực tế, kết hợp các nguyên tắc cơ bản đã được thiết lập để quản lý quyền sở hữu thông qua mật mã khóa công khai với thuật toán đồng thuận để theo dõi ai sở hữu tiền xu, được gọi là "bằng chứng công việc". Cơ chế đằng sau bằng chứng công việc là một bước đột phá trong lĩnh vực này vì nó giải quyết đồng thời hai vấn đề. Đầu tiên, nó cung cấp một thuật toán đồng thuận đơn giản và hiệu quả vừa phải, cho phép các nút trong mạng đồng ý chung về một tập hợp các cập nhật chuẩn cho trạng thái Bitcoin ledger. Thứ hai, nó cung cấp một cơ chế cho phép tự do tham gia vào quá trình đồng thuận, giải quyết vấn đề chính trị trong việc quyết định ai sẽ ảnh hưởng đến sự đồng thuận, đồng thời ngăn chặn các cuộc tấn công âm thầm.

Chuỗi khối Bitcoin đã được chứng minh là mạnh mẽ đáng kể qua nhiều năm hoạt động, nhưng vốn dĩ nó vẫn còn hạn chế. Ngôn ngữ kịch bản của Bitcoin được thiết kế có chủ ý để hạn chế và không hoàn thiện Turing, thiếu vòng lặp và nhiều tính năng khác cần thiết để xây dựng các ứng dụng phức tạp hơn. Giới hạn này tồn tại để ngăn chặn các vòng lặp vô hạn và các hình thức tấn công tính toán khác, nhưng nó hạn chế nghiêm trọng những gì có thể được xây dựng trên Bitcoin.

Trong 5 năm qua, đã có một số nỗ lực nhằm mở rộng chức năng của Bitcoin. Đồng xu màu đã tìm cách sử dụng chuỗi khối Bitcoin để theo dõi quyền sở hữu các tài sản thay thế, Namecoin đã cố gắng tạo cơ sở dữ liệu đăng ký tên phi tập trung và các giao thức metacoin khác nhau nhằm xây dựng các lớp bổ sung trên Bitcoin. Mặc dù các phương pháp tiếp cận này tỏ ra đầy hứa hẹn nhưng cuối cùng chúng vẫn bị hạn chế bởi khả năng tạo tập lệnh của Bitcoin và không thể truy cập dữ liệu chuỗi khối từ bên trong các tập lệnh.

Những gì Ethereum dự định cung cấp là một blockchain có ngôn ngữ lập trình Turing-complete được tích hợp đầy đủ, có thể được sử dụng để tạo các "hợp đồng" dùng để mã hóa các chức năng chuyển đổi trạng thái tùy ý, cho phép người dùng tạo bất kỳ hệ thống nào được mô tả ở trên, cũng như nhiều hệ thống khác mà chúng tôi chưa tưởng tượng ra, chỉ bằng cách viết logic bằng một vài dòng mã.

Bitcoin As A State Transition System

From a technical standpoint, the ledger of a cryptocurrency such as Bitcoin can be thought of as a state transition system, where there is a "state" consisting of the ownership status of all existing bitcoins and a "state transition function" that takes a state and a transaction and outputs a new state which is the result. In a standard banking system, for example, the state is a balance sheet, a transaction is a request to move \(X from A to B, and the state transition function reduces the value in A's account by \)X and increases the value in B's account by \(X. If A's account has less than \)X in the first place, the state transition function returns an error. Hence, one can formally define:

APPLY(S,TX) - S' or ERROR

In the banking system defined above:

APPLY({ Alice: \(50, Bob: \)50 },send \(20 from Alice to Bob") = { Alice: \)30, Bob: $70 }

But:

APPLY({ Alice: \(50, Bob: \)50 },send $70 from Alice to Bob) = ERROR

The "state" in Bitcoin is the collection of all coins (technically, "unspent transaction outputs" or UTXO) that have been minted and not yet spent, with each UTXO having a denomination and an owner (defined by a 20-byte address which is essentially a cryptographic public key). A transaction contains one or more inputs, with each input containing a reference to an existing UTXO and a cryptographic signature produced by the private key associated with the owner's address, and one or more outputs, with each output containing a new UTXO to be added to the state.

Ethereum state transition diagram showing how transactions transform blockchain state

The state transition function APPLY(S,TX) - S' can be defined roughly as follows:

  1. For each input in TX:
  2. If the referenced UTXO is not in S, return an error.
  3. If the provided signature does not match the owner of the UTXO, return an error.
  4. If the sum of the denominations of all input UTXO is less than the sum of the denominations of all output UTXO, return an error.
  5. Return S with all input UTXO removed and all output UTXO added.

The first half of the first step prevents transaction senders from spending coins that do not exist, the second half of the first step prevents transaction senders from spending other people's coins, and the second step enforces conservation of value. In order to use this for payment, the protocol is as follows. Suppose Alice wants to send 11.7 BTC to Bob. First, Alice will look for a set of available UTXO that she owns that totals up to at least 11.7 BTC. Realistically, Alice will not be able to get exactly 11.7 BTC; say that the smallest she can get is 6+4+2=12. She then creates a transaction with those three inputs and two outputs. The first output will be 11.7 BTC with Bob's address as its owner, and the second output will be the remaining 0.3 BTC "change", with the owner being Alice herself.

Bitcoin As A State Transition System

Từ quan điểm kỹ thuật, ledger của tiền điện tử như Bitcoin có thể được coi là một hệ thống chuyển đổi trạng thái, trong đó có một "trạng thái" bao gồm trạng thái sở hữu của tất cả các bitcoin hiện có và "chức năng chuyển đổi trạng thái" có trạng thái và giao dịch và tạo ra trạng thái mới là kết quả. Ví dụ: trong hệ thống ngân hàng tiêu chuẩn, trạng thái là bảng cân đối kế toán, giao dịch là yêu cầu chuyển \(X từ A sang B và chức năng chuyển đổi trạng thái làm giảm giá trị trong tài khoản của A thêm X \) và tăng giá trị trong tài khoản của B lên \(X. Nếu tài khoản của A có ít hơn \)X ngay từ đầu, hàm chuyển trạng thái sẽ trả về lỗi.

Ethereum state transition diagram showing how transactions transform blockchain state

"Trạng thái" trong Bitcoin là tập hợp tất cả các đồng xu (về mặt kỹ thuật là "đầu ra giao dịch chưa chi tiêu" hoặc UTXO) đã được đúc và chưa được chi tiêu, với mỗi UTXO có một mệnh giá và một chủ sở hữu (được xác định bởi địa chỉ 20 byte về cơ bản là khóa công khai mật mã). Giao dịch chứa một hoặc nhiều đầu vào, trong đó mỗi đầu vào chứa tham chiếu đến UTXO hiện có và chữ ký mật mã được tạo bởi khóa riêng được liên kết với địa chỉ của chủ sở hữu và một hoặc nhiều đầu ra, với mỗi đầu ra chứa UTXO mới sẽ được thêm vào trạng thái.

Hàm chuyển trạng thái APPLY(S,TX) - S' có thể được định nghĩa đại khái như sau:

  1. Đối với mỗi đầu vào ở dạng TX, nếu UTXO được tham chiếu không ở dạng S, hãy trả về lỗi.
  2. Nếu chữ ký được cung cấp không khớp với chủ sở hữu của UTXO, hãy trả về lỗi.
  3. Nếu tổng mệnh giá của tất cả UTXO đầu vào nhỏ hơn tổng mệnh giá của tất cả UTXO đầu ra, hãy trả về lỗi.
  4. Trả về S với tất cả UTXO đầu vào đã bị xóa và tất cả UTXO đầu ra đã được thêm vào.

Nửa đầu của bước đầu tiên ngăn người gửi giao dịch tiêu tiền không tồn tại, nửa sau của bước đầu tiên ngăn người gửi giao dịch tiêu tiền của người khác và bước thứ hai thực thi việc bảo toàn giá trị. Để sử dụng số tiền này để thanh toán, giao thức như sau: giả sử Alice muốn gửi 11,7 BTC cho Bob. Đầu tiên, Alice sẽ tìm kiếm một bộ UTXO có sẵn mà cô ấy sở hữu có tổng giá trị lên tới ít nhất 11,7 BTC. Trên thực tế, Alice sẽ không thể nhận được chính xác 11,7 BTC; nói rằng số nhỏ nhất cô ấy có thể nhận được là 6+4+2=12. Sau đó, cô ấy tạo một giao dịch với ba đầu vào và hai đầu ra đó. Đầu ra đầu tiên sẽ là 11,7 BTC với địa chỉ của Bob là chủ sở hữu của nó và đầu ra thứ hai sẽ là "tiền lẻ" 0,3 BTC còn lại, với chủ sở hữu là chính Alice.

Mining

If we had access to a trustworthy centralized service, this system would be trivial to implement; it could simply be coded exactly as described, using a centralized server's hard drive to keep track of the state. However, with Bitcoin we are trying to build a decentralized currency system, so we will need to combine the state transaction system with a consensus system in order to ensure that everyone agrees on the order of transactions. Bitcoin's decentralized consensus process requires nodes in the network to continuously attempt to produce packages of transactions called "blocks." The network is intended to produce roughly one block every ten minutes, with each block containing a timestamp, a nonce, a reference to (i.e. hash of) the previous block and a list of all of the transactions that have taken place since the previous block. Over time, this creates a persistent, ever-growing, "blockchain" that constantly updates to represent the latest state of the Bitcoin ledger.

Ethereum block structure showing linked blocks with timestamps nonces and transactions

The algorithm for checking if a block is valid, expressed in this paradigm, is as follows:

  1. Check if the previous block referenced by the block exists and is valid.
  2. Check that the timestamp of the block is greater than that of the previous block and less than 2 hours into the future.
  3. Check that the proof of work on the block is valid.
  4. Let S[0] be the state at the end of the previous block.
  5. Suppose TX is the block's transaction list with n transactions. For all i in 0...n-1, set S[i+1] = APPLY(S[i],TX[i]). If any application returns an error, exit and return false.
  6. Return true, and register S[n] as the state at the end of this block.

Essentially, each transaction in the block must provide a valid state transition from what was the canonical state before the transaction was executed to some new state. Note that the state is not encoded in the block in any way; it is purely an abstraction to be remembered by the validating node and can only be (securely) computed for any block by starting from the genesis state and sequentially applying every transaction in every block. Additionally, note that the order in which the miner includes transactions into the block matters; if there are two transactions A and B in a block such that B spends a UTXO created by A, then the block will be valid if A comes before B but not otherwise.

The one validity condition present in the above list that is not found in other systems is the requirement for "proof of work." The precise condition is that the double-SHA256 hash of every block, treated as a 256-bit number, must be less than a dynamically adjusted target, which as of the time of this writing is approximately \(2^{187}\). The purpose of this is to make block creation computationally "hard," thereby preventing sybil attackers from remaking the entire blockchain in their favor. Because SHA256 is designed to be a completely unpredictable pseudorandom function, the only way to create a valid block is simply trial and error, repeatedly incrementing the nonce and seeing if the new hash matches.

At the current target of \(\sim 2^{187}\), the network must make an average of \(\sim 2^{69}\) tries before a valid block is found; in general, the target is recalibrated by the network every 2016 blocks so that on average a new block is produced by some node in the network every ten minutes. In order to compensate miners for this computational work, the miner of every block is entitled to include a transaction giving themselves 25 BTC out of nowhere. Additionally, if any transaction has a higher total denomination in its inputs than in its outputs, the difference also goes to the miner as a "transaction fee." Incidentally, this is also the only mechanism by which BTC are issued; the genesis state contained no coins at all.

In order to better understand the purpose of mining, let us examine what happens in the event of a malicious attacker. Since Bitcoin's underlying cryptography is known to be secure, the attacker will target the one part of the Bitcoin system that is not protected by cryptography directly: the order of transactions. The attacker's strategy is simple:

  1. Send 100 BTC to a merchant in exchange for some product (preferably a rapid-delivery digital good).
  2. Wait for the delivery of the product.
  3. Produce another transaction sending the same 100 BTC to himself.
  4. Try to convince the network that his transaction to himself was the one that came first.

Once step (1) has taken place, after a few minutes some miner will include the transaction in a block, say block number 270000. After about one hour, five more blocks will have been added to the chain after that block, with each of those blocks indirectly pointing to the transaction and thus "confirming" it. At this point, the merchant will accept the payment as finalized and deliver the product. Since we are assuming this is a digital good, delivery is instant. Now, the attacker creates another transaction sending the 100 BTC to himself. If the attacker simply releases it into the wild, the transaction will not be processed; miners will attempt to run APPLY(S,TX) and notice that TX consumes a UTXO which is no longer in the state. So instead, the attacker creates a "fork" of the blockchain, starting by mining another version of block 270000 pointing to the same block 269999 as a parent but with the new transaction in place of the old one. Because the block data is different, this requires redoing the proof of work. Furthermore, the attacker's new version of block 270000 has a different hash, so the original blocks 270001 to 270005 do not "point" to it; thus, the original chain and the attacker's new chain are completely separate. The rule is that in a fork the longest blockchain is taken to be the truth, and so legitimate miners will work on the 270005 chain while the attacker alone is working on the 270000 chain. In order for the attacker to make his blockchain the longest, he would need to have more computational power than the rest of the network combined in order to catch up (hence, "51% attack").

Mining

Nếu chúng tôi có quyền truy cập vào một dịch vụ tập trung đáng tin cậy thì việc triển khai hệ thống này sẽ rất đơn giản; nó có thể được mã hóa chính xác như mô tả, sử dụng ổ cứng của máy chủ tập trung để theo dõi trạng thái. Tuy nhiên, với Bitcoin chúng tôi đang cố gắng xây dựng một hệ thống tiền tệ phi tập trung, vì vậy chúng tôi sẽ cần kết hợp hệ thống giao dịch nhà nước với hệ thống đồng thuận để đảm bảo rằng mọi người đều đồng ý về thứ tự giao dịch. Quy trình đồng thuận phi tập trung của Bitcoin yêu cầu các nút trong mạng liên tục cố gắng tạo ra các gói giao dịch được gọi là "khối". Mạng dự định tạo ra khoảng một khối cứ sau mười phút, với mỗi khối chứa dấu thời gian, số nonce, tham chiếu đến (tức là hàm băm của) khối trước đó và danh sách tất cả các giao dịch đã diễn ra kể từ khối trước đó.

Ethereum block structure showing linked blocks with timestamps nonces and transactions

Theo thời gian, điều này tạo ra một "blockchain" bền bỉ, ngày càng phát triển, liên tục cập nhật để thể hiện trạng thái mới nhất của Bitcoin ledger. Thuật toán để kiểm tra xem một khối có hợp lệ hay không, được thể hiện trong mô hình này như sau:

  1. Kiểm tra xem khối trước đó được tham chiếu bởi khối có tồn tại và hợp lệ hay không.
  2. Kiểm tra xem dấu thời gian của khối có lớn hơn dấu thời gian của khối trước đó và cách tương lai ít hơn 2 giờ không.
  3. Kiểm tra xem bằng chứng công việc trên khối có hợp lệ không.
  4. Gọi S là trạng thái cuối khối trước đó.
  5. Giả sử TX là danh sách giao dịch của khối có n giao dịch. Với tất cả i trong 0...n-1, đặt S = APPLY(S,TX[i]). Nếu bất kỳ ứng dụng nào trả về lỗi, hãy thoát và trả về false.
  6. Trả về true và đăng ký S làm trạng thái ở cuối khối này.

Về cơ bản, mỗi giao dịch trong khối phải cung cấp sự chuyển đổi trạng thái hợp lệ từ trạng thái chuẩn trước khi giao dịch được thực hiện sang một số trạng thái mới. Lưu ý rằng trạng thái không được mã hóa trong khối theo bất kỳ cách nào; nó hoàn toàn là một sự trừu tượng được nút xác thực ghi nhớ và chỉ có thể được tính toán (an toàn) cho bất kỳ khối nào bằng cách bắt đầu từ trạng thái ban đầu và áp dụng tuần tự mọi giao dịch trong mỗi khối.

Người khai thác được thưởng cho công việc tính toán của họ bằng bitcoin mới được tạo cộng với phí giao dịch. Quá trình khai thác hoạt động như sau: người khai thác lấy tiêu đề khối và liên tục băm nó với các giá trị nonce khác nhau cho đến khi họ tìm thấy hàm băm nằm dưới mục tiêu độ khó nhất định. Khi người khai thác tìm thấy hàm băm như vậy, họ sẽ phát khối lên mạng và các nút khác xác minh rằng hàm băm đó hợp lệ và tất cả các giao dịch trong khối đều hợp lệ. Mục tiêu độ khó được giao thức tự động điều chỉnh sau mỗi khối năm 2016 (khoảng hai tuần) để đảm bảo rằng các khối được tạo ra với tốc độ gần như không đổi.

Lưu ý rằng về lâu dài, tính bảo mật của blockchain phụ thuộc vào việc người khai thác có động cơ tài chính để hành xử trung thực. Nếu kẻ tấn công kiểm soát hơn 50% sức mạnh khai thác của mạng, chúng có khả năng thực hiện “cuộc tấn công 51%” bằng cách tạo ra một chuỗi khối thay thế phát triển nhanh hơn chuỗi trung thực. Tuy nhiên, một cuộc tấn công như vậy sẽ đòi hỏi nguồn tài nguyên tính toán khổng lồ và có thể khiến phần thưởng khai thác của kẻ tấn công trở nên vô giá trị do mạng mất niềm tin vào tính toàn vẹn của blockchain.

Merkle Trees

Merkle trees are a fundamental data structure used in Bitcoin blocks to enable efficient and secure verification of transaction inclusion. A Merkle tree is a binary tree of hashes where the leaf nodes contain hashes of individual transactions, and each interior node contains the hash of its two children, recursively building up to a single root hash that is stored in the block-header/" class="glossary-link" data-slug="block-header" title="block header">block header. This hierarchical structure allows anyone to verify that a specific transaction is included in a block by downloading only the Merkle branch—the chain of hashes from the transaction up to the root—rather than downloading all transactions in the block.

Simplified Payment Verification using Merkle tree branch proofs for transaction verification

The efficiency gains are substantial: while a full Bitcoin node must store the entire blockchain (approximately 15GB as of 2013), a simplified payment verification (SPV) node only needs to download block headers containing Merkle roots, requiring just 4MB of data. To verify a transaction, an SPV node requests the Merkle branch from full nodes, which requires only \(O(\log n)\) data where \(n\) is the number of transactions in a block. This logarithmic scaling makes it feasible to run lightweight clients on mobile devices and low-resource environments.

Bitcoin's use of Merkle trees demonstrates a key principle: cryptographic structures can dramatically reduce the trust and resource requirements for participating in a decentralized network. This same principle underlies Ethereum's design, where Merkle trees are used not only for transactions but also for state and receipt storage, enabling even more sophisticated light client protocols.

Merkle Trees

Cây Merkle là cấu trúc dữ liệu cơ bản được sử dụng trong các khối Bitcoin để cho phép xác minh hiệu quả và an toàn việc bao gồm giao dịch. Cây Merkle là một cây băm nhị phân trong đó các nút lá chứa các giá trị băm của các giao dịch riêng lẻ và mỗi nút bên trong chứa hàm băm của hai nút con của nó, xây dựng đệ quy thành một hàm băm gốc duy nhất được lưu trữ trong tiêu đề khối. Cấu trúc phân cấp này cho phép mọi người xác minh rằng một giao dịch cụ thể có được bao gồm trong một khối bằng cách chỉ tải xuống nhánh Merkle—chuỗi băm từ giao dịch đến gốc—thay vì tải xuống tất cả các giao dịch trong khối.

Simplified Payment Verification using Merkle tree branch proofs for transaction verification

Hiệu quả đạt được là đáng kể: trong khi nút Bitcoin đầy đủ phải lưu trữ toàn bộ chuỗi khối (khoảng 15 GB tính đến năm 2013), nút xác minh thanh toán đơn giản hóa (SPV) chỉ cần tải xuống các tiêu đề khối có chứa gốc Merkle, chỉ cần 4 MB dữ liệu. Để xác minh một giao dịch, nút SPV yêu cầu nhánh Merkle từ các nút đầy đủ, chỉ yêu cầu dữ liệu O(log n) trong đó n là số lượng giao dịch trong một khối. Việc chia tỷ lệ logarit này giúp việc chạy các máy khách nhẹ trên thiết bị di động và môi trường tài nguyên thấp trở nên khả thi.

Việc sử dụng cây Merkle của Bitcoin thể hiện một nguyên tắc chính: cấu trúc mật mã có thể làm giảm đáng kể các yêu cầu về độ tin cậy và tài nguyên khi tham gia vào mạng phi tập trung. Nguyên tắc tương tự này làm nền tảng cho thiết kế của Ethereum, trong đó cây Merkle không chỉ được sử dụng cho các giao dịch mà còn để lưu trữ trạng thái và biên nhận, cho phép các giao thức máy khách nhẹ phức tạp hơn nữa.

Alternative Blockchain Applications

The success of Bitcoin's blockchain inspired numerous attempts to extend the concept beyond simple currency. Namecoin, launched in 2010, was one of the earliest examples—a decentralized name registration database built on a blockchain, allowing users to register names in a distributed namespace that no central authority could censor or revoke. Colored coins emerged as a way to represent alternative assets on the Bitcoin blockchain by "tagging" specific transaction outputs to represent ownership of real-world assets, company shares, or other cryptocurrencies. Metacoins and meta-protocols like Mastercoin (later Omni) layered additional functionality on top of Bitcoin by encoding extra data in Bitcoin transactions and building separate protocol rules on top.

However, all these approaches suffered from fundamental limitations imposed by Bitcoin's architecture. The Bitcoin scripting language is intentionally restricted—it cannot access blockchain state, lacks loops and complex control flow, and provides limited introspection into transaction values. Building sophisticated applications required awkward workarounds: encoding metadata in transaction fields never intended for that purpose, relying on off-chain infrastructure for complex logic, or accepting severe limitations on what the protocol could accomplish.

These constraints motivated the search for a more general-purpose blockchain platform. Rather than building yet another special-purpose protocol on top of Bitcoin's limited foundation, Ethereum takes a different approach: providing a blockchain with a built-in Turing-complete programming language, allowing anyone to write smart contracts and decentralized applications with arbitrary rules for ownership, transaction formats, and state transition functions.

Alternative Blockchain Applications

Sự thành công của chuỗi khối Bitcoin đã truyền cảm hứng cho nhiều nỗ lực nhằm mở rộng khái niệm này ra ngoài tiền tệ đơn giản. Namecoin, ra mắt vào năm 2010, là một trong những ví dụ sớm nhất—cơ sở dữ liệu đăng ký tên phi tập trung được xây dựng trên blockchain, cho phép người dùng đăng ký tên trong một không gian tên phân tán mà không cơ quan trung ương nào có thể kiểm duyệt hoặc thu hồi. Đồng xu màu nổi lên như một cách thể hiện các tài sản thay thế trên chuỗi khối Bitcoin bằng cách "gắn thẻ" các đầu ra giao dịch cụ thể để thể hiện quyền sở hữu tài sản trong thế giới thực, cổ phiếu công ty hoặc các loại tiền điện tử khác. Metacoin và các siêu giao thức như Mastercoin (sau này là Omni) xếp lớp chức năng bổ sung lên trên Bitcoin bằng cách mã hóa dữ liệu bổ sung trong các giao dịch Bitcoin và xây dựng các quy tắc giao thức riêng biệt ở trên cùng.

Tuy nhiên, tất cả các cách tiếp cận này đều gặp phải những hạn chế cơ bản do kiến ​​trúc của Bitcoin áp đặt. Ngôn ngữ kịch bản Bitcoin bị hạn chế có chủ ý—nó không thể truy cập trạng thái blockchain, thiếu vòng lặp và luồng điều khiển phức tạp, đồng thời cung cấp khả năng xem xét nội tâm hạn chế đối với các giá trị giao dịch. Việc xây dựng các ứng dụng phức tạp đòi hỏi những giải pháp khó xử: mã hóa siêu dữ liệu trong các trường giao dịch không bao giờ nhằm mục đích đó, dựa vào cơ sở hạ tầng ngoài chuỗi để có logic phức tạp hoặc chấp nhận những hạn chế nghiêm trọng về những gì giao thức có thể đạt được.

Những hạn chế này đã thúc đẩy việc tìm kiếm một nền tảng blockchain có mục đích chung hơn. Thay vì xây dựng một giao thức có mục đích đặc biệt khác trên nền tảng hạn chế của Bitcoin, Ethereum thực hiện một cách tiếp cận khác: cung cấp một chuỗi khối với ngôn ngữ lập trình Turing-complete được tích hợp sẵn, cho phép mọi người viết hợp đồng thông minh và ứng dụng phi tập trung với các quy tắc tùy ý về quyền sở hữu, định dạng giao dịch và chức năng chuyển đổi trạng thái.

Scripting

Bitcoin Script, the language used to define spending conditions for Bitcoin transactions, is intentionally designed with severe limitations. It is not Turing-complete—most notably, it lacks loops and complex control flow structures. The language operates as a simple stack-based execution environment where operations push and pop values, evaluate cryptographic conditions, and ultimately return true or false to determine whether a transaction is valid. While this simplicity provides security benefits and makes formal analysis easier, it also makes many types of applications impossible to implement.

These limitations fall into three main categories. First, the lack of Turing-completeness prevents implementing complex state machines, decision trees, or any algorithm requiring iteration. Second, value-blindness means that scripts cannot specify fine-grained control over withdrawal amounts—a UTXO can only be spent in its entirety, with change sent to a new output. A script cannot, for example, limit withdrawals to a maximum of X per day while leaving the remainder locked. Third, the lack of blockchain state awareness means that UTXO are either spent or unspent with no intermediate states, making multi-stage contracts impossible to implement purely on-chain.

These constraints make sophisticated applications like decentralized autonomous organizations, savings wallets with withdrawal limits, decentralized exchanges, or prediction markets either impossible or require awkward off-chain mechanisms. An advanced financial contract might require access to market data, the ability to maintain internal state across multiple transactions, and complex conditional logic—none of which Bitcoin Script can provide. Ethereum removes these limitations by providing a Turing-complete language with full access to blockchain state.

Scripting

Bitcoin Tập lệnh, ngôn ngữ được sử dụng để xác định các điều kiện chi tiêu cho các giao dịch Bitcoin, được thiết kế có chủ ý với những hạn chế nghiêm trọng. Nó không phải là Turing-complete—đáng chú ý nhất là nó thiếu các vòng lặp và cấu trúc luồng điều khiển phức tạp. Ngôn ngữ hoạt động như một môi trường thực thi dựa trên ngăn xếp đơn giản, trong đó các hoạt động đẩy và bật các giá trị, đánh giá các điều kiện mật mã và cuối cùng trả về đúng hoặc sai để xác định xem giao dịch có hợp lệ hay không. Mặc dù sự đơn giản này mang lại lợi ích bảo mật và giúp việc phân tích chính thức trở nên dễ dàng hơn nhưng nó cũng khiến nhiều loại ứng dụng không thể triển khai được.

Những hạn chế này rơi vào ba loại chính. Đầu tiên, việc thiếu tính đầy đủ của Turing sẽ ngăn cản việc triển khai các máy trạng thái phức tạp, cây quyết định hoặc bất kỳ thuật toán nào yêu cầu lặp lại. Thứ hai, tính mù giá trị có nghĩa là các tập lệnh không thể chỉ định quyền kiểm soát chi tiết đối với số tiền rút—chỉ có thể sử dụng toàn bộ UTXO, với thay đổi được gửi đến đầu ra mới. Ví dụ: một tập lệnh không thể giới hạn số lần rút tiền ở mức tối đa X mỗi ngày trong khi vẫn khóa phần còn lại. Thứ ba, việc thiếu nhận thức về trạng thái blockchain có nghĩa là UTXO được chi tiêu hoặc không chi tiêu mà không có trạng thái trung gian, khiến các hợp đồng nhiều giai đoạn không thể thực hiện hoàn toàn trên chuỗi.

Những hạn chế này làm cho các ứng dụng phức tạp như các tổ chức tự trị phi tập trung, ví tiết kiệm có giới hạn rút tiền, sàn giao dịch phi tập trung hoặc thị trường dự đoán không thể thực hiện được hoặc yêu cầu các cơ chế ngoài chuỗi khó xử lý. Một hợp đồng tài chính nâng cao có thể yêu cầu quyền truy cập vào dữ liệu thị trường, khả năng duy trì trạng thái nội bộ trên nhiều giao dịch và logic điều kiện phức tạp—không điều nào trong số đó mà Tập lệnh Bitcoin có thể cung cấp. Ethereum loại bỏ những hạn chế này bằng cách cung cấp ngôn ngữ hoàn chỉnh Turing với toàn quyền truy cập vào trạng thái blockchain.

Ethereum

Ethereum's fundamental goal is to provide a blockchain with a built-in Turing-complete programming language that allows anyone to write smart contracts and decentralized applications where they can create their own arbitrary rules for ownership, transaction formats, and state transition functions. Rather than designing a protocol for specific applications like currency, name registration, or asset trading, Ethereum provides a foundational layer—a blockchain-based distributed computing platform that developers can use to build any application they can imagine.

The architecture differs fundamentally from Bitcoin's UTXO model. Ethereum uses an account-based system where the blockchain state consists of a mapping from addresses to account objects. Each account has a balance, a transaction counter (nonce), and for contract accounts, associated code and storage. The platform includes a built-in Turing-complete programming language for writing contract code that executes in the Ethereum Virtual Machine (EVM), a stack-based execution environment that processes transactions and state transitions.

This generality enables a vast range of applications: alternative cryptocurrencies with custom issuance rules, financial derivatives and stablecoins, identity and reputation systems, decentralized file storage, decentralized autonomous organizations (DAOs), and much more. The whitepaper emphasizes that Ethereum is not optimized for any particular use case but instead provides the fundamental building blocks—accounts, transactions, a Turing-complete language, and gas-metered execution—that developers can combine to create whatever applications the ecosystem demands.

Ethereum

Mục tiêu cơ bản của Ethereum là cung cấp cho blockchain ngôn ngữ lập trình hoàn chỉnh Turing tích hợp cho phép mọi người viết hợp đồng thông minh và ứng dụng phi tập trung, nơi họ có thể tạo các quy tắc tùy ý của riêng mình về quyền sở hữu, định dạng giao dịch và chức năng chuyển đổi trạng thái. Thay vì thiết kế giao thức cho các ứng dụng cụ thể như tiền tệ, đăng ký tên hoặc giao dịch tài sản, Ethereum cung cấp lớp nền tảng—nền tảng điện toán phân tán dựa trên blockchain mà các nhà phát triển có thể sử dụng để xây dựng bất kỳ ứng dụng nào họ có thể tưởng tượng.

Kiến trúc về cơ bản khác với mô hình UTXO của Bitcoin. Ethereum sử dụng hệ thống dựa trên tài khoản trong đó trạng thái chuỗi khối bao gồm ánh xạ từ địa chỉ đến đối tượng tài khoản. Mỗi tài khoản có số dư, bộ đếm giao dịch (không dùng một lần) và đối với tài khoản hợp đồng, mã liên kết và bộ lưu trữ. Nền tảng này bao gồm ngôn ngữ lập trình Turing-complete được tích hợp sẵn để viết mã hợp đồng thực thi trong Máy ảo Ethereum (EVM), một môi trường thực thi dựa trên ngăn xếp xử lý các giao dịch và chuyển đổi trạng thái.

Tính tổng quát này cho phép áp dụng một loạt các ứng dụng: tiền điện tử thay thế với quy tắc phát hành tùy chỉnh, công cụ tài chính phái sinh và stablecoin, hệ thống nhận dạng và danh tiếng, lưu trữ tệp phi tập trung, tổ chức tự trị phi tập trung (DAO), v.v. Sách trắng nhấn mạnh rằng Ethereum không được tối ưu hóa cho bất kỳ trường hợp sử dụng cụ thể nào mà thay vào đó cung cấp các khối xây dựng cơ bản—tài khoản, giao dịch, ngôn ngữ hoàn chỉnh Turing và thực thi đo lượng khí—mà các nhà phát triển có thể kết hợp để tạo ra bất kỳ ứng dụng nào mà hệ sinh thái yêu cầu.

Ethereum Accounts

In Ethereum, the state is made up of accounts, and there are two fundamental types. Externally owned accounts (EOAs) are controlled by private keys and have no associated code—they represent human users or external entities interacting with the blockchain. Contract accounts are controlled by their contract code and are activated when they receive a message or transaction. Both types share a common structure: every account has a nonce (a counter used to ensure each transaction can only be processed once), an ether balance, and for contracts specifically, contract code and persistent storage.

Ether is the primary internal cryptocurrency of Ethereum, serving as both a medium of value transfer and the fundamental unit for paying transaction fees (gas). Unlike Bitcoin's UTXO model where value is distributed across multiple unspent outputs, Ethereum accounts maintain a simple balance that increases when they receive ether and decreases when they send it. This account-based model simplifies many types of applications, particularly those requiring persistent state or complex access control, though it introduces different security considerations compared to Bitcoin's approach.

The distinction between EOAs and contract accounts is crucial to understanding Ethereum's operation. EOAs can initiate transactions by creating and signing messages with their private keys, paying gas fees to have their transactions included in blocks. Contract accounts cannot initiate transactions themselves but can send messages to other contracts in response to receiving a transaction or message, enabling complex chains of execution where a single external transaction triggers multiple contract-to-contract interactions.

Ethereum Accounts

Trong Ethereum, trạng thái được tạo thành từ các tài khoản và có hai loại cơ bản. Các tài khoản thuộc sở hữu bên ngoài (EOA) được kiểm soát bằng khóa riêng và không có mã liên quan — chúng đại diện cho người dùng hoặc các thực thể bên ngoài tương tác với chuỗi khối. Tài khoản hợp đồng được kiểm soát bằng mã hợp đồng và được kích hoạt khi nhận được tin nhắn hoặc giao dịch. Cả hai loại đều có chung cấu trúc: mỗi tài khoản đều có một nonce (bộ đếm được sử dụng để đảm bảo mỗi giao dịch chỉ có thể được xử lý một lần), số dư ether và đối với các hợp đồng cụ thể là mã hợp đồng và bộ lưu trữ liên tục.

Ether là loại tiền điện tử nội bộ chính của Ethereum, đóng vai trò vừa là phương tiện chuyển giá trị vừa là đơn vị cơ bản để thanh toán phí giao dịch (gas). Không giống như mô hình UTXO của Bitcoin nơi giá trị được phân phối trên nhiều đầu ra chưa được chi tiêu, tài khoản Ethereum duy trì số dư đơn giản tăng khi nhận được ether và giảm khi gửi. Mô hình dựa trên tài khoản này đơn giản hóa nhiều loại ứng dụng, đặc biệt là những ứng dụng yêu cầu kiểm soát truy cập phức tạp hoặc trạng thái liên tục, mặc dù nó đưa ra những cân nhắc về bảo mật khác so với phương pháp của Bitcoin.

Sự khác biệt giữa EOA và tài khoản hợp đồng là rất quan trọng để hiểu hoạt động của Ethereum. EOA có thể bắt đầu giao dịch bằng cách tạo và ký tin nhắn bằng khóa riêng của họ, trả phí gas để đưa giao dịch của họ vào khối. Tài khoản hợp đồng không thể tự bắt đầu giao dịch nhưng có thể gửi tin nhắn đến các hợp đồng khác để phản hồi việc nhận giao dịch hoặc tin nhắn, cho phép thực hiện các chuỗi thực hiện phức tạp trong đó một giao dịch bên ngoài duy nhất sẽ kích hoạt nhiều tương tác giữa các hợp đồng.

Messages and Transactions

Transactions in Ethereum are signed data packages created by externally owned accounts and broadcast to the network. A transaction contains the recipient address, a cryptographic signature proving the sender's identity, the amount of ether to transfer, an optional data field (crucial for interacting with contracts), STARTGAS (the maximum number of computational steps the transaction is allowed to take), and GASPRICE (the fee per computational step the sender is willing to pay). Miners collect these transactions, validate them, execute them, and include them in blocks, receiving the gas fees as compensation.

Messages are conceptually similar to transactions but are produced by contracts rather than external actors. When a contract's code executes, it can send messages to other contracts—these internal messages contain the sender (the contract address), recipient, an amount of ether to transfer, an optional data payload, and a STARTGAS limit. Messages enable contract-to-contract communication, allowing complex applications to be built from multiple interacting contracts rather than monolithic programs.

The gas mechanism is crucial for preventing abuse: every computational step, storage operation, and data byte in a transaction consumes gas. If a transaction runs out of gas before completing, all state changes are reverted (except the gas payment to the miner), preventing infinite loops or excessive computation from grinding the network to a halt. The sender specifies both the total gas budget (STARTGAS) and the price they're willing to pay per unit (GASPRICE), and any unused gas is refunded after execution completes.

Messages and Transactions

Các giao dịch trong Ethereum là các gói dữ liệu đã ký được tạo bởi các tài khoản thuộc sở hữu bên ngoài và được phát lên mạng. Giao dịch chứa địa chỉ người nhận, chữ ký mật mã chứng minh danh tính của người gửi, lượng ether cần chuyển, trường dữ liệu tùy chọn (rất quan trọng để tương tác với hợp đồng), STARTGAS (số bước tính toán tối đa mà giao dịch được phép thực hiện) và GASPRICE (phí cho mỗi bước tính toán mà người gửi sẵn sàng trả). Người khai thác thu thập các giao dịch này, xác thực, thực hiện và đưa chúng vào các khối, nhận phí gas như một khoản bồi thường.

Các thông điệp về mặt khái niệm tương tự như các giao dịch nhưng được tạo ra bởi các hợp đồng chứ không phải do các tác nhân bên ngoài tạo ra. Khi mã của hợp đồng thực thi, mã đó có thể gửi tin nhắn đến các hợp đồng khác—những tin nhắn nội bộ này chứa người gửi (địa chỉ hợp đồng), người nhận, lượng ether cần chuyển, tải trọng dữ liệu tùy chọn và giới hạn STARTGAS. Tin nhắn cho phép giao tiếp giữa các hợp đồng, cho phép xây dựng các ứng dụng phức tạp từ nhiều hợp đồng tương tác thay vì các chương trình nguyên khối.

Cơ chế gas rất quan trọng để ngăn chặn sự lạm dụng: mỗi bước tính toán, hoạt động lưu trữ và byte dữ liệu trong một giao dịch đều tiêu tốn gas. Nếu một giao dịch hết gas trước khi hoàn thành, tất cả các thay đổi trạng thái sẽ được hoàn nguyên (ngoại trừ khoản thanh toán gas cho người khai thác), ngăn chặn các vòng lặp vô hạn hoặc tính toán quá mức khiến mạng bị dừng lại. Người gửi chỉ định cả tổng ngân sách gas (STARTGAS) và mức giá họ sẵn sàng trả cho mỗi đơn vị (GASPRICE) và mọi gas chưa sử dụng sẽ được hoàn lại sau khi quá trình thực thi hoàn tất.

Ethereum State Transition Function

The Ethereum state transition function APPLY(S,TX) - S' defines how a transaction transforms the blockchain state, and it follows a precise sequence of steps. First, the system checks transaction validity: verifying the signature is correct, confirming the nonce matches the sender's account nonce, and ensuring the sender has sufficient balance to pay the upfront cost (STARTGAS × GASPRICE plus the value being sent). If any check fails, the transaction is rejected before execution begins. If valid, the transaction fee is deducted from the sender's account, the sender's nonce is incremented, and an initial gas counter is set to STARTGAS minus a per-byte fee for the transaction data.

Ethereum state transition function showing gas deduction value transfer and code execution

Next, the system transfers the specified ether value from the sender to the recipient. If the recipient is an externally owned account, this completes the transaction. If the recipient is a contract account, the contract's code runs in the Ethereum Virtual Machine, consuming gas for each operation until either the code completes successfully, the code explicitly halts, or the gas runs out. During execution, the contract can read and modify its storage, send messages to other contracts, and create new contracts.

Finally, if the value transfer failed (insufficient balance) or code execution failed (running out of gas or hitting an error), all state changes are reverted—except that the sender still pays gas fees to the miner for the computation performed. If execution succeeded, the remaining gas is refunded to the sender, and the gas that was consumed is sent to the miner as a fee. This mechanism ensures that miners are compensated for computation while preventing runaway execution from consuming unbounded resources.

Ethereum State Transition Function

Hàm chuyển đổi trạng thái Ethereum APPLY(S,TX) - S' xác định cách giao dịch chuyển đổi trạng thái blockchain và nó tuân theo một trình tự các bước chính xác. Đầu tiên, hệ thống kiểm tra tính hợp lệ của giao dịch: xác minh chữ ký là chính xác, xác nhận nonce khớp với nonce trong tài khoản của người gửi và đảm bảo người gửi có đủ số dư để thanh toán chi phí trả trước (STARTGAS × GASPRICE cộng với giá trị được gửi). Nếu bất kỳ kiểm tra nào không thành công, giao dịch sẽ bị từ chối trước khi bắt đầu thực hiện. Nếu hợp lệ, phí giao dịch sẽ được khấu trừ khỏi tài khoản của người gửi, số nonce của người gửi sẽ tăng lên và bộ đếm gas ban đầu được đặt thành STARTGAS trừ đi phí mỗi byte cho dữ liệu giao dịch.

Ethereum state transition function showing gas deduction value transfer and code execution

Tiếp theo, hệ thống chuyển giá trị ether được chỉ định từ người gửi đến người nhận. Nếu người nhận là tài khoản thuộc sở hữu bên ngoài thì giao dịch sẽ hoàn tất. Nếu người nhận là tài khoản hợp đồng, mã của hợp đồng sẽ chạy trong Máy ảo Ethereum, tiêu thụ gas cho mỗi thao tác cho đến khi mã hoàn thành thành công, mã dừng rõ ràng hoặc hết gas. Trong quá trình thực hiện, hợp đồng có thể đọc và sửa đổi bộ nhớ của nó, gửi tin nhắn đến các hợp đồng khác và tạo hợp đồng mới.

Cuối cùng, nếu quá trình chuyển giá trị không thành công (không đủ số dư) hoặc thực thi mã không thành công (hết gas hoặc gặp lỗi), tất cả các thay đổi trạng thái sẽ được hoàn nguyên—ngoại trừ việc người gửi vẫn trả phí gas cho người khai thác để tính toán được thực hiện. Nếu thực hiện thành công, lượng gas còn lại sẽ được hoàn lại cho người gửi và lượng gas đã tiêu thụ sẽ được gửi cho người khai thác dưới dạng phí. Cơ chế này đảm bảo rằng các thợ mỏ được đền bù cho việc tính toán đồng thời ngăn chặn việc thực thi chạy trốn khỏi việc tiêu thụ tài nguyên không giới hạn.

Code Execution

The Ethereum Virtual Machine (EVM) is the runtime environment where contract code executes—a low-level, stack-based virtual machine similar in concept to the Java Virtual Machine or WebAssembly. Contract code is stored as a sequence of bytes, where each byte represents an operation (opcode) that the EVM can execute. The execution model is deliberately simple and deterministic: every node running the EVM with the same input state and transaction must arrive at the same output state, ensuring consensus across the network.

The EVM provides three distinct types of storage for computation. The stack is a last-in-first-out (LIFO) structure limited to 1024 elements, used for immediate operation values. Memory is an infinitely expandable byte array that persists only for the duration of a single message call and is reset between executions. Storage is the persistent key-value store permanently associated with each account/" class="glossary-link" data-slug="contract-account" title="contract account">contract account, where contracts maintain their long-term state across transactions. These storage types are priced differently in gas—stack and memory operations are cheap, while storage operations are expensive to prevent blockchain bloat.

During execution, contract code has access to crucial context: it can read the message sender's address, the amount of ether sent, the data payload provided by the caller, and block-level properties like the current block number, timestamp, and miner address. The code can return an output byte array to the caller and can send messages to other contracts or create new contracts. This execution model is Turing-complete—loops and complex control flow are possible—but the gas mechanism ensures that all computation terminates in bounded time, solving the halting problem economically rather than through language restrictions.

Code Execution

Máy ảo Ethereum (EVM) là môi trường thời gian chạy trong đó mã hợp đồng thực thi—một máy ảo dựa trên ngăn xếp, cấp độ thấp có khái niệm tương tự như Máy ảo Java hoặc WebAssembly. Mã hợp đồng được lưu trữ dưới dạng một chuỗi byte, trong đó mỗi byte đại diện cho một hoạt động (mã hoạt động) mà EVM có thể thực thi. Mô hình thực thi rất đơn giản và mang tính xác định: mọi nút chạy EVM có cùng trạng thái đầu vàogiao dịch phải đến cùng trạng thái đầu ra, đảm bảo sự đồng thuận trên toàn mạng.

EVM cung cấp ba loại lưu trữ riêng biệt để tính toán. Ngăn xếp là cấu trúc vào trước ra trước (LIFO) được giới hạn ở 1024 phần tử, được sử dụng cho các giá trị hoạt động ngay lập tức. Bộ nhớ là một mảng byte có khả năng mở rộng vô hạn, chỉ tồn tại trong khoảng thời gian của một cuộc gọi tin nhắn và được đặt lại giữa các lần thực thi. Bộ lưu trữ là kho lưu trữ khóa-giá trị liên tục được liên kết vĩnh viễn với mỗi tài khoản hợp đồng">tài khoản hợp đồng, nơi hợp đồng duy trì trạng thái lâu dài qua các giao dịch. Các loại lưu trữ này có giá khác nhau về gas — hoạt động của ngăn xếp và bộ nhớ rẻ, trong khi hoạt động lưu trữ lại đắt tiền để ngăn chặn sự phình to của blockchain.

Trong quá trình thực thi, mã hợp đồng có quyền truy cập vào ngữ cảnh quan trọng: nó có thể đọc địa chỉ của người gửi tin nhắn, lượng ether được gửi, tải trọng dữ liệu do người gọi cung cấp và các thuộc tính cấp khối như số khối hiện tại, dấu thời gian và địa chỉ thợ mỏ. Mã có thể trả về một mảng byte đầu ra cho người gọi và có thể gửi tin nhắn đến các hợp đồng khác hoặc tạo hợp đồng mới. Mô hình thực thi này là Turing-complete—có thể sử dụng các vòng lặp và luồng điều khiển phức tạp—nhưng cơ chế khí đảm bảo rằng tất cả tính toán kết thúc trong thời gian giới hạn, giải quyết vấn đề tạm dừng một cách kinh tế thay vì thông qua các hạn chế về ngôn ngữ.

Blockchain and Mining

The Ethereum blockchain is fundamentally similar to Bitcoin's, serving as a database containing every transaction ever executed. However, while Bitcoin stores only a transaction list, Ethereum stores both the transaction list and the most recent state. Each block in Ethereum contains the previous block's hash, a state root (the root hash of the Patricia trie">Merkle Patricia trie representing the entire state), a transaction root, a receipt root (storing data from transaction execution), along with difficulty, timestamp, and nonce values. The state itself is a large Merkle Patricia trie mapping addresses to account objects, where each account has a balance, nonce, code (if present), and storage.

Ethereum APPLY BLOCK function processing transactions and updating state

Ethereum uses a modified version of the GHOST (Greedy Heaviest Observed Subtree) protocol to address security issues that arise from fast block times. In traditional longest-chain protocols, fast blocks lead to high stale rates, reducing network security and increasing centralization risks as large miners waste less computation on stales. GHOST includes stale blocks (called "uncles" in Ethereum) in the calculation of which chain is longest, and provides partial rewards to uncle blocks, incentivizing miners to reference them. This allows Ethereum to maintain a target block time of approximately 12 seconds while preserving network security.

The mining algorithm works similarly to Bitcoin's proof-of-work, requiring miners to find a nonce such that the hash of the block is below a certain difficulty target. However, Ethereum's memory-hard mining algorithm (Ethash) is designed to be ASIC-resistant, promoting a more decentralized mining ecosystem. The difficulty adjusts dynamically based on block times to maintain the ~12 second target, ensuring consistent block production while the GHOST protocol provides security guarantees despite the faster block times compared to Bitcoin's 10-minute average.

Blockchain and Mining

Chuỗi khối Ethereum về cơ bản tương tự như chuỗi khối Bitcoin, hoạt động như một cơ sở dữ liệu chứa mọi giao dịch từng được thực hiện. Tuy nhiên, trong khi Bitcoin chỉ lưu trữ danh sách giao dịch thì Ethereum lưu trữ cả danh sách giao dịch và trạng thái gần đây nhất. Mỗi khối trong Ethereum chứa hàm băm của khối trước đó, gốc trạng thái (mã băm gốc của Patricia trie">Merkle Patricia trie đại diện cho toàn bộ trạng thái), gốc giao dịch, gốc biên nhận (lưu trữ dữ liệu từ quá trình thực hiện giao dịch), cùng với các giá trị độ khó, dấu thời gian và số nonce. Bản thân trạng thái là một bộ ba địa chỉ ánh xạ Merkle Patricia lớn tới các đối tượng tài khoản, trong đó mỗi tài khoản có số dư, số nonce, mã (nếu có) và bộ nhớ.

Ethereum APPLY BLOCK function processing transactions and updating state

Ethereum sử dụng phiên bản sửa đổi của giao thức GHOST (Cây con được quan sát nặng nhất tham lam) để giải quyết các vấn đề bảo mật phát sinh từ thời gian khối nhanh. Trong các giao thức chuỗi dài nhất truyền thống, các khối nhanh dẫn đến tỷ lệ cũ cao, làm giảm an ninh mạng và tăng rủi ro tập trung khi các công ty khai thác lớn lãng phí ít tính toán hơn trên các cũ. GHOST bao gồm các khối cũ (được gọi là "chú" trong Ethereum) để tính toán chuỗi nào dài nhất và cung cấp một phần phần thưởng cho các khối chú, khuyến khích người khai thác tham chiếu chúng. Điều này cho phép Ethereum duy trì thời gian chặn mục tiêu khoảng 12 giây trong khi vẫn đảm bảo an ninh mạng.

Thuật toán khai thác hoạt động tương tự như proof-of-work của Bitcoin, yêu cầu người khai thác phải tìm một nonce sao cho hàm băm của khối nằm dưới mục tiêu độ khó nhất định. Tuy nhiên, thuật toán khai thác bộ nhớ cứng (Ethash) của Ethereum được thiết kế để chống lại ASIC, thúc đẩy hệ sinh thái khai thác phi tập trung hơn. Độ khó điều chỉnh linh hoạt dựa trên thời gian khối để duy trì mục tiêu ~12 giây, đảm bảo sản xuất khối nhất quán trong khi giao thức GHOST cung cấp đảm bảo an ninh mặc dù thời gian khối nhanh hơn so với mức trung bình 10 phút của Bitcoin.

Applications

The applications that can be built on Ethereum fall into three broad categories. The first category is financial applications, providing users with more powerful ways to manage and enter contracts involving their money. This includes sub-currencies, financial derivatives, hedging contracts, savings wallets with withdrawal limits, wills that distribute funds automatically, and even employment contracts that calculate payment based on verified work completion. These applications leverage Ethereum's programmability to create complex financial instruments that would be impossible or extremely difficult to implement in traditional systems or even on Bitcoin.

The second category is semi-financial applications, where money is involved but there is also a substantial non-monetary component to what is being done. A perfect example is self-enforcing bounties for solutions to computational problems. Someone could post a computational problem along with a reward, and the contract could automatically verify submitted solutions and pay out the bounty to the first correct answer. This category bridges pure finance and other domains, using economic incentives to solve problems or coordinate behavior.

The third category is applications that have nothing to do with money at all, such as online voting and decentralized governance systems. These non-financial applications demonstrate Ethereum's flexibility as a general-purpose platform. Examples include decentralized domain name systems like Namecoin, reputation systems, decentralized file storage, and organizational governance tools. Of all these application types, token systems have emerged as the most common and fundamental, serving as building blocks for many other applications.

Applications

Các ứng dụng có thể được xây dựng trên Ethereum thuộc ba loại chính. Danh mục đầu tiên là các ứng dụng tài chính, cung cấp cho người dùng những cách mạnh mẽ hơn để quản lý và ký kết các hợp đồng liên quan đến tiền của họ. Điều này bao gồm các loại tiền tệ phụ, công cụ tài chính phái sinh, hợp đồng phòng ngừa rủi ro, ví tiết kiệm có giới hạn rút tiền, di chúc phân phối tiền tự động và thậm chí cả hợp đồng lao động tính toán thanh toán dựa trên việc hoàn thành công việc đã được xác minh. Các ứng dụng này tận dụng khả năng lập trình của Ethereum để tạo ra các công cụ tài chính phức tạp không thể hoặc cực kỳ khó triển khai trong các hệ thống truyền thống hoặc thậm chí trên Bitcoin.

Loại thứ hai là các ứng dụng bán tài chính, trong đó có liên quan đến tiền nhưng cũng có một thành phần phi tiền tệ đáng kể đối với những gì đang được thực hiện. Một ví dụ hoàn hảo là tiền thưởng tự thực thi cho các giải pháp cho các vấn đề tính toán. Ai đó có thể đăng một vấn đề tính toán cùng với phần thưởng và hợp đồng có thể tự động xác minh các giải pháp đã gửi và trả tiền thưởng cho câu trả lời đúng đầu tiên. Danh mục này kết nối tài chính thuần túy và các lĩnh vực khác, sử dụng các động lực kinh tế để giải quyết vấn đề hoặc điều phối hành vi.

Loại thứ ba là các ứng dụng không liên quan gì đến tiền, chẳng hạn như bỏ phiếu trực tuyến và hệ thống quản trị phi tập trung. Các ứng dụng phi tài chính này thể hiện tính linh hoạt của Ethereum như một nền tảng có mục đích chung. Ví dụ bao gồm các hệ thống tên miền phi tập trung như Namecoin, hệ thống danh tiếng, lưu trữ tệp phi tập trung và các công cụ quản trị tổ chức. Trong số tất cả các loại ứng dụng này, hệ thống mã thông báo nổi lên là loại phổ biến và cơ bản nhất, đóng vai trò là khối xây dựng cho nhiều ứng dụng khác.

Token Systems

Token systems are surprisingly straightforward to implement on Ethereum, despite being one of the most powerful and common applications. At their core, token systems are simply a database with a single operation: subtract X units from account A and add X units to account B, with the condition that A had at least X units before the transaction and the transaction is authorized by A. The implementation requires maintaining a mapping of addresses to balances and providing a transfer function that performs the appropriate checks before moving tokens between accounts.

The contract code for a basic token system is remarkably simple and can be written in just a few lines. It consists of a data structure mapping addresses to balances, an initialization function that assigns initial token supply, and a transfer function that checks the sender's balance and authorization before executing the transfer. This simplicity stands in stark contrast to the complexity required to implement similar systems on Bitcoin, which would require significant workarounds and limitations due to Bitcoin's restricted scripting capabilities.

Tokens on Ethereum can represent virtually anything of value. They might represent sub-currencies with their own monetary policies, financial derivatives tracking external assets, company shares with dividend rights, loyalty points in customer programs, commodities like gold or oil, or even representations of physical property. The programmability of Ethereum allows these tokens to have arbitrary rules governing their behavior, such as transfer restrictions, automatic burning mechanisms, dividend distributions, or governance rights. This flexibility has made token systems the foundational building block for much of the Ethereum ecosystem.

Token Systems

Hệ thống mã thông báo dễ triển khai một cách đáng ngạc nhiên trên Ethereum, mặc dù đây là một trong những ứng dụng phổ biến và mạnh mẽ nhất. Về cốt lõi, hệ thống mã thông báo chỉ đơn giản là một cơ sở dữ liệu với một thao tác duy nhất: trừ X đơn vị khỏi tài khoản A và thêm X đơn vị vào tài khoản B, với điều kiện A có ít nhất X đơn vị trước khi giao dịch và giao dịch được A ủy quyền. Việc triển khai yêu cầu duy trì ánh xạ địa chỉ tới số dư và cung cấp chức năng chuyển tiền để thực hiện các kiểm tra thích hợp trước khi di chuyển mã thông báo giữa các tài khoản.

Mã hợp đồng cho hệ thống mã thông báo cơ bản rất đơn giản và có thể được viết chỉ bằng vài dòng. Nó bao gồm cấu trúc dữ liệu ánh xạ địa chỉ tới số dư, chức năng khởi tạo chỉ định nguồn cung cấp mã thông báo ban đầu và chức năng chuyển để kiểm tra số dư và ủy quyền của người gửi trước khi thực hiện chuyển. Sự đơn giản này hoàn toàn trái ngược với sự phức tạp cần thiết để triển khai các hệ thống tương tự trên Bitcoin, vốn đòi hỏi các giải pháp thay thế và hạn chế đáng kể do khả năng viết tập lệnh bị hạn chế của Bitcoin.

Mã thông báo trên Ethereum có thể đại diện cho hầu hết mọi thứ có giá trị. Chúng có thể đại diện cho các loại tiền tệ phụ với chính sách tiền tệ của riêng chúng, các công cụ phái sinh tài chính theo dõi tài sản bên ngoài, cổ phiếu công ty có quyền cổ tức, điểm khách hàng thân thiết trong các chương trình khách hàng, hàng hóa như vàng hoặc dầu hoặc thậm chí là đại diện cho tài sản vật chất. Khả năng lập trình của Ethereum cho phép các mã thông báo này có các quy tắc tùy ý điều chỉnh hành vi của chúng, chẳng hạn như hạn chế chuyển tiền, cơ chế đốt tự động, phân phối cổ tức hoặc quyền quản trị. Tính linh hoạt này đã làm cho hệ thống mã thông báo trở thành khối xây dựng nền tảng cho phần lớn hệ sinh thái Ethereum.

Financial Derivatives and Stable-Value Currencies

Financial derivatives represent one of the most fundamental and important applications of Ethereum smart contracts. A simple hedging contract demonstrates the basic mechanism: party A deposits a certain amount of ether worth \(1000, party B deposits an equivalent amount, and the contract records the USD value of ether at that moment using a data feed. After 30 days, the contract recalculates the value and sends ether worth \)1000 to A and the remainder to B. If the price of ether has risen, A receives fewer ether but maintains $1000 value; if it has fallen, A receives more ether to maintain that value. This allows A to hedge against volatility while B speculates on price movements.

The implementation of such contracts requires access to external data through oracle contracts or data feeds. These oracles provide price information, weather data, or other real-world information that contracts need to execute properly. While oracles introduce a trust dependency, they can be designed with redundancy and cryptoeconomic incentives to provide reliable data. The contract itself simply queries the oracle, performs calculations based on that data, and distributes funds according to its programmed logic.

Stablecoins and more complex financial instruments can be built using similar mechanisms. A stablecoin contract might maintain a reserve of ether and issue tokens pegged to a fiat currency, automatically adjusting supply or collateral requirements based on price feeds. Options contracts, futures, swaps, and other derivatives that would normally require complex legal frameworks and trusted intermediaries can instead be encoded as self-executing smart contracts. This programmable finance infrastructure enables sophisticated financial engineering while maintaining the transparency and security guarantees of blockchain technology.

Financial Derivatives and Stable-Value Currencies

Các công cụ phái sinh tài chính đại diện cho một trong những ứng dụng cơ bản và quan trọng nhất của hợp đồng thông minh Ethereum. Một hợp đồng phòng ngừa rủi ro đơn giản thể hiện cơ chế cơ bản: bên A gửi một lượng ether nhất định trị giá 1000 USD, bên B gửi một số tiền tương đương và hợp đồng ghi lại giá trị USD của ether tại thời điểm đó bằng cách sử dụng nguồn cấp dữ liệu. Sau 30 ngày, hợp đồng tính toán lại giá trị và gửi ether trị giá 1000 USD cho A và phần còn lại cho B. Nếu giá ether tăng, A nhận được ít ether hơn nhưng vẫn duy trì giá trị 1000 USD; nếu nó giảm, A sẽ nhận thêm ether để duy trì giá trị đó. Điều này cho phép A phòng ngừa sự biến động trong khi B suy đoán về biến động giá.

Việc thực hiện các hợp đồng như vậy yêu cầu quyền truy cập vào dữ liệu bên ngoài thông qua hợp đồng oracle hoặc nguồn cấp dữ liệu. Những lời tiên tri này cung cấp thông tin về giá, dữ liệu thời tiết hoặc thông tin thực tế khác mà hợp đồng cần thực hiện đúng cách. Mặc dù các oracle giới thiệu sự phụ thuộc vào niềm tin nhưng chúng có thể được thiết kế với các ưu đãi dự phòng và kinh tế tiền điện tử để cung cấp dữ liệu đáng tin cậy. Bản thân hợp đồng chỉ đơn giản truy vấn oracle, thực hiện các phép tính dựa trên dữ liệu đó và phân phối tiền theo logic được lập trình của nó.

Stablecoin và các công cụ tài chính phức tạp hơn có thể được xây dựng bằng các cơ chế tương tự. Hợp đồng stablecoin có thể duy trì lượng dự trữ ether và phát hành mã thông báo được gắn với tiền tệ fiat, tự động điều chỉnh các yêu cầu về nguồn cung hoặc tài sản thế chấp dựa trên nguồn cấp giá. Các hợp đồng quyền chọn, hợp đồng tương lai, hoán đổi và các công cụ phái sinh khác thường yêu cầu khung pháp lý phức tạp và các trung gian đáng tin cậy thay vào đó có thể được mã hóa thành hợp đồng thông minh tự thực hiện. Cơ sở hạ tầng tài chính có thể lập trình này cho phép thực hiện kỹ thuật tài chính phức tạp trong khi vẫn duy trì tính minh bạch và đảm bảo an ninh của công nghệ blockchain.

Identity and Reputation Systems

A name registration system similar to Namecoin is trivially implementable on Ethereum and serves as the simplest example of an identity system. The contract maintains a database with a key-value table mapping names to associated data (such as IP addresses, public keys, or other information). Anyone can register a name by sending a transaction to the contract along with a small registration fee, provided that name is not already taken. The owner can update the associated data at any time, and names can be made transferable or permanent according to the rules encoded in the contract.

More advanced identity systems can be built on this foundation to include reputation scores, web of trust relationships, and decentralized identity verification. For example, a contract could maintain reputation scores based on verified transactions, peer ratings, or completion of tasks. These scores would be publicly visible and cryptographically tied to specific addresses, creating a portable reputation that follows users across applications. Web of trust systems could allow users to vouch for others' identities, building social graphs that help distinguish legitimate users from bad actors.

Such identity and reputation systems become particularly powerful when integrated with other applications. A marketplace could require minimum reputation scores for sellers, a loan platform could adjust interest rates based on borrower reputation, or a social network could use web of trust to filter spam and fraudulent content. By providing a shared infrastructure for identity that any application can query, Ethereum enables a new class of trust-based applications that don't rely on centralized identity providers or proprietary reputation systems.

Identity and Reputation Systems

Hệ thống đăng ký tên tương tự như Namecoin có thể triển khai dễ dàng trên Ethereum và đóng vai trò là ví dụ đơn giản nhất về hệ thống nhận dạng. Hợp đồng duy trì một cơ sở dữ liệu với bảng khóa-giá trị ánh xạ tên tới dữ liệu liên quan (chẳng hạn như địa chỉ IP, khóa chung hoặc thông tin khác). Bất kỳ ai cũng có thể đăng ký tên bằng cách gửi giao dịch tới hợp đồng cùng với một khoản phí đăng ký nhỏ, miễn là tên đó chưa được sử dụng. Chủ sở hữu có thể cập nhật dữ liệu liên quan bất kỳ lúc nào và tên có thể được chuyển nhượng hoặc vĩnh viễn theo các quy tắc được mã hóa trong hợp đồng.

Các hệ thống nhận dạng tiên tiến hơn có thể được xây dựng trên nền tảng này để bao gồm điểm danh tiếng, mạng lưới các mối quan hệ tin cậy và xác minh danh tính phi tập trung. Ví dụ: một hợp đồng có thể duy trì điểm danh tiếng dựa trên các giao dịch đã được xác minh, xếp hạng ngang hàng hoặc mức độ hoàn thành nhiệm vụ. Những điểm số này sẽ được hiển thị công khai và được gắn bằng mật mã với các địa chỉ cụ thể, tạo ra danh tiếng di động theo sau người dùng trên các ứng dụng. Hệ thống web tin cậy có thể cho phép người dùng xác minh danh tính của người khác, xây dựng biểu đồ xã hội giúp phân biệt người dùng hợp pháp với những kẻ xấu.

Hệ thống nhận dạng và danh tiếng như vậy trở nên đặc biệt mạnh mẽ khi được tích hợp với các ứng dụng khác. Thị trường có thể yêu cầu điểm danh tiếng tối thiểu đối với người bán, nền tảng cho vay có thể điều chỉnh lãi suất dựa trên danh tiếng của người vay hoặc mạng xã hội có thể sử dụng web tin cậy để lọc nội dung spam và lừa đảo. Bằng cách cung cấp cơ sở hạ tầng dùng chung để nhận dạng mà bất kỳ ứng dụng nào cũng có thể truy vấn, Ethereum tạo ra một lớp ứng dụng mới dựa trên sự tin cậy không phụ thuộc vào các nhà cung cấp danh tính tập trung hoặc hệ thống danh tiếng độc quyền.

Decentralized File Storage

Decentralized file storage can be implemented through Ethereum contracts that coordinate between users who need storage and providers who offer it. In a "decentralized Dropbox" model, users would pay a monthly fee to upload files, with the contract distributing payments to storage providers who prove they are actually storing the data. The proof mechanism works through periodic cryptographic challenges: the contract randomly selects portions of files and asks providers to supply Merkle tree proofs demonstrating they possess that data. Providers who fail challenges or go offline would lose their deposits and future payment stream.

This approach offers several advantages over centralized storage. Merkle tree proofs enable efficient verification—users and the contract can confirm file availability without downloading entire files. The system naturally distributes files across multiple independent providers, creating redundancy without requiring explicit replication protocols. Economic incentives align provider behavior with user needs: providers earn money by reliably storing data and lose money if they fail to do so. This eliminates the trust requirement inherent in centralized storage solutions.

Storage costs in such a system can potentially be lower than centralized alternatives for several reasons. The elimination of monopoly pricing allows market competition to drive costs down to near the actual cost of storage. Implicit redundancy from multiple users storing similar files can reduce total storage requirements. There's no need for expensive data center infrastructure or corporate overhead. However, challenges remain around payment mechanisms, ensuring adequate provider participation, and managing the tradeoff between redundancy and cost. Despite these challenges, decentralized storage demonstrates how Ethereum can coordinate complex multi-party interactions through economic incentives alone.

Decentralized File Storage

Việc lưu trữ tệp phi tập trung có thể được triển khai thông qua các hợp đồng Ethereum phối hợp giữa người dùng cần lưu trữ và nhà cung cấp cung cấp dịch vụ lưu trữ đó. Trong mô hình "Dropbox phi tập trung", người dùng sẽ trả phí hàng tháng để tải tệp lên, với hợp đồng sẽ phân phối khoản thanh toán cho các nhà cung cấp dịch vụ lưu trữ chứng minh rằng họ thực sự đang lưu trữ dữ liệu. Cơ chế chứng minh hoạt động thông qua các thử thách mật mã định kỳ: hợp đồng chọn ngẫu nhiên các phần của tệp và yêu cầu nhà cung cấp cung cấp bằng chứng cây Merkle chứng minh rằng họ sở hữu dữ liệu đó. Các nhà cung cấp không vượt qua thử thách hoặc ngừng hoạt động ngoại tuyến sẽ mất tiền đặt cọc và dòng thanh toán trong tương lai.

Cách tiếp cận này cung cấp một số lợi thế so với việc lưu trữ tập trung. Bằng chứng cây Merkle cho phép xác minh hiệu quả—người dùng và hợp đồng có thể xác nhận tính khả dụng của tệp mà không cần tải xuống toàn bộ tệp. Hệ thống phân phối các tệp một cách tự nhiên trên nhiều nhà cung cấp độc lập, tạo ra sự dư thừa mà không yêu cầu các giao thức sao chép rõ ràng. Các biện pháp khuyến khích kinh tế điều chỉnh hành vi của nhà cung cấp theo nhu cầu của người dùng: nhà cung cấp kiếm tiền bằng cách lưu trữ dữ liệu một cách đáng tin cậy và sẽ mất tiền nếu họ không làm như vậy. Điều này giúp loại bỏ yêu cầu tin cậy vốn có trong các giải pháp lưu trữ tập trung.

Chi phí lưu trữ trong hệ thống như vậy có thể thấp hơn so với các giải pháp thay thế tập trung vì nhiều lý do. Việc loại bỏ tình trạng độc quyền định giá cho phép cạnh tranh trên thị trường làm giảm chi phí xuống gần bằng chi phí lưu kho thực tế. Sự dư thừa tiềm ẩn từ việc nhiều người dùng lưu trữ các tệp giống nhau có thể làm giảm tổng yêu cầu lưu trữ. Không cần cơ sở hạ tầng trung tâm dữ liệu đắt tiền hoặc chi phí chung của công ty. Tuy nhiên, vẫn còn những thách thức xung quanh cơ chế thanh toán, đảm bảo sự tham gia đầy đủ của nhà cung cấp và quản lý sự cân bằng giữa dư thừa và chi phí. Bất chấp những thách thức này, việc lưu trữ phi tập trung cho thấy cách Ethereum có thể điều phối các tương tác phức tạp của nhiều bên chỉ thông qua các biện pháp khuyến khích kinh tế.

Decentralized Autonomous Organizations

A Decentralized Autonomous Organization (DAO) is a virtual entity that has a set of members or shareholders who collectively have the right to spend the entity's funds and modify its code. A typical DAO operates with a simple rule: 67% of members are needed to make spending decisions or modify the organization's code. Members can submit proposals, vote on them, and if a proposal receives sufficient support, the contract automatically executes the decision. Membership shares can be transferable, allowing a liquid market for DAO participation, and different classes of shares can have different voting rights or economic claims.

The simplest DAO design is a self-modifying contract that maintains a list of members and requires a 2/3 majority vote to change any aspect of the contract, including its own voting rules. Members would submit code changes as transactions, other members would vote, and upon reaching the threshold, the contract would update itself. More sophisticated designs might include delegated voting systems where members can assign their voting power to representatives, or liquid democracy where votes can be delegated but reclaimed at any time for important decisions.

DAOs can serve various purposes beyond simple fund management. A DAO could function as a decentralized corporation, hiring contractors, purchasing services, and distributing profits to shareholders—all governed by smart contract code rather than traditional legal structures. It could operate as a decentralized investment fund, with members voting on which projects to fund. It could manage a commons resource, with stakeholders voting on allocation rules. The key insight is that by encoding governance rules in transparent, immutable code and tying them to economic stake, DAOs can coordinate group decisions without requiring traditional hierarchical management or legal enforcement.

Decentralized Autonomous Organizations

Tổ chức tự trị phi tập trung (DAO) là một thực thể ảo có một nhóm thành viên hoặc cổ đông có quyền chung chi tiêu tiền của thực thể và sửa đổi mã của nó. Một DAO điển hình hoạt động với một quy tắc đơn giản: cần 67% thành viên đưa ra quyết định chi tiêu hoặc sửa đổi mã của tổ chức. Các thành viên có thể gửi đề xuất, bỏ phiếu cho chúng và nếu đề xuất nhận được đủ sự hỗ trợ, hợp đồng sẽ tự động thực hiện quyết định. Cổ phiếu thành viên có thể được chuyển nhượng, cho phép thị trường thanh khoản cho sự tham gia của DAO và các loại cổ phiếu khác nhau có thể có quyền biểu quyết hoặc yêu cầu kinh tế khác nhau.

Thiết kế DAO đơn giản nhất là một hợp đồng tự sửa đổi, duy trì danh sách thành viên và yêu cầu đa số 2/3 phiếu bầu để thay đổi bất kỳ khía cạnh nào của hợp đồng, bao gồm cả các quy tắc bỏ phiếu của chính hợp đồng đó. Các thành viên sẽ gửi các thay đổi mã dưới dạng giao dịch, các thành viên khác sẽ bỏ phiếu và khi đạt đến ngưỡng, hợp đồng sẽ tự cập nhật. Các thiết kế phức tạp hơn có thể bao gồm các hệ thống bỏ phiếu được ủy quyền trong đó các thành viên có thể giao quyền biểu quyết của mình cho người đại diện hoặc chế độ dân chủ lỏng nơi phiếu bầu có thể được ủy quyền nhưng được thu hồi bất kỳ lúc nào đối với các quyết định quan trọng.

DAO có thể phục vụ nhiều mục đích khác nhau ngoài việc quản lý quỹ đơn giản. DAO có thể hoạt động như một tập đoàn phi tập trung, thuê nhà thầu, mua dịch vụ và phân phối lợi nhuận cho các cổ đông — tất cả đều được quản lý bởi mã hợp đồng thông minh thay vì cấu trúc pháp lý truyền thống. Nó có thể hoạt động như một quỹ đầu tư phi tập trung, với các thành viên bỏ phiếu về dự án nào sẽ được tài trợ. Nó có thể quản lý một nguồn tài nguyên chung, với các bên liên quan bỏ phiếu về các quy tắc phân bổ. Điểm mấu chốt là bằng cách mã hóa các quy tắc quản trị bằng mã minh bạch, bất biến và gắn chúng với lợi ích kinh tế, DAO có thể điều phối các quyết định của nhóm mà không yêu cầu quản lý phân cấp truyền thống hoặc thực thi pháp luật.

Further Applications

Beyond the major categories already discussed, Ethereum enables numerous other applications. Savings wallets with sophisticated security features can impose daily withdrawal limits while providing emergency keys for recovery, protecting users from theft while maintaining ultimate control. Crop insurance contracts can automatically pay farmers based on weather data feeds, eliminating claims processing and reducing administrative overhead. Peer-to-peer gambling applications can operate without any trusted intermediary, with smart contracts holding stakes and automatically paying winners based on verifiable random numbers or real-world event data.

On-chain prediction markets allow users to bet on future events, creating powerful forecasting mechanisms through the wisdom of crowds. These can be augmented with SchellingCoin-style protocols to create decentralized oracles: participants independently report data (like election results or weather conditions), and those whose reports match the majority receive rewards while outliers are penalized. This cryptoeconomic approach incentivizes honest reporting and can provide reliable real-world data to other contracts without requiring trust in any single oracle provider.

Multi-signature wallets represent another important application, enabling shared control of funds between multiple parties. A 2-of-3 multi-sig wallet might require any two of three designated parties to approve a transaction before funds can be spent, useful for escrow arrangements, corporate treasuries, or personal security. Decentralized marketplaces can combine identity systems, reputation scores, escrow contracts, and dispute resolution mechanisms to enable peer-to-peer commerce without centralized platforms. Each of these applications demonstrates how Ethereum's programmability enables new trust models and organizational structures.

Further Applications

Ngoài các danh mục chính đã được thảo luận, Ethereum còn hỗ trợ nhiều ứng dụng khác. tiết kiệm với các tính năng bảo mật phức tạp có thể áp đặt giới hạn rút tiền hàng ngày đồng thời cung cấp khóa khẩn cấp để khôi phục, bảo vệ người dùng khỏi bị trộm trong khi vẫn duy trì quyền kiểm soát tối ưu. Hợp đồng bảo hiểm cây trồng có thể tự động thanh toán cho nông dân dựa trên nguồn cấp dữ liệu thời tiết, loại bỏ việc xử lý yêu cầu bồi thường và giảm chi phí hành chính. Các ứng dụng cờ bạc ngang hàng có thể hoạt động mà không cần bất kỳ trung gian đáng tin cậy nào, với các hợp đồng thông minh nắm giữ cổ phần và tự động trả tiền cho người chiến thắng dựa trên các số ngẫu nhiên có thể xác minh được hoặc dữ liệu sự kiện trong thế giới thực.

Thị trường dự đoán trên chuỗi cho phép người dùng đặt cược vào các sự kiện trong tương lai, tạo ra các cơ chế dự báo mạnh mẽ thông qua trí tuệ của đám đông. Chúng có thể được tăng cường bằng các giao thức kiểu SchellingCoin để tạo ra các oracle phi tập trung: người tham gia báo cáo dữ liệu một cách độc lập (như kết quả bầu cử hoặc điều kiện thời tiết) và những người có báo cáo phù hợp với đa số sẽ nhận được phần thưởng trong khi những người có báo cáo ngoại lệ sẽ bị phạt. Cách tiếp cận kinh tế tiền điện tử này khuyến khích báo cáo trung thực và có thể cung cấp dữ liệu thực tế đáng tin cậy cho các hợp đồng khác mà không yêu cầu sự tin tưởng vào bất kỳ nhà cung cấp oracle nào.

đa chữ ký đại diện cho một ứng dụng quan trọng khác, cho phép chia sẻ quyền kiểm soát tiền giữa nhiều bên. Ví đa chữ ký 2 trên 3 có thể yêu cầu hai trong số ba bên được chỉ định bất kỳ phê duyệt giao dịch trước khi có thể chi tiêu tiền, hữu ích cho các thỏa thuận ký quỹ, kho bạc công ty hoặc bảo mật cá nhân. Thị trường phi tập trung có thể kết hợp hệ thống nhận dạng, điểm danh tiếng, hợp đồng ký quỹ và cơ chế giải quyết tranh chấp để cho phép thương mại ngang hàng mà không cần nền tảng tập trung. Mỗi ứng dụng này thể hiện khả năng lập trình của Ethereum cho phép các mô hình tin cậy và cơ cấu tổ chức mới như thế nào.

Miscellanea And Concerns

Ethereum's implementation of the modified GHOST protocol includes specific rules for uncle inclusion and rewards. Uncles must be direct children of the current block's ancestor (between 2 and 7 generations back), must be valid block headers, must be distinct from previous uncles, and must not be direct ancestors of the current block. Uncle blocks receive 87.5% of the standard block reward, while the including block receives an additional 3.125% per uncle included (up to two uncles). This incentive structure encourages miners to reference stale blocks they observe, strengthening network security while rewarding miners who experienced temporary bad luck with network propagation.

The transaction-fee/" class="glossary-link" data-slug="transaction-fee" title="fee">fee system is based on the concept of "gas," where every computational operation has a fixed gas cost. For example, a multiplication operation costs 5 gas, a SHA256 hash costs 20 gas, and every transaction has a base cost of 21,000 gas. Users specify both a gas limit (maximum gas they're willing to consume) and a gas price (how much ether they'll pay per unit of gas). This system serves multiple purposes: it prevents infinite loops and denial-of-service attacks by ensuring all computation is paid for, it creates a market for block space where users bid via gas prices, and it allows miners to set a minimum gas price they're willing to accept, protecting network resources.

Ethereum supply growth rate comparing linear issuance to Bitcoin decreasing growth

Scalability remains a significant concern, as every node/" class="glossary-link" data-slug="full-node" title="full node">full node must process every transaction to verify the state. Current blockchain architectures struggle to match centralized systems' transaction throughput. Potential solutions include state sharding, where different nodes process different subsets of transactions, and a transition from proof-of-work to proof-of-stake consensus, which could enable more efficient block production. Light clients using Merkle proofs can verify transactions without processing all blocks, but someone must still process everything. These scalability challenges represent active areas of research and development critical to Ethereum's long-term viability.

Miscellanea And Concerns

Việc triển khai giao thức GHOST đã sửa đổi của Ethereum bao gồm các quy tắc cụ thể về việc đưa chú vào và phần thưởng. Các chú phải là con trực hệ của tổ tiên của khối hiện tại (từ 2 đến 7 thế hệ trở về trước), phải là các tiêu đề khối hợp lệ, phải khác biệt với các chú trước và không được là tổ tiên trực tiếp của khối hiện tại. Các khối chú nhận được 87,5% phần thưởng khối tiêu chuẩn, trong khi khối bao gồm nhận thêm 3,125% cho mỗi chú được bao gồm (tối đa hai chú). Cơ cấu khuyến khích này khuyến khích những người khai thác tham khảo các khối cũ mà họ quan sát được, tăng cường an ninh mạng đồng thời khen thưởng những người khai thác gặp xui xẻo tạm thời khi truyền bá mạng.

Hệ thống tính phí dựa trên khái niệm "gas", trong đó mọi hoạt động tính toán đều có chi phí gas cố định. Ví dụ: một phép nhân tốn 5 gas, hàm băm SHA256 tốn 20 gas và mỗi giao dịch có chi phí cơ bản là 21.000 gas. Người dùng chỉ định cả giới hạn gas (lượng gas tối đa họ sẵn sàng tiêu thụ) và giá gas (họ sẽ trả bao nhiêu ether cho mỗi đơn vị gas). Hệ thống này phục vụ nhiều mục đích: nó ngăn chặn các vòng lặp vô hạn và các cuộc tấn công từ chối dịch vụ bằng cách đảm bảo tất cả tính toán được thanh toán, nó tạo ra một thị trường cho không gian khối nơi người dùng đặt giá thầu thông qua giá gas và cho phép các nhà khai thác đặt giá gas tối thiểu mà họ sẵn sàng chấp nhận, bảo vệ tài nguyên mạng.

Ethereum supply growth rate comparing linear issuance to Bitcoin decreasing growth

Khả năng mở rộng vẫn là mối quan tâm đáng kể vì mọi nút đầy đủ">nút đầy đủ phải xử lý mọi giao dịch để xác minh trạng thái. Kiến trúc blockchain hiện tại gặp khó khăn trong việc phù hợp với thông lượng giao dịch của hệ thống tập trung. Các giải pháp tiềm năng bao gồm phân chia trạng thái, trong đó các nút khác nhau xử lý các tập hợp con giao dịch khác nhau và chuyển đổi từ proof-of-work sang đồng thuận bằng chứng cổ phần, có thể cho phép sản xuất khối hiệu quả hơn. Các khách hàng nhẹ sử dụng bằng chứng Merkle có thể xác minh các giao dịch mà không cần xử lý tất cả các khối, nhưng ai đó vẫn phải xử lý mọi thứ. Những thách thức về khả năng mở rộng này thể hiện các lĩnh vực nghiên cứu và phát triển tích cực quan trọng đối với khả năng tồn tại lâu dài của Ethereum.

Conclusion

The Ethereum protocol was originally conceived as an upgraded version of a cryptocurrency, providing advanced features like on-blockchain escrow, withdrawal limits, and financial contracts through a highly generalized programming language. However, the Ethereum protocol moves far beyond just currency. Protocols around decentralized file storage, decentralized computation, and decentralized prediction markets, among dozens of other concepts, have the potential to substantially increase the efficiency of the computational industry and provide a massive boost to other peer-to-peer protocols by adding for the first time an economic layer.

Rather than providing a limited set of operations designed for specific use cases, Ethereum provides a Turing-complete programming language that enables developers to build any application they can design. Want to invent your own financial derivative? Create your own currency? Establish a government on the blockchain? These are all trivially implementable with Ethereum's scripting system. The platform's power lies not in predicting what applications will be built, but in providing the foundational infrastructure that makes building them easy.

The concept of an arbitrary state transition function as implemented by the Ethereum protocol provides a platform with unique potential. Rather than being a closed-ended, single-purpose protocol intended for specific applications in data storage, gambling, or finance, Ethereum is open-ended by design, and we believe it is extremely well-suited to serving as a foundational layer for a large number of both financial and non-financial protocols in the years to come. The applications that will be built on Ethereum in the future may be ones we cannot even imagine today, and that open-ended possibility represents the true promise of the platform.

Conclusion

Giao thức Ethereum ban đầu được hình thành như một phiên bản nâng cấp của tiền điện tử, cung cấp các tính năng nâng cao như ký quỹ trên blockchain, giới hạn rút tiền và hợp đồng tài chính thông qua ngôn ngữ lập trình có tính khái quát cao. Tuy nhiên, giao thức Ethereum không chỉ dừng lại ở tiền tệ. Các giao thức xung quanh việc lưu trữ tệp phi tập trung, tính toán phi tập trung và thị trường dự đoán phi tập trung, trong số hàng chục khái niệm khác, có khả năng tăng đáng kể hiệu quả của ngành tính toán và mang lại sự thúc đẩy lớn cho các giao thức ngang hàng khác bằng cách lần đầu tiên bổ sung một lớp kinh tế.

Thay vì cung cấp một tập hợp các thao tác giới hạn được thiết kế cho các trường hợp sử dụng cụ thể, Ethereum cung cấp ngôn ngữ lập trình hoàn chỉnh Turing cho phép các nhà phát triển xây dựng bất kỳ ứng dụng nào họ có thể thiết kế. Bạn muốn phát minh ra công cụ phái sinh tài chính của riêng mình? Tạo tiền tệ của riêng bạn? Thành lập chính phủ trên blockchain? Tất cả những điều này đều có thể thực hiện được một cách dễ dàng bằng hệ thống tập lệnh của Ethereum. Sức mạnh của nền tảng không nằm ở việc dự đoán những ứng dụng nào sẽ được xây dựng mà ở việc cung cấp cơ sở hạ tầng nền tảng giúp việc xây dựng chúng trở nên dễ dàng.

Khái niệm về chức năng chuyển đổi trạng thái tùy ý được triển khai bởi giao thức Ethereum cung cấp một nền tảng có tiềm năng độc đáo. Thay vì là một giao thức đóng, có mục đích duy nhất dành cho các ứng dụng cụ thể trong lưu trữ dữ liệu, cờ bạc hoặc tài chính, Ethereum được thiết kế với kết thúc mở và chúng tôi tin rằng nó cực kỳ phù hợp để đóng vai trò là lớp nền tảng cho một số lượng lớn các giao thức tài chính và phi tài chính trong những năm tới. Các ứng dụng sẽ được xây dựng trên Ethereum trong tương lai có thể là những ứng dụng mà ngày nay chúng ta thậm chí không thể tưởng tượng được và khả năng mở đó thể hiện lời hứa thực sự của nền tảng.

References and Further Reading

The Ethereum whitepaper builds upon extensive prior work in cryptocurrency and distributed systems research. The foundational Bitcoin protocol is described in Satoshi Nakamoto's original 2008 paper "Bitcoin: A Peer-to-Peer Electronic Cash System," which introduced the concept of blockchain-based digital currency. Early attempts to extend Bitcoin's functionality include Namecoin, a decentralized name registration system demonstrating blockchain applications beyond currency, though limited by Bitcoin's restricted scripting capabilities.

The colored coins whitepaper proposed a method for representing alternative assets on the Bitcoin blockchain by "coloring" specific bitcoins to represent other assets, while Mastercoin attempted to create a protocol layer on top of Bitcoin for more complex financial instruments. Both highlighted the limitations of building on Bitcoin and motivated the need for a more flexible platform. The concept of decentralized autonomous corporations, explored in Bitcoin Magazine, provided theoretical foundations for organizational governance through smart contracts.

Key technical components include simplified payment verification (SPV) for light clients, Merkle trees for efficient data verification, and Patricia tries for Ethereum's state representation. The GHOST (Greedy Heaviest Observed Subtree) protocol, described in a 2013 cryptography paper, addresses security issues arising from fast block times and forms the basis for Ethereum's consensus mechanism. These references represent the intellectual foundations upon which Ethereum was built, combining insights from cryptocurrency, distributed systems, cryptography, and game theory to create a general-purpose blockchain platform.

References and Further Reading

Sách trắng Ethereum được xây dựng dựa trên nghiên cứu sâu rộng trước đây về tiền điện tử và nghiên cứu hệ thống phân tán. Giao thức Bitcoin nền tảng được mô tả trong bài báo gốc năm 2008 của Satoshi Nakamoto "Bitcoin: Hệ thống tiền mặt điện tử ngang hàng", giới thiệu khái niệm về tiền kỹ thuật số dựa trên blockchain. Những nỗ lực ban đầu nhằm mở rộng chức năng của Bitcoin bao gồm Namecoin, một hệ thống đăng ký tên phi tập trung thể hiện các ứng dụng blockchain ngoài tiền tệ, mặc dù bị hạn chế bởi khả năng viết tập lệnh hạn chế của Bitcoin.

Sách trắng về tiền xu màu đã đề xuất một phương pháp thể hiện các tài sản thay thế trên chuỗi khối Bitcoin bằng cách "tô màu" các bitcoin cụ thể để đại diện cho các tài sản khác, trong khi Mastercoin cố gắng tạo một lớp giao thức trên Bitcoin cho các công cụ tài chính phức tạp hơn. Cả hai đều nêu bật những hạn chế của việc xây dựng trên Bitcoin và thúc đẩy nhu cầu về một nền tảng linh hoạt hơn. Khái niệm về các tập đoàn tự trị phi tập trung, được khám phá trên Tạp chí Bitcoin, đã cung cấp nền tảng lý thuyết cho việc quản trị tổ chức thông qua các hợp đồng thông minh.

Các thành phần kỹ thuật chính bao gồm xác minh thanh toán đơn giản (SPV) dành cho khách hàng hạng nhẹ, cây Merkle để xác minh dữ liệu hiệu quả và Patricia cố gắng đại diện cho trạng thái của Ethereum. Giao thức GHOST (Cây con được quan sát nặng nhất tham lam), được mô tả trong một bài viết về mật mã năm 2013, giải quyết các vấn đề bảo mật phát sinh từ thời gian khối nhanh và tạo cơ sở cho cơ chế đồng thuận của Ethereum. Những tài liệu tham khảo này thể hiện nền tảng trí tuệ mà Ethereum được xây dựng trên đó, kết hợp những hiểu biết sâu sắc về tiền điện tử, hệ thống phân tán, mật mã và lý thuyết trò chơi để tạo ra một nền tảng chuỗi khối có mục đích chung.