首页 > 区块链知识 > 正文

精通以太坊 | 什么是以太坊

Halton 2018-12-24 20:30
What Is ETHereum什么是以太坊

  Ethereum is often described as "the world computer.” But what does that mean Let’s start with a computer science–focused description, and then try to decipher that with a more practical analysis of Ethereum’s capabilities and characteristics, while comparing it to Bitcoin and other decentralized information exchange platforms (or "blockchains" for short).

  以太坊通常被描述为“世界计算机”。但这意味着什么?让我们从聚焦于计算机科学的描述开始,然后尝试通过对以太坊的能力和特征进行更实际的分析来解读它,同时将其与比特币和其他去中心化的信息交换平台(或简称“区块链”)相比较。

  From a computer science perspective, Ethereum is a deterministic but practically unbounded state machine, consisting of a globally accessible singleton state and a virtual machine that applies changes to that state.

  从计算机科学的角度来看,以太坊是一个确定的但实际上无限的状态机,由全局可访问的单例状态和将更改应用于该状态的虚拟机组成。

  From a more practical perspective, Ethereum is an open source, globally decentralized computing infrastructure that executes programs called smart cONTracts. It uses a blockchain to synchronize and STOre the system’s state changes, along with a cryptocurrency called ether to meter and constrain execution resource costs.

  从更实际的角度来看,以太坊是一个开源的,全球去中心化的计算基础设施,执行称为智能合约的程序。它使用区块链来同步和存储系统的状态变化,以及称为ether的加密货币来计量和约束执行的资源成本。

  The Ethereum platform enables developers to build powerful decentralized applications with built-in economic functions. While providing high availability, auditability, transparency, and neutrality, it also reduces or eliminates censorship and reduces certain counterparty risks.

  以太坊平台使开发人员能够构建具有内置经济功能的强大的去中心化应用程序。在提供高可用性,可审计性,透明度和中立性的同时,它还减少或消除了审查并降低了某些交易双方的风险。

Compared to Bitcoin与比特币比较

  Many people will come to Ethereum with some prior experience of cryptocurrencies, specifically Bitcoin. Ethereum shares many common elements with other open blockchains: a peer-to-peer network connecting participants, a Byzantine fault–tolerant consensus algorithm for synchronization of state updates (a proof-of-work blockchain), the use of cryptographic primitives such as digital signatures and hashes, and a digital currency (ether).

  许多人会带着一些以往加密货币的经验来学习以太坊,特别是比特币。以太坊与其他开放区块链共享许多共同元素:连接参与者的点对点网络,用于状态更新同步的拜占庭容错一致性算法(工作量证明区块链),加密原语的使用比如数字签名和哈希,以及数字货币(以太)。

  Yet in many ways, both the purpose and construction of Ethereum are strikingly different from those of the open blockchains that preceded it, including Bitcoin.

  然而,在许多方面,以太坊的目的和结构都与之前的开放式区块链(包括比特币)截然不同。

  Ethereum’s purpose is not primarily to be a digital currency payment network. While the digital currency ether is both integral to and necessary for the operation of Ethereum, ether is intended as a utility currency to pay for use of the Ethereum platform as the world computer.

  以太坊的目的主要不是成为数字货币支付网络。虽然数字货币ether对于以太坊的运行是不可或缺和必要的,但ether的目的是作为实用货币(utility currency),用来支付使用称为世界计算机的以太坊平台。

  Unlike Bitcoin, which has a very limited scripting language, Ethereum is designed to be a general-purpose programmable blockchain that runs a virtual machine capable of executing code of arbitrary and unbounded complexity. Where Bitcoin’s Script language is, intentionally, constrained to simple TRUE/false evaluation of spending conditions, Ethereum’s language is Turing complete, meaning that Ethereum can straightforwardly function as a general-purpose computer.

  与具有非常有限的脚本语言的比特币不同,以太坊被设计为通用可编程区块链,其运行能够执行任意和无限复杂代码的虚拟机。比特币的脚本语言被故意限制为对支出条件的简单的真/假评估,以太坊的语言是图灵完备的,这意味着以太坊可以直接起到通用计算机的作用。

