以太坊:下一代智能合约和去中心化应用平台

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

द्वारा Vitalik Buterin · 2013

सिंगल मोड ethereum.org

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

以太坊是下一代加密货币和去中心化应用平台,它引入了一种内置图灵完备编程语言的区块链。这使得任何人都可以编写智能合约和去中心化应用,在其中创建自己的任意所有权规则、交易格式和状态转换函数。

以太坊的根本创新在于将比特币首创的区块链技术与通用编程环境相结合。比特币提供了一个简单的状态转换系统,用于将货币从一个账户转移到另一个账户,而以太坊则提供了一个平台,开发者可以在其上构建任何他们能想象的去中心化应用——从替代货币和金融工具到域名注册系统和去中心化组织。

以太坊通过构建本质上是终极抽象基础层来实现这一目标:一个内置图灵完备编程语言的区块链,允许任何人编写智能合约和去中心化应用,在其中创建自己的任意所有权规则、交易格式和状态转换函数。Namecoin的简化版本可以用两行代码编写,而其他协议如货币和信誉系统可以在二十行以内构建完成。

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

去中心化数字货币的概念以及诸如财产登记等替代应用已经存在了数十年。20世纪80年代和90年代的匿名电子现金协议主要依赖一种被称为乔姆盲签名的密码学原语,提供了高度隐私的货币,但这些协议由于依赖中心化中介机构而未能广泛流行。1998年,戴维的b-money成为第一个引入通过解决计算难题来创造货币以及去中心化共识理念的提案,但该提案在如何实际实现去中心化共识方面缺乏细节。

2009年,中本聪首次在实践中实现了去中心化货币,他将通过公钥密码学管理所有权的成熟原语与一种用于追踪币的所有权的共识算法——即"工作量证明"——结合在一起。工作量证明背后的机制是该领域的一个突破,因为它同时解决了两个问题。首先,它提供了一种简单且适度有效的共识算法,使网络中的节点能够集体就比特币账本状态的一组规范更新达成一致。其次,它提供了一种允许自由参与共识过程的机制,解决了由谁来影响共识的政治问题,同时防止了女巫攻击。

比特币区块链在多年运行中已证明了其卓越的稳健性,但它本质上是有局限的。比特币的脚本语言被有意设计为限制性的、非图灵完备的,缺少循环和许多其他构建更复杂应用所必需的功能。这种限制的存在是为了防止无限循环和其他形式的计算攻击,但它严重限制了可以在比特币之上构建的内容。

在过去五年中,已经有许多尝试来扩展比特币的功能。彩色币试图利用比特币区块链来追踪替代资产的所有权,域名币试图创建一个去中心化的域名注册数据库,各种元币协议旨在在比特币之上构建额外的层级。虽然这些方法展现了前景,但最终都受到比特币脚本能力的限制以及脚本内无法访问区块链数据的制约。

以太坊的目标是提供一个内置完整图灵完备编程语言的区块链,该语言可用于创建"合约",对任意状态转换函数进行编码,使用户只需用几行代码编写逻辑,就能创建上述任何系统以及许多我们尚未想象到的系统。

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

从技术角度来看,像比特币这样的加密货币的账本可以被视为一个状态转换系统,其中有一个由所有现有比特币的所有权状态组成的"状态",以及一个接受状态和交易输出新状态的"状态转换函数"。在标准银行系统中,例如,状态是一张资产负债表,交易是将\(X从A转移到B的请求,状态转换函数将A账户中的值减少\)X,并将B账户中的值增加\(X。如果A的账户余额一开始就少于\)X,状态转换函数将返回错误。

Ethereum state transition diagram showing how transactions transform blockchain state

比特币中的"状态"是所有已被铸造且尚未花费的币的集合(技术上称为"未花费的交易输出"或UTXO),每个UTXO都有一个面额和一个所有者(由一个20字节的地址定义,本质上是一个密码学公钥)。一笔交易包含一个或多个输入,每个输入包含对一个现有UTXO的引用和由所有者地址关联的私钥产生的密码学签名,以及一个或多个输出,每个输出包含一个要添加到状态中的新UTXO。

