UBTC高级IT经理:我们的智能合约碾压以太坊

标题:How smart contracts on UnitedBitcoin are different from Ethereum? (UBTC的智能合约与以太坊的有何不同?)
原作者:Maarten Swemmer(UBTC Senior IT Manager高级IT经理)
翻译:币圈张三丰


In 2015 Ethereum was the first block chain to support (near Turing complete) smart contracts. In layman’s terms, a smart contracts is basically a small computer program that evaluates a set of logical rules (being the terms of the contract) and, based on that, can initiate transactions on a blockchain when predefined events happen. For example, they can be used to keep track of the flow of goods through a supply chain or cut out the middle men for taking / providing mortgages. Also, a common application that many new blockchain projects use, is the sale of tokens or coins through a so called ICO (initial coin offering) to pre-finance their project. In such case the smart contract often includes rules that define when the ICO itself or the project as a whole is a success and when not. In the latter case, for example, payments made could be (partially) returned automatically. In that way, the smart contract automatically executes promises made in the project’s white paper.
在2015年,以太坊是第一个支持(接近图灵完备)智能合约的区块链。通俗地说,智能合约基本上是一个小型计算机程序,用于评估一组逻辑规则(即合约条款),并据此在预定义事件发生时,可以在区块链上启动交易。例如,它可以通过供应链跟踪货物的流动,或者切断中间人直接接受/提供抵押贷款。此外,许多新的区块链项目通常应用的一个例子是,通过所谓的ICO(initial coin offering,首次代币发行)销售通证(token)或代币,以预先为其项目融资。在这种情况下,智能合约通常包含定义ICO本身或整个项目何时成功或失败的规则。例如,在后一种情况下,所支付的款项可以自动(部分地)返回。通过这种方式,智能合约自动执行项目白皮书中的承诺。


These smart contracts, or programs, are executed in a so called Virtual Machine. A virtual machine is a kind of computer inside a computer where the virtual machine provides a tightly controlled environment in which the smart contract can run safely. This ensures (apart from security for the host computer) that each contract always produces the same result on any computer that evaluates it. We wouldn’t want a contract to have different outcomes on different systems. In the case of Ethereum, it uses the Ethereum Virtual Machine (EVM).
这些智能合约或程序在所谓的虚拟机中执行。虚拟机可以说是“计算机内部的一种计算机”,提供严格控制的环境使智能合约可以安全地运行。这可以确保(除了主机的安全性之外)每个合约在评估它的任一台计算机上都产生相同的结果。我们不希望合约在不同的系统中有不同的结果。在以太坊中,它使用的是以太坊虚拟机(EVM)。


Smart contracts for the EVM need to be written in Solidity, a special programming language, designed exclusively for creating smart contracts for EVM. Programmers that need to create smart contracts for the Ethereum blockchain need to learn to program in Solidity first. 
为EVM创建的智能合约需要用Solidity(一种特殊的编程语言)编写,Solidity专门用于为EVM创建智能合约。程序员如果要在以太坊区块链上创建智能合约,需要首先学会用Solidity编程。


Instead of the EVM, UnitedBitcoin uses the so called UVM as the virtual machine of choice to run smart contracts. This is currently publicly being tested on the UB Testnet. The UVM aims to provide a number of alternative features (we consider them advantages) compared to Ethereum’s EVM. The most obvious one being the support for more common programming languages. People who want to create smart contracts now don’t need to learn Solidity. Instead they can use their favorite programming language. Languages currently supported are LUA, Kotlin, C# and Java. The UVM actually runs so called LUA bytecode. We’re able to support the other languages by providing the tools to convert the programming code into LUA bytecode.
UnitedBitcoin(UBTC比特联储)使用UVM作为运行智能合约的虚拟机,而不是EVM。目前,UBTC智能合约已经在测试链上公测


与以太坊的EVM相比,UVM旨在提供多种替代功能(我们认为它们更具优势)。最明显的是支持更常用的编程语言。 现在想创建智能合约的人不需要学习Solidity。相反,他们可以使用自己喜欢的编程语言。UVM目前支持的语言有LUA、Kotlin、C#和Java。UVM实际上运行LUA字节码。通过提供将编程代码转换为LUA字节码的工具,我们能够支持其它语言。


If we further compare the UVM and EVM, the following differences between EVM and UVM can be observed. See the table below.
如果我们进一步比较UVM和EVM,可以观察到UVM和EVM之间的以下差异。见下表。












Let’s briefly explain the differences:
让我们简要地解释一下这些差异:


1. Transactions per second 每秒交易量
The number of transactions per second is dependent on the block speed / block size of the supporting chain.
每秒交易量取决于支持链的区块速度/区块大小。


2. History state 历史记录状态
By not saving history states significant storage space is saved.
通过不保存历史记录状态,可以节省大量的存储空间。


3. Supported languages支持的编程语言
More languages will be supported in the future.
除了C#, Java, LUA, Kotlin,UVM将来会支持更多的编程语言。


4. Sandbox 沙盒
Through the command line a sandbox mode can be activated to enable testing of smart contracts.
通过命令行可以激活沙盒模式,以启用智能合约的测试。


5. Architecture 架构
Smart contracts on the UBTC chain rely on the Bitcoin architecture.
UBTC链上的智能合约把UVM移植到了比特币架构。


6. In case of execution failure执行失败的情况下
The system has a somewhat forgiving nature. If execution of a contract fails, the fee paid to execute it is returned. It’s even better to first properly test the contract in the sandbox of course.
UBTC智能合约系统有一种宽容的性质。如果合约的执行失败了,那么执行它的费用就会返还。当然,更棒的是可以先在沙盒中尽情地测试合约。


7. Transaction model交易模型
UVM follows the UTXO model of UnitedBitcoin and Bitcoin.
UVM遵循比特联储和比特币的UTXO(未花费交易输出)模型。


8. Contract naming 合约命名
Contract names in UVM are unique. This provides benefits in certain cases.
UVM中的合约命名是唯一的。这在特定情况下有诸多益处。


9. Destroying a contract 销毁合约
Contracts can have a state in which they can be destroyed, after losing this state, they cannot be destroyed and will remain ‘forever’.
合约可以处于一种状态,在这种状态下,它可以被销毁;在失去这种状态后,它不会被销毁,并将永远保持下去。


As you can see there are quite some differences. While some of these might be considered just of a philosophical nature, other improvements are the result of learnings from the Ethereum EVM. In future blogs we will go into more detail for some of these differences and what you can do with them.


正如你所看到的,UVM和EVM有很多不同之处。 虽然其中一些只是理念属性上的不同,但其它改进是来自吸取以太坊EVM精髓的结果。在未来的博客中,我们将详细介绍其中的一些差异以及您可以用它们做些什么。

猜你喜欢

转载自blog.csdn.net/bibitalk/article/details/80625605