Components of a Blockchain区块链的组成部分

  The components of an open, public blockchain are (usually):

  开放的公共区块链的组成部分(通常)是:

  A peer-to-peer (P2P) network connecting participants and propagating transactions and blocks of verified transactions, based on a standardized "gossip" protocol

  Messages, in the form of transactions, representing state transitions

  A set of consensus rules, governing what constitutes a transaction and what makes for a valid state transition

  A state machine that processes transactions according to the consensus rules

  A chain of cryptographically secured blocks that acts as a journal of all the verified and accepted state transitions

  A consensus algorithm that decentralizes control over the blockchain, by forcing participants to cooperate in the enforcement of the consensus rules

  A game-theoretically sound incentivization scheme (e.g., proof-of-work costs plus block rewards) to economically secure the state machine in an open environment

  One or more open source software implementations of the above ("clients")

  基于标准化的“八卦”(gossip)协议连接参与者,以及传播交易和验证交易块的点对点(P2P)网络

  以交易形式表示状态转换的消息

  一组共识规则,用于管理构成交易的内容以及怎样才能实现有效的状态转换。

  一个根据共识规则处理交易的状态机

  一系列加密安全块,充当所有已验证和接受的状态转换的账目

  通过强制参与者一起合作执行共识规则来分散对区块链的控制的一致性算法

  在游戏理论上合理的激励方案(例如,工作量证明成本加区块奖励)以在开放环境中在经济上保护状态机

  上述的一个或多个开源软件实现(“客户端”)

  All or most of these components are usually combined in a single software client. For example, in Bitcoin, the reference implementation is developed by the Bitcoin Core open source project and implemented as the bitcoind client. In Ethereum, rather than a reference implementation there is a reference specification, a mathematical description of the system in the Yellow Paper (see Further Reading). There are a number of clients, which are built according to the reference specification.

  所有或大多数这些组件通常组合在一个单独软件客户端中。例如,在比特币中,参考实现由比特币核心开源项目开发,并作为bitcoind客户端实现。在以太坊中,有一个参考规范(黄皮书中对系统的数学描述(参见延伸阅读)),而不是参考实现。有许多客户端是根据参考规范构建的。

  In the past, we used the term "blockchain" to represent all of the components just listed, as a shorthand reference to the combination of technologies that encompass all of the characteristics described. Today, however, there are a huge variety of blockchains with different properties. We need qualifiers to help us understand the characteristics of the blockchain in question, such as open, public, global, decentralized, neutral, and censorship-resistant, to identify the important emergent characteristics of a "blockchain" system that these components allow.

  在过去,我们使用术语“区块链”来表示刚刚描述的所有组件,作为包含所描述的所有特征的技术组合的简写参考。然而,今天,有各种各样的具有不同属性的区块链。我们需要限定符来帮助我们理解所讨论的区块链的特征,例如开放,公共,全球,去中心化,中立和审查制度,以识别这些组件允许的“区块链”系统的重要新兴特征。

  Not all blockchains are created equal. When someone tells you that something is a blockchain, you have not received an answer; rather, you need to start asking a lot of questions to clarify what they mean when they use the word "blockchain." Start by asking for a description of the components in the preceding list, then ask whether this "blockchain" exhibits the characteristics of being open, public, ETC.

  并非所有区块链都是相同的。当有人告诉你某些东西是区块链时,你还没有得到答案;相反,你需要开始提出很多问题来澄清他们使用“区块链”这个词时的真正表达含义。首先要求对前面列表中的组件进行描述,然后询问这个“区块链”是否具有开放,公开等特征。