状态转换函数APPLY(S,TX) - S'可以大致定义如下:

  1. 对于TX中的每个输入,如果引用的UTXO不在S中,返回错误。
  2. 如果提供的签名与UTXO的所有者不匹配,返回错误。
  3. 如果所有输入UTXO的面额之和小于所有输出UTXO的面额之和,返回错误。
  4. 返回移除所有输入UTXO并添加所有输出UTXO后的S。

第一步的前半部分防止交易发送者花费不存在的币,第一步的后半部分防止交易发送者花费他人的币,第二步确保价值守恒。为了使用此方法进行支付,协议如下:假设Alice想要向Bob发送11.7 BTC。首先,Alice将寻找一组她拥有的、总计至少为11.7 BTC的可用UTXO。实际上,Alice不太可能恰好得到11.7 BTC;假设她能得到的最小组合是6+4+2=12。然后她创建一笔有三个输入和两个输出的交易。第一个输出将是11.7 BTC,所有者为Bob的地址,第二个输出将是剩余的0.3 BTC"找零",所有者为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

如果我们能够获得一个可信的中心化服务,这个系统将很容易实现;它可以完全按照描述进行编码,使用中心化服务器的硬盘来跟踪状态。然而,对于比特币,我们试图构建一个去中心化的货币系统,因此我们需要将状态转换系统与共识系统相结合,以确保每个人都对交易顺序达成一致。比特币的去中心化共识过程要求网络中的节点不断尝试生产被称为"区"的交易包。网络预期大约每十分钟产生一个区块,每个区块包含一个时间戳、一个随机数、对前一个区块的引用(即哈希值)以及自前一个区块以来发生的所有交易的列表。

Ethereum block structure showing linked blocks with timestamps nonces and transactions

随着时间的推移,这创建了一个持久的、不断增长的"区块链",不断更新以代表比特币账本的最新状态。在此范式中,检查一个区块是否有效的算法如下:

  1. 检查该区块引用的前一个区块是否存在且有效。
  2. 检查该区块的时间戳是否大于前一个区块的时间戳,且不超过未来2小时。
  3. 检查该区块上的工作量证明是否有效。
  4. 令S为前一个区块末尾的状态。
  5. 假设TX是该区块包含n笔交易的交易列表。对于所有i在0...n-1范围内,设S = APPLY(S,TX[i])。如果任何应用返回错误,退出并返回false。
  6. 返回true,并将S注册为该区块末尾的状态。

本质上,区块中的每笔交易都必须提供一个有效的状态转换,从交易执行前的规范状态转换到某个新状态。注意,状态并未以任何方式编码在区块中;它纯粹是由验证节点记忆的抽象概念,只能通过从创世状态开始并顺序应用每个区块中的每笔交易来(安全地)计算任何区块的状态。

矿工通过新创建的比特币和交易费获得计算工作的奖励。挖矿过程如下:矿工获取区块头并使用不同的随机数值反复对其进行哈希运算,直到找到一个低于特定难度目标的哈希值。当矿工找到这样的哈希值时,他们将区块广播到网络,其他节点验证哈希值有效且区块中的所有交易有效。难度目标由协议每2016个区块(大约两周)自动调整,以确保区块以大致恒定的速率产生。

请注意,从长远来看,区块链的安全性取决于矿工是否有经济激励来诚实行事。如果攻击者控制了网络超过50%的挖矿算力,他们就有可能通过创建一条比诚实链增长更快的替代区块链来执行"51%攻击"。然而,这样的攻击需要巨大的计算资源,并且随着网络对区块链完整性失去信心,攻击者的挖矿奖励可能变得毫无价值。

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

默克尔树是比特币区中使用的一种基础数据结构,用于实现高效和安全的交易包含验证。默克尔树是一种哈希二叉树,其中叶节点包含各个交易的哈希值,每个内部节点包含其两个子节点的哈希值,递归地向上构建到存储区块头中的单个根哈希值。这种层次结构允许任何人通过只下载默克尔分支——从交易到根的哈希链——而不是下载区块中的所有交易,来验证特定交易是否包含在某个区块中。

Simplified Payment Verification using Merkle tree branch proofs for transaction verification

效率提升是显著的:虽然一个完整的比特币节点必须存储整个区块链(截至2013年约15GB),简化支付验证(SPV)节点只需下载包含默克尔根的区块头,仅需要4MB的数据。为了验证一笔交易,SPV节点从完整节点请求默克尔分支,这只需要O(log n)的数据,其中n是区块中的交易数量。这种对数级的扩展性使得在移动设备和资源受限的环境中运行轻量级客户端成为可能。

比特币对默克尔树的使用展示了一个关键原则:密码学结构可以大幅降低参与去中心化网络的信任和资源要求。同样的原则也是以太坊设计的基础,在以太坊中,默克尔树不仅用于交易,还用于状态收据存储,从而实现更复杂的轻客户端协议。

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

比特币区块链的成功激发了许多将该概念扩展到简单货币之外的尝试。域名币(Namecoin)于2010年推出,是最早的例子之一——一个建立在区块链上的去中心化域名注册数据库,允许用户在分布式命名空间中注册域名,且没有中央权威机构可以审查或撤销。彩色币作为一种在比特币区块链上表示替代资产的方式出现,通过"标记"特定的交易输出来代表现实世界资产、公司股份或其他加密货币的所有权。万事达币(Mastercoin,后来的Omni)等元币和元协议通过在比特币交易中编码额外数据并在其上构建独立的协议规则,在比特币之上层叠了额外的功能。

然而,所有这些方法都受到比特币架构强加的根本性限制。比特币脚本语言被有意限制——它无法访问区块链状态,缺少循环和复杂的控制流,并且对交易值的内省能力有限。构建复杂的应用需要笨拙的变通方法:在从未为此目的设计的交易字段中编码元数据,依赖链下基础设施来处理复杂逻辑,或者接受协议能力上的严重限制。

这些约束推动了对更通用区块链平台的探索。以太坊不是在比特币有限的基础上再构建另一个特殊用途的协议,而是采取了不同的方法:提供一个内置图灵完备编程语言的区块链,允许任何人编写具有任意所有权规则、交易格式和状态转换函数的智能合约和去中心化应用。

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 Script)是用于定义比特币交易花费条件的语言,它被有意设计为具有严格的限制。它不是图灵完备的——最显著的是缺少循环和复杂的控制流结构。该语言作为一个简单的基于栈的执行环境运行,其中操作进行压栈和出栈、评估密码学条件,并最终返回true或false以确定交易是否有效。虽然这种简单性带来了安全性优势并使形式化分析更加容易,但它也使许多类型的应用无法实现。

这些限制可以分为三个主要类别。首先,缺乏图灵完备性使得无法实现复杂的状态机、决策树或任何需要迭代的算法。其次,值盲性意味着脚本无法对提取金额进行细粒度控制——UTXO只能被整体花费,找零被发送到新的输出。脚本无法例如限制每天最多提取X的金额,同时将余额保持锁定。第三,缺乏区块链状态感知意味着UTXO要么已花费要么未花费,没有中间状态,使得多阶段合约无法纯粹在链上实现。

这些约束使得去中心化自治组织、带提取限额的储蓄钱包、去中心化交易所或预测市场等复杂应用要么无法实现,要么需要笨拙的链下机制。一个高级金融合约可能需要访问市场数据、在多笔交易之间维护内部状态的能力以及复杂的条件逻辑——这些都是比特币脚本无法提供的。以太坊通过提供一种图灵完备的语言并完全访问区块链状态来消除这些限制。

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

以太坊的根本目标是提供一个内置图灵完备编程语言的区块链,允许任何人编写智能合约和去中心化应用,在其中创建自己的任意所有权规则、交易格式和状态转换函数。以太坊不是为货币、域名注册或资产交易等特定应用设计协议,而是提供一个基础层——一个基于区块链的分布式计算平台,开发者可以用它来构建任何他们能想象的应用。

其架构与比特币的UTXO模型有根本区别。以太坊使用基于账户的系统,其中区块链状态由地址到账户对象的映射组成。每个账户都有余额、交易计数器(nonce),对于合约账户还有关联的代码和存储。该平台包含一种内置的图灵完备编程语言,用于编写在以太坊虚拟机(EVM)中执行的合约代码,EVM是一个基于栈的执行环境,处理交易和状态转换。