The Birth of Ethereum以太坊的诞生

  All great innovations solve real problems, and Ethereum is no exception. Ethereum was conceived at a time when people recognized the power of the Bitcoin model, and were trying to move beyond cryptocurrency applications. But developers faced a conundrum: they either needed to build on top of Bitcoin or start a new blockchain. Building upon Bitcoin meant living within the intentional constraints of the network and trying to find workarounds. The limited set of transaction types, data types, and sizes of data storage seemed to limit the sorts of applications that could run directly on Bitcoin; anything else needed additional off-chain layers, and that immediately negated many of the advantages of using a public blockchain. For projects that needed more freedom and flexibility while staying on-chain, a new blockchain was the only option. But that meant a lot of work: bootstrapping all the infrastructure elements, exhaustive testing, etc.

  所有伟大的创新都能解决真正的实际问题,以太坊也不例外。以太坊是在人们认识到比特币模型的力量,并试图超越加密货币应用程序的时候构思出来的。但开发人员面临一个难题:他们要么需要建立在比特币之上,要么开始一个新的区块链。以比特币为基础意味着生活在网络的故意限制之内并试图找到变通方法。有限的交易类型,数据类型和数据存储大小似乎限制了可以直接在比特币上运行的各种应用程序;任何其他的事情需要额外的off-chain(链下)层,这立即否定了使用公共区块链的许多优点。对于需要更多自由和灵活性同时保持/停留在链上的项目,新的区块链是唯一的选择。但这意味着很多工作:引导所有基础设施元素,详尽全面的测试等。

  Toward the end of 2013, Vitalik Buterin, a young programmer and Bitcoin enthusiast, started thinking about further extending the capabilities of Bitcoin and Mastercoin (an overlay protocol that extended Bitcoin to offer rudimentary smart contracts). In October of that year, Vitalik proposed a more generalized approach to the Mastercoin team, one that allowed flexible and scriptable (but not Turing-complete) contracts to replace the specialized contract language of Mastercoin. While the Mastercoin team were impressed, this proposal was too radical a change to fit into their development roadmap.

  2013年底,一个年轻的程序员和比特币爱好者Vitalik Buterin开始考虑进一步扩展比特币和Mastercoin(一种将比特币扩展到提供基本智能合约的覆盖协议)的功能。同年10月,Vitalik向Mastercoin团队提出了一种更为通用的方法,即允许灵活且可编写脚本(但不是图灵完备的)的合约取代Mastercoin的专业合约语言。虽然给Mastercoin团队留下来深刻的印象,但这个提议过于激进而无法适应他们的发展路线图。

  In December 2013, Vitalik started sharing a whitepaper that outlined the idea behind Ethereum: a Turing-complete, general-purpose blockchain. A few dozen people saw this early draft and offered feedback, helping Vitalik evolve the proposal.

  2013年12月,Vitalik开始分享一份白皮书,概述了以太坊背后的理念:图灵完备的通用区块链。几十个人看到了这个早期的草案并提供了反馈,帮助Vitalik改进了提案。

  Both of the authors of this book received an early draft of the whitepaper and commented on it. Andreas M. Antonopoulos was intrigued by the idea and asked Vitalik many questions about the use of a separate blockchain to enforce consensus rules on smart contract execution and the implications of a Turing-complete language. Andreas continued to follow Ethereum’s progress with great interest but was in the early stages of writing his book Mastering Bitcoin, and did not participate directly in Ethereum until much later. Dr. Gavin Wood, however, was one of the first people to reach out to Vitalik and offer to help with his C programming skills. Gavin became Ethereum’s cofounder, codesigner, and CTO.

  本书的两位作者都收到了白皮书的早期草稿并对其进行了评论。 Andreas M. Antonopoulos对这个想法很感兴趣,并向Vitalik询问了许多关于使用单独的区块链来强制执行在智能合约执行上的共识规则以及图灵完备语言含义的问题。Andreas 继续以极大的兴趣关注着以太坊的发展,但是当时他还在写《Mastering Bitcoin》一书的早期阶段,直到很久以后才直接参与以太坊。然而,Gavin Wood博士是第一批接触Vitalik并用他的C 编程技能提供帮助的人之一。 Gavin成为以太坊的联合创始人,联合设计者和CTO。

  As Vitalik recounts in his "Ethereum Prehistory" post:

  正如Vitalik在他的“Ethereum Prehistory(以太坊史前史)”中所述:

  This was the time when the Ethereum protocol was entirely my own creation. From here on, however, new participants started to join the fold. By far the most prominent on the protocol side was Gavin Wood…

  这是以太坊协议完全是我自己创造的时候。然而,从现在开始,新的参与者开始加入这一行列。到目前为止,协议方面最突出的是Gavin Wood ……

  Gavin can also be largely credited for the subtle change in vision from viewing Ethereum as a platform for building programmable money, with blockchain-based contracts that can hold digital assets and transfer them according to pre-set rules, to a general-purpose computing platform. This started with subtle changes in emphasis and terminology, and later this influence became stronger with the increasing emphasis on the “Web 3” ensemble, which saw Ethereum as being one piece of a suite of decentralized technologies, the other two being Whisper and Swarm.

  通过将以太坊视为构建可编程货币的平台(通过区块链的可以保存数字资产并根据预先设定的规则转移资产的合同) 到将以太坊视为一个通用计算平台,Gavin也可以在很大程度上归功于愿景的细微变化。 。这开始于重点和术语的微妙变化,随后越来越强调“Web 3”集合,将以太坊视为一组去中心化技术的一部分,另外两个是Whisper和Swarm,这种影响变得更强。

  Starting in December 2013, Vitalik and Gavin refined and evolved the idea, together building the protocol layer that became Ethereum.

  从2013年12月开始,Vitalik和Gavin一起完善和改进了这个想法,共同构建了成为以太坊的协议层。

  Ethereum’s founders were thinking about a blockchain without a specific purpose, that could support a broad variety of applications by being programmed. The idea was that by using a general-purpose blockchain like Ethereum, a developer could program their particular application without having to implement the underlying mechanisms of peer-to-peer networks, blockchains, consensus algorithms, etc. The Ethereum platform was designed to abstract these details and provide a deterministic and secure programming environment for decentralized blockchain applications.

  以太坊的创始人正在考虑没有特定目的的区块链,通过编程可以支持各种各样的应用程序。这个想法是通过使用像以太坊这样的通用区块链,开发人员可以编写他们的特定应用程序,而无需实现点对点网络,区块链,共识算法等底层机制。以太坊平台旨在抽象这些细节并为去中心化区块链应用程序提供确定的和安全的编程环境。

  Much like Satoshi, Vitalik and Gavin didn’t just inVENt a new technology; they combined new inventions with existing technologies in a novel way and delivered the prototype code to prove their ideas to the world.

  就像中本聪,Vitalik和Gavin不仅仅发明了一项新技术;他们以新颖的方式将新发明与现有技术相结合,并提供原型代码,向世界证明他们的想法。

  The founders worked for years, building and refining the vision. And on July 30, 2015, the first Ethereum block was mined. The world’s computer started serving the world.

  创始人工作多年,构建和完善愿景。 2015年7月30日,第一个以太坊区块被开采/挖矿。世界计算机开始为世界服务。