这种通用性使得广泛的应用成为可能:具有自定义发行规则的替代加密货币、金融衍生品和稳定币、身份和信誉系统、去中心化文件存储、去中心化自治组织(DAO)等等。白皮书强调,以太坊并非针对任何特定用例进行优化,而是提供基本构建块——账户、交易、图灵完备语言和燃料计量执行——开发者可以将这些组合起来,创建生态系统所需的任何应用。

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

在以太坊中,状态账户组成,有两种基本类型。外部拥有账户(EOA)由私钥控制,没有关联代码——它们代表与区块链交互的人类用户或外部实体。合约账户由其合约代码控制,在收到消息或交易时被激活。两种类型共享一个通用结构:每个账户都有一个nonce(用于确保每笔交易只能被处理一次的计数器)、以太币余额,而合约特别还拥有合约代码和持久存储

以太币是以太坊的主要内部加密货币,既作为价值转移的媒介,也是支付交易费用(燃料费)的基本单位。与比特币的UTXO模型——价值分布在多个未花费输出中——不同,以太坊账户维护一个简单的余额,接收以太币时增加,发送时减少。这种基于账户的模型简化了许多类型的应用,特别是那些需要持久状态或复杂访问控制的应用,尽管与比特币的方法相比,它引入了不同的安全考量。

EOA与合约账户之间的区别对于理解以太坊的运作至关重要。EOA可以通过使用私钥创建和签署消息来发起交易,支付燃料费以使其交易被包含在区块中。合约账户本身不能发起交易,但可以在收到交易或消息时向其他合约发送消息,从而实现复杂的执行链,其中单笔外部交易触发多个合约之间的交互。

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

以太坊中的交易是由外部拥有账户创建并广播到网络的签名数据包。一笔交易包含接收方地址、证明发送方身份的密码学签名、要转移的以太币数量、一个可选的数据字段(对于与合约交互至关重要)、STARTGAS(交易被允许执行的最大计算步数)和GASPRICE(发送方愿意为每个计算步骤支付的费用)。矿工收集这些交易,验证它们,执行它们,并将它们包含在区块中,收取燃料费作为补偿。

消息在概念上类似于交易,但由合约而非外部参与者产生。当合约的代码执行时,它可以向其他合约发送消息——这些内部消息包含发送方(合约地址)、接收方、要转移的以太币数量、可选的数据载荷和STARTGAS限制。消息使得合约之间能够通信,允许从多个交互合约而非单体程序中构建复杂应用。

燃料机制对于防止滥用至关重要:交易中的每个计算步骤、存储操作和数据字节都消耗燃料。如果交易在完成前耗尽燃料,所有状态更改将被还原(但向矿工支付的燃料费除外),从而防止无限循环或过度计算使网络瘫痪。发送方指定燃料总预算(STARTGAS)和愿意为每单位支付的价格(GASPRICE),执行完成后任何未使用的燃料将被退还。

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

以太坊状态转换函数APPLY(S,TX) - S'定义了交易如何转换区块链状态,它遵循精确的步骤序列。首先,系统检查交易的有效性:验证签名是否正确,确认nonce与发送方账户的nonce匹配,并确保发送方有足够的余额来支付预付费用(STARTGAS x GASPRICE加上要发送的值)。如果任何检查失败,交易在执行开始前就被拒绝。如果有效,交易费用从发送方账户扣除,发送方的nonce递增,初始燃料计数器被设置为STARTGAS减去交易数据的每字节费用。

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

接下来,系统将指定的以太币值从发送方转移到接收方。如果接收方是外部拥有账户,交易到此完成。如果接收方是合约账户,合约的代码在以太坊虚拟机中运行,每个操作消耗燃料,直到代码成功完成、代码显式停止或燃料耗尽。在执行期间,合约可以读取和修改其存储、向其他合约发送消息以及创建新合约。

最后,如果值转移失败(余额不足)或代码执行失败(燃料耗尽或遇到错误),所有状态更改将被还原——但发送方仍需为已执行的计算向矿工支付燃料费。如果执行成功,剩余燃料退还给发送方,已消耗的燃料作为费用发送给矿工。这种机制确保矿工获得计算补偿,同时防止失控的执行消耗无限资源。

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