NoteVitalik Buterin’s article "A Prehistory of Ethereum" was published in September 2017 and provides a fascinating first-person view of Ethereum’s earliest moments.You can read it at https://vitalik.ca/general/2017/09/14/prehistory.html.NoteVitalik Buterin的文章“以太坊的史前史”于2017年9月出版,为以太坊最早的时期提供了一个吸引人的第一人称视角。你可以在这里阅读 https://vitalik.ca/general/2017/09/14/prehistory.html.Ethereum’s Four Stages of Development以太坊的四个发展阶段

  Ethereum’s development was planned over four distinct stages, with major changes occurring at each stage. A stage may include subreleases, known as "hard forks," that change functionality in a way that is not backward compatible.

  以太坊的发展计划分为四个不同的阶段,每个阶段都会发生重大变化。一个阶段可以包括称为“硬分叉”的子发布,其以不向后兼容的方式改变功能。

  The four main development stages are codenamed Frontier, Homestead, Metropolis, and Serenity. The intermediate hard forks that have occurred (or are planned) to date are codenamed Ice Age, DAO, Tangerine Whistle, Spurious Dragon, Byzantium, and Constantinople. Both the development stages and the intermediate hard forks are shown on the following timeline, which is "dated" by block number:

  四个主要的发展阶段的代号为Frontier,Homestead,Metropolis和Serenity。到目前为止(或计划)发生的中间硬分叉代号为Ice Age,DAO,Tangerine Whistle,Spurious Dragon,Byzantium和Constantinople。发展阶段和中间硬分叉都显示在以下时间轴上,该时间轴按区块编号“标注日期”:

  Block #0

  Frontier—The initial stage of Ethereum, lasting from July 30, 2015, to March 2016.

  Frontier(前沿)—以太坊的初始阶段,持续时间为2015年7月30日至2016年3月。

  Block #200,000

  Ice Age—A hard fork to introduce an exponential difficulty increase, to motivate a transition to PoS when ready.

  Ice Age(冰河时代)—引入指数难度增加的硬分叉,以便在准备就绪时激励过渡到PoS。

  Block #1,150,000

  Homestead—The second stage of Ethereum, launched in March 2016.

  Block #1,150,000

  Homestead(家园)—以太坊的第二阶段,于2016年3月推出。

  Block #1,192,000

  DAO—A hard fork that reimbursed victims of the hacked DAO contract and caused Ethereum and Ethereum Classic to split into two competing systems.

  Block #1,192,000

  DAO—一个硬分叉,用于赔偿被攻击的DAO合约的受害者,并导致以太坊和以太坊经典分裂成两个竞争系统。

  Block #2,463,000

  Tangerine Whistle—A hard fork to change the gas calculation for certain I/O-heavy operations and to clear the accumulated state from a denial-of-service (DoS) attack that exploited the low gas cost of those operations.

  Block #2,463,000

  Tangerine Whistle—一个硬分叉,用于改变某些非常消耗I/O操作的gas计算,并清除利用这些操作的低gas成本的拒绝服务(DoS)攻击的累积状态。

  Block #2,675,000

  Spurious Dragon—A hard fork to address more DoS attack vectors, and another state clearing. Also, a replay attack protection mechanism.

  Block #2,675,000

  Spurious Dragon(虚假的龙)—一个硬分叉,用来解决更多的DoS攻击向量,以及另一个状态清除。另外,还有一种重放攻击保护机制。

  Block #4,370,000

  Metropolis Byzantium—Metropolis is the third stage of Ethereum, current at the time of writing this book, launched in October 2017. Byzantium is the first of two hard forks planned for Metropolis.

  Block #4,370,000

  Metropolis Byzantium(大都会拜占庭)—Metropolis是以太坊的第三个阶段,目前正在撰写本书时,于2017年10月推出。Byzantium是Metropolis计划的两个硬分叉中的第一个。

  After Byzantium, there is one more hard fork planned for Metropolis: Constantinople. Metropolis will be followed by the final stage of Ethereum’s deployment, codenamed Serenity.

  在Byzantium之后,还有一个为Metropolis计划的硬分叉:Constantinople(君士坦丁堡)。Metropolis之后将是以太坊部署的最后阶段,代号为Serenity(宁静)。