以太坊虚拟机(EVM)是合约代码执行的运行时环境——一个低层级的、基于栈的虚拟机,在概念上类似于Java虚拟机或WebAssembly。合约代码存储为字节序列,其中每个字节代表EVM可以执行的一个操作(操作码)。执行模型被刻意设计为简单且确定性的:每个使用相同输入状态交易运行EVM的节点必须得出相同的输出状态,确保网络达成共识

EVM为计算提供三种不同类型的存储。栈是一个限制为1024个元素的后进先出(LIFO)结构,用于即时操作值。内存是一个可无限扩展的字节数组,仅在单次消息调用期间持续存在,在执行间被重置。存储是与每个账户">合约账户永久关联的持久键值存储,合约在其中跨交易维护其长期状态。这些存储类型在燃料定价上不同——栈和内存操作便宜,而存储操作昂贵,以防止链">区块链膨胀。

在执行期间,合约代码可以访问关键的上下文信息:它可以读取消息发送方的地址、发送的以太币数量、调用方提供的数据载荷,以及区块级属性如当前区块号、时间戳矿工地址。代码可以向调用方返回一个输出字节数组,并且可以向其他合约发送消息或创建新合约。这种执行模型是图灵完备的——循环和复杂的控制流是可能的——但燃料机制确保所有计算在有限时间内终止,通过经济手段而非语言限制解决了停机问题。

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

以太坊链">区块链与比特币的基本相似,作为包含所有已执行交易的数据库。然而,比特币只存储交易列表,而以太坊同时存储交易列表和最新状态。以太坊中的每个区块包含前一个区块的哈希值、状态根(代表整个状态的默克尔帕特里夏树的根哈希)、交易根、收据根(存储交易执行数据),以及难度值、时间戳和nonce值。状态本身是一棵大型默克尔帕特里夏树,将地址映射到账户对象,每个账户都有余额、nonce、代码(如果有的话)和存储。

Ethereum APPLY BLOCK function processing transactions and updating state

以太坊使用了GHOST(贪婪最重观察子树)协议的修改版本,以解决快速出块时间带来的安全问题。在传统的最长链协议中,快速出块会导致高孤块率,降低网络安全性并增加中心化风险,因为大型矿工在孤块上浪费的计算更少。GHOST协议将孤块(在以太坊中称为"叔块")纳入最长链的计算中,并为叔块提供部分奖励,激励矿工引用它们。这使得以太坊能够在保持网络安全的同时,维持大约12秒的目标出块时间。

挖矿算法与比特币的工作量证明类似,要求矿工找到一个nonce,使得区块的哈希值低于特定的难度目标。然而,以太坊的内存密集型挖矿算法(Ethash)被设计为抗ASIC的,促进更去中心化的挖矿生态系统。难度根据出块时间动态调整,以维持约12秒的目标,确保稳定的区块生产,而GHOST协议在比特币平均10分钟更快的出块时间下提供安全保障。

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

可以在以太坊上构建的应用大致分为三大类。第一类是金融应用,为用户提供更强大的方式来管理和签订涉及资金的合约。这包括子货币、金融衍生品、对冲合约、带提取限额的储蓄钱包、自动分配资金的遗嘱,甚至是根据验证的工作完成情况计算薪酬的雇佣合约。这些应用利用以太坊的可编程性来创建在传统系统甚至比特币上都不可能或极其难以实现的复杂金融工具。

第二类是半金融应用,涉及资金但也有大量非货币成分。一个完美的例子是为计算问题的解决方案设立的自动执行的悬赏。某人可以发布一个计算问题和奖励,合约可以自动验证提交的解决方案并向第一个正确答案支付悬赏金。这一类别连接了纯金融和其他领域,利用经济激励来解决问题或协调行为。

第三类是与金钱完全无关的应用,例如在线投票和去中心化治理系统。这些非金融应用展示了以太坊作为通用平台的灵活性。例子包括类似域名币的去中心化域名系统、信誉系统、去中心化文件存储和组织治理工具。在所有这些应用类型中,代币系统已成为最常见和最基本的类型,作为许多其他应用的构建基础。

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