Ethereum: A General-Purpose Blockchain以太坊:通用区块链

  The original blockchain, namely Bitcoin’s blockchain, tracks the state of units of bitcoin and their ownership. You can think of Bitcoin as a distributed consensus state machine, where transactions cause a global state transition, altering the ownership of coins. The state transitions are constrained by the rules of consensus, allowing all participants to (eventually) converge on a common (consensus) state of the system, after several blocks are mined.

  最初的区块链,即比特币的区块链,跟踪比特币的单位状态及其所有权。您可以将比特币视为分布式共识状态机,其中交易引起全局状态转换,从而改变币的所有权。状态转换受到共识规则的约束,允许所有参与者在挖掘几个块之后(最终)收敛于系统的共同(共识)状态。

  Ethereum is also a distributed state machine. But instead of tracking only the state of currency ownership, Ethereum tracks the state transitions of a general-purpose data store, i.e., a store that can hold any data expressible as a key–value tuple. A key–value data store holds arbitrary values, each referenced by some key; for example, the value "Mastering Ethereum" referenced by the key "Book Title". In some ways, this serves the same purpose as the data storage model of Random Access Memory (RAM) used by most general-purpose computers. Ethereum has memory that stores both code and data, and it uses the Ethereum blockchain to track how this memory changes over time. Like a general-purpose stored-program computer, Ethereum can load code into its state machine and run that code, storing the resulting state changes in its blockchain. Two of the critical differences from most general-purpose computers are that Ethereum state changes are governed by the rules of consensus and the state is distributed globally. Ethereum answers the question: "What if we could track any arbitrary state and program the state machine to create a world-wide computer operating under consensus"

  以太坊也是一个分布式状态机。但是,以太网不仅仅跟踪货币所有权状态,而是跟踪通用数据存储的状态转换,比如可以保存任何可表示为键值元组的数据的存储。键值数据存储保存任意值,每个值由某个键引用;例如,键“Book Title”引用的值“Mastering Ethereum”。在某些方面,这与大多数通用计算机使用的随机存取存储器(RAM)的数据存储模型具有相同的目的。以太坊拥有存储代码和数据的内存,并使用以太坊区块链来跟踪内存随时间的变化情况。与通用存储程序计算机一样,以太坊可以将代码加载到其状态机中并运行该代码,将结果状态更改存储在其区块链中。与大多数通用计算机存在的两个重要区别是,以太坊状态变化受共识规则的约束,并且状态是全球分布的。以太坊回答了这个问题:“假如我们可以跟踪任意状态并对状态机进行编程以创建一个在共识下运行的全球计算机,那会怎么样?”