代币系统在以太坊上实现起来出人意料地简单,尽管它是最强大和最常见的应用之一。在其核心,代币系统只是一个具有单一操作的数据库:从账户A减去X个单位并向账户B添加X个单位,条件是A在交易前至少拥有X个单位且交易由A授权。实现这一点需要维护一个地址到余额的映射,并提供一个在账户之间转移代币之前执行适当检查的转账函数。

基本代币系统的合约代码非常简单,可以用几行代码编写。它由一个将地址映射到余额的数据结构、一个分配初始代币供应量的初始化函数,以及一个在执行转账前检查发送方余额和授权的转账函数组成。这种简单性与在比特币上实现类似系统所需的复杂性形成了鲜明对比,后者由于比特币受限的脚本能力而需要大量的变通方法和限制。

以太坊上的代币可以代表几乎任何有价值的东西。它们可能代表具有自己货币政策的子货币、追踪外部资产的金融衍生品、拥有分红权的公司股份、客户计划中的积分、黄金或石油等大宗商品,甚至是实物财产的表示。以太坊的可编程性允许这些代币具有管理其行为的任意规则,例如转账限制、自动销毁机制、分红分配或治理权利。这种灵活性使代币系统成为以太坊生态系统的基础构建模

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

金融衍生品是以太坊智能合约最基本和最重要的应用之一。一个简单的对冲合约展示了基本机制:甲方存入价值1000美元的一定数量以太币,乙方存入等值金额,合约使用数据源记录当时以太币的美元价值。30天后,合约重新计算价值,将价值1000美元的以太币发送给甲方,剩余部分发送给乙方。如果以太币价格上涨,甲方收到的以太币较少但维持1000美元价值;如果价格下跌,甲方收到更多以太币以维持该价值。这使得甲方可以对冲波动性风险,而乙方则对价格走势进行投机。

此类合约的实现需要通过预言机合约或数据源来访问外部数据。这些预言机提供价格信息、天气数据或合约正确执行所需的其他现实世界信息。虽然预言机引入了信任依赖,但可以通过冗余设计和加密经济激励来提供可靠数据。合约本身只需查询预言机,根据该数据执行计算,并按照其编程逻辑分配资金。

稳定币和更复杂的金融工具可以使用类似的机制构建。稳定币合约可以维护以太币储备并发行锚定法定货币的代币,根据价格源自动调整供应量或抵押要求。期权合约、期货合约、互换合约以及其他通常需要复杂法律框架和可信中介的衍生品可以被编码为自动执行的智能合约。这种可编程金融基础设施在维护区块链技术的透明性和安全保证的同时,实现了复杂的金融工程。

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

类似域名币的域名注册系统在以太坊上可以轻而易举地实现,是身份系统最简单的例子。合约维护一个包含键值表的数据库,将名称映射到关联数据(如IP地址、公钥或其他信息)。任何人都可以通过向合约发送交易并附上少量注册费来注册一个名称,前提是该名称尚未被占用。所有者可以随时更新关联数据,名称可以根据合约中编码的规则设置为可转让或永久性的。

在此基础上可以构建更高级的身份系统,包括信誉评分、信任网络关系和去中心化身份验证。例如,合约可以基于已验证的交易、同行评级或任务完成情况来维护信誉评分。这些评分将是公开可见的,并与特定地址进行密码学绑定,创建一个跨应用跟随用户的可移植信誉。信任网络系统可以允许用户为他人的身份背书,构建有助于区分合法用户和不良行为者的社交图谱。

当与其他应用集成时,此类身份和信誉系统变得特别强大。市场可以要求卖家达到最低信誉评分,借贷平台可以根据借款人的信誉调整利率,社交网络可以使用信任网络来过滤垃圾信息和欺诈内容。通过提供任何应用都可以查询的共享身份基础设施,以太坊实现了一类不依赖中心化身份提供商或专有信誉系统的新型信任应用。

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

去中心化文件存储可以通过以太坊合约来实现,在需要存储的用户和提供存储的供应商之间进行协调。在"去中心化Dropbox"模式中,用户按月付费上传文件,合约将付款分配给证明自己实际存储了数据的存储供应商。证明机制通过定期的密码学挑战实现:合约随机选择文件的部分内容,并要求供应商提供默克尔树证明,证明他们拥有该数据。挑战失败或下线的供应商将失去其押金和未来的付款流。

这种方法相比中心化存储有几个优势。默克尔树证明实现了高效验证——用户和合约可以在不下载整个文件的情况下确认文件可用性。该系统自然地将文件分布在多个独立的供应商之间,在无需显式复制协议的情况下创建冗余。经济激励使供应商的行为与用户需求保持一致:供应商通过可靠存储数据赚钱,如果未能做到则亏钱。这消除了中心化存储解决方案中固有的信任需求。

此类系统的存储成本有可能因多种原因而低于中心化替代方案。消除垄断定价使市场竞争将成本推至接近实际存储成本。多个用户存储类似文件产生的隐性冗余可以减少总存储需求。无需昂贵的数据中心基础设施或企业管理费用。然而,在支付机制、确保足够的供应商参与以及管理冗余与成本之间的权衡方面仍然存在挑战。尽管存在这些挑战,去中心化存储展示了以太坊如何仅通过经济激励来协调复杂的多方交互。

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

去中心化自治组织(DAO)是一个虚拟实体,拥有一组成员或股东,他们共同有权花费该实体的资金并修改其代码。典型的DAO遵循一个简单规则:需要67%的成员同意才能做出支出决定或修改组织的代码。成员可以提交提案、对提案投票,如果提案获得足够支持,合约将自动执行该决定。成员份额可以是可转让的,允许DAO参与权的流动市场,不同类别的份额可以拥有不同的投票权或经济权益。

最简单的DAO设计是一个自我修改的合约,维护一个成员列表,并要求三分之二多数投票来更改合约的任何方面,包括其自身的投票规则。成员以交易的形式提交代码变更,其他成员投票,达到阈值后合约将自行更新。更复杂的设计可能包括委托投票系统,成员可以将投票权分配给代表,或者流动民主,投票可以被委托但在重要决定时可以随时收回。

DAO可以服务于超越简单资金管理的各种目的。DAO可以作为去中心化公司运作,雇佣承包商、购买服务并向股东分配利润——所有这些都由智能合约代码而非传统法律结构治理。它可以作为去中心化投资基金运作,由成员投票决定资助哪些项目。它可以管理公共资源,由利益相关者投票决定分配规则。关键洞察在于,通过将治理规则编码为透明的、不可变的代码并将其与经济利益绑定,DAO可以在不需要传统等级管理或法律执行的情况下协调群体决策。

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

除了已经讨论的主要类别之外,以太坊还支持众多其他应用。带有复杂安全功能的储蓄钱包可以施加每日提取限额,同时提供用于恢复的紧急密钥,在保持最终控制权的同时保护用户免受盗窃。农作物保险合约可以根据天气数据源自动向农民支付赔偿,消除理赔处理过程并减少管理开销。点对点赌博应用可以在没有任何可信中介的情况下运作,智能合约持有赌注并根据可验证的随机数或现实世界的事件数据自动向赢家支付。

链上预测市场允许用户对未来事件下注,通过群体智慧创建强大的预测机制。这些可以通过谢林币(SchellingCoin)风格的协议来增强,以创建去中心化预言机:参与者独立报告数据(如选举结果或天气状况),与多数一致的报告获得奖励,而异常值则受到惩罚。这种加密经济方法激励诚实报告,可以为其他合约提供可靠的现实世界数据,而无需信任任何单一预言机提供者。

多重签名钱包是另一个重要应用,实现多方对资金的共同控制。一个2-of-3多重签名钱包可能要求三个指定方中的任意两个批准交易才能花费资金,适用于托管安排、企业金库或个人安全。去中心化市场可以结合身份系统、信誉评分、托管合约和争议解决机制来实现无需中心化平台的点对点商务。这些应用中的每一个都展示了以太坊的可编程性如何实现新的信任模型和组织结构。

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