Ethereum’s Components以太坊的组件

  In Ethereum, the components of a blockchain system described in Components of a Blockchain are, more specifically:

  在以太坊中,Components of a Blockchain中描述的区块链系统的组件更具体地说有:

  P2P network

  Ethereum runs on the Ethereum main network, which is addressable on TCP port 30303, and runs a protocol called ÐΞVp2p.

  Consensus rules

  Ethereum’s consensus rules are defined in the reference specification, the Yellow Paper (see Further Reading).

  Transactions

  Ethereum transactions are network messages that include (among other things) a sender, recipient, value, and data payload.

  State machine

  Ethereum state transitions are processed by the Ethereum Virtual Machine (EVM), a stack-based virtual machine that executes bytecode (machine-language instructions). EVM programs, called "smart contracts," are written in high-level languages (e.g., Solidity) and compiled to bytecode for execution on the EVM.

  Data structures

  Ethereum’s state is stored locally on each node as a database (usually Google’s LevelDB), which contains the transactions and system state in a serialized hashed data structure called a Merkle Patricia Tree.

  Consensus algorithm

  Ethereum uses Bitcoin’s consensus model, Nakamoto Consensus, which uses sequential single-signature blocks, weighted in importance by PoW to determine the longest chain and therefore the current state. However, there are plans to move to a PoS weighted voting system, codenamed Casper, in the near future.

  Economic security

  Ethereum currently uses a PoW algorithm called Ethash, but this will eventually be dropped with the move to PoS at some point in the future.

  Clients

  Ethereum has several interoperable implementations of the client software, the most prominent of which are Go-Ethereum (Geth) and Parity.

  点对点网络

  以太坊在以太坊主网络上运行,可在TCP端口30303上寻址,并运行一个名为ÐΞVp2p的协议。

  共识规则

  以太坊的共识规则在参考规范黄皮书中定义(参见延伸阅读)。

  交易

  以太坊交易是包括(除了别的之外)发送者,接收者,价值和数据有效载荷的网络消息。

  状态机

  以太坊状态转换由以太坊虚拟机(EVM)处理,这是一个执行字节码(机器语言指令)的基于堆栈的虚拟机。被称为“智能合约”的EVM程序以高级语言(例如,Solidity)编写,并被编译为字节码以在EVM上执行。

  数据结构

  以太坊的状态以数据库(通常是Google的LevelDB)的形式存储在每个本地节点上,该数据库包含称为Merkle Patricia Tree的序列化哈希数据结构中的交易和系统状态。

  共识算法

  以太坊使用比特币的共识模型,中本共识,它使用顺序单一签名区块,由PoW加权重要性来确定最长链,从而确定当前状态。但是,有计划在不久的将来转向代号为Casper的PoS加权投票系统。

  经济安全

  以太坊目前使用一种名为Ethash的PoW算法,但最终将在未来的某个时刻转向PoS。

  客户端

  以太坊有几种可互操作的客户端软件实现,其中最突出的是Go-Ethereum(Geth)和Parity。