以太坊对修改版GHOST协议的实现包括叔纳入和奖励的具体规则。叔块必须是当前区块祖先的直接子块(回溯2到7代),必须是有效的区块头,必须与之前的叔块不同,且不能是当前区块的直接祖先。叔块获得标准区块奖励的87.5%,而包含叔块的区块每包含一个叔块获得额外3.125%的奖励(最多两个叔块)。这种激励结构鼓励矿工引用他们观察到的孤块,增强网络安全,同时奖励在网络传播中暂时运气不佳的矿工。

费用系统基于"燃料"的概念,每个计算操作都有固定的燃料成本。例如,一次乘法运算消耗5个燃料单位,一次SHA256哈希运算消耗20个燃料单位,每笔交易的基础成本为21,000个燃料单位。用户指定燃料上限(愿意消耗的最大燃料量)和燃料价格(每单位燃料愿意支付的以太币数量)。这个系统有多重目的:通过确保所有计算都需要付费来防止无限循环和拒绝服务攻击,创建一个用户通过燃料价格竞价的区块空间市场,并允许矿工设定愿意接受的最低燃料价格来保护网络资源。

Ethereum supply growth rate comparing linear issuance to Bitcoin decreasing growth

可扩展性仍然是一个重大关切,因为每个节点">全节点必须处理每笔交易以验证状态。当前的区块链架构难以匹配中心化系统的交易吞吐量。潜在的解决方案包括状态分片——不同节点处理不同的交易子集,以及从工作量证明权益证明共识的转变——这可以实现更高效的区块生产。使用默克尔证明的轻客户端可以在不处理所有区块的情况下验证交易,但总得有人处理所有内容。这些可扩展性挑战代表了对以太坊长期可行性至关重要的活跃研究和开发领域。

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

以太坊协议最初被构想为加密货币的升级版本,通过高度通用的编程语言提供链上托管、提取限额和金融合约等高级功能。然而,以太坊协议远不止于货币。围绕去中心化文件存储、去中心化计算和去中心化预测市场的协议,以及数十个其他概念,有潜力大幅提高计算行业的效率,并通过首次添加经济层为其他点对点协议提供巨大推动力。

以太坊不是提供为特定用例设计的有限操作集,而是提供一种图灵完备的编程语言,使开发者能够构建他们所能设计的任何应用。想要发明自己的金融衍生品?创建自己的货币?在区块链上建立一个政府?这些在以太坊的脚本系统中都可以轻而易举地实现。该平台的力量不在于预测将构建什么应用,而在于提供使构建这些应用变得容易的基础设施。

以太坊协议实现的任意状态转换函数的概念提供了一个具有独特潜力的平台。以太坊不是一个封闭的、面向特定数据存储、赌博或金融应用的单一用途协议,而是在设计上就是开放式的,我们相信它极其适合在未来数年中作为大量金融和非金融协议的基础层。未来在以太坊上构建的应用可能是我们今天甚至无法想象的,而这种开放式的可能性代表了该平台的真正前景。

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

以太坊白皮书建立在加密货币和分布式系统研究的大量先前工作之上。基础性的比特币协议在中本聪2008年的原始论文《比特币:一种点对点电子现金系统》中进行了描述,该论文引入了基于链">区块链的数字货币概念。早期扩展比特币功能的尝试包括域名币——一个去中心化的域名注册系统,展示了货币之外的区块链应用,尽管受限于比特币的脚本能力。

彩色币白皮书提出了一种通过"着色"特定比特币来在比特币区块链上表示替代资产的方法,而万事达币试图在比特币之上创建一个用于更复杂金融工具的协议层。两者都凸显了在比特币之上构建的局限性,并推动了对更灵活平台的需求。去中心化自治公司的概念在《比特币杂志》中进行了探讨,为通过智能合约进行组织治理提供了理论基础。

关键技术组件包括用于轻客户端的简化支付验证(SPV)、用于高效数据验证的默克尔树,以及用于以太坊状态表示的帕特里夏树。GHOST(贪婪最重观察子树)协议在2013年的一篇密码学论文中进行了描述,解决了快速出块时间带来的安全问题,构成了以太坊共识机制的基础。这些参考文献代表了以太坊所建立的知识基础,结合了加密货币、分布式系统、密码学和博弈论的洞见,创建了一个通用区块链平台。