Further Reading延伸阅读

  The following references provide additional information on the technologies mentioned here:

  以下参考资料提供了有关此处提及的技术的其他信息:

  The Ethereum Yellow Paper: https://ethereum.github.io/yellowpaper/paper.pdf

  The Beige Paper, a rewrite of the Yellow Paper for a broader audience in less formal language:https://github.com/chronAEon/beigepaper

  ÐΞVp2p network protocol: http://bit.ly/2quAlTE

  Ethereum Virtual Machine list of resources: http://bit.ly/2PmtjiS

  LevelDB database (used most often to store the local copy of the blockchain): http://leveldb.org

  Merkle Patricia trees: https://github.com/ethereum/wiki/wiki/Patricia-Tree

  Ethash PoW algorithm: https://github.com/ethereum/wiki/wiki/Ethash

  Casper PoS v1 Implementation Guide: http://bit.ly/2DyPr3l

  Go-Ethereum (Geth) client: https://geth.ethereum.org/

  Parity Ethereum client: https://parity.io/

Ethereum and Turing Completeness以太坊和图灵完备性

  As soon as you start reading about Ethereum, you will immediately encounter the term "Turing complete." Ethereum, they say, unlike Bitcoin, is Turing complete. What exactly does that mean

  一旦你开始阅读以太坊,你会立即遇到“图灵完备”这个词。他们说,以太坊与比特币不同,是图灵完备的。这到底是什么意思呢?

  The term refers to English mathematician Alan Turing, who is considered the father of computer science. In 1936 he created a mathematical model of a computer consisting of a state machine that manipulates symbols by reading and writing them on sequential memory (resembling an infinite-length paper tape). With this construct, Turing went on to provide a mathematical foundation to answer (in the negative) questions about universal computability, meaning whether all problems are solvable. He proved that there are classes of problems that are uncomputable. Specifically, he proved that the halting problem (whether it is possible, given an arbitrary program and its input, to determine whether the program will eventually stop running) is not solvable.

  该术语指的是英国数学家阿兰·图灵,他被认为是计算机科学之父。 1936年,他创建了一个计算机的数学模型,该计算机由状态机组成,通过在顺序存储器上读取和写入符号来操纵符号(类似于无限长的纸带)。通过这种结构,图灵继续提供一个数学基础来回答(否定地)有关通用可计算性的问题,这意味着是否所有问题都是可解决的。他证明了存在一些无法计算的问题。具体来说,他证明了停止问题(无论是否有可能,给定一个任意程序及其输入,以确定程序是否最终会停止运行)是不可解决的。

  Alan Turing further defined a system to be Turing complete if it can be used to simulate any Turing machine. Such a system is called a Universal Turing machine (UTM).

  阿兰·图灵进一步将一个系统定义为图灵完备的,如果它可以用于模拟任何图灵机。这种系统被称为通用图灵机(UTM)。

  Ethereum’s ability to execute a stored program, in a state machine called the Ethereum Virtual Machine, while reading and writing data to memory makes it a Turing-complete system and therefore a UTM. Ethereum can compute any algorithm that can be computed by any Turing machine, given the limitations of finite memory.

  以太坊能够在称为以太坊虚拟机的状态机中执行存储程序,同时向内存读取和写入数据,使其成为一个图灵完备系统,因此是一个UTM。规定有限存储器的限制下,以太坊可以计算任何可以由任何图灵机计算的算法。

  Ethereum’s groundbreaking innovation is to combine the general-purpose computing architecture of a stored-program computer with a decentralized blockchain, thereby creating a distributed single-state (singleton) world computer. Ethereum programs run "everywhere," yet produce a common state that is secured by the rules of consensus.

  以太坊的突破性创新是将存储程序计算机的通用计算架构与去中心化的区块链相结合,从而创建分布式单状态(单例)世界计算机。以太坊程序在任何地方运行,“无处不在”,但却产生了一个由共识规则保护的共同状态。

Turing Completeness as a "Feature"作为一个“特征”的图灵完备性

  Hearing that Ethereum is Turing complete, you might arrive at the conclusion that this is a feature that is somehow lacking in a system that is Turing incomplete. Rather, it is the opposite. Turing completeness is very easy to achieve; in fact, the simplest Turing-complete state machine known has 4 states and uses 6 symbols, with a state definition that is only 22 instructions long. Indeed, sometimes systems are found to be "accidentally Turing complete." A fun reference of such systems can be found at http://bit.ly/2Og1VgX.

  听到以太坊是图灵完备的,你可能会得出结论,这是一个在图灵不完备的系统中某种程度上缺乏的特征。相反,它恰恰相反。图灵完备性很容易实现;事实上,已知的最简单的图灵完备状态机有4个状态并使用6个符号,状态定义只有22个指令长。实际上,有时系统被发现是“意外的图灵完备”。可在此处找到此类系统的有趣参考:http://bit.ly/2Og1VgX.

  However, Turing completeness is very dangerous, particularly in open access systems like public blockchains, because of the halting problem we touched on earlier. For example, modern printers are Turing complete and can be given FILes to print that send them into a frozen state. The fact that Ethereum is Turing complete means that any program of any complexity can be computed by Ethereum. But that flexibility brings some thorny security and resource management problems. An unresponsive printer can be turned off and turned back on again. That is not possible with a public blockchain.

  但是,图灵完备性是非常危险的,特别是在公共区块链等开放式访问系统中,这是因为我们之前提到的停止问题。例如,现代打印机是图灵完备的,可以打印给定文件,将它们发送到冻结状态。以太坊是图灵完备的事实意味着任何复杂程序都可以由以太坊计算。但这种灵活性带来了一些棘手的安全和资源管理问题。无响应的打印机可以关闭并再次打开。而这在一个公共区块链是不可能的。

Implications of Turing Completeness图灵完备性的含义

  Turing proved that you cannot predict whether a program will terminate by simulating it on a computer. In simple terms, we cannot predict the path of a program without running it. Turing-complete systems can run in "infinite loops," a term used (in oversimplification) to describe a program that does not terminate. It is trivial to create a program that runs a loop that never ends. But unintended never-ending loops can arise without warning, due to complex interactions between the starting conditions and the code. In Ethereum, this poses a challenge: every participating node (client) must validate every transaction, running any smart contracts it calls. But as Turing proved, Ethereum can’t predict if a smart contract will terminate, or how long it will run, without