UBTC高階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精髓的結果。在未來的部落格中,我們將詳細介紹其中的一些差異以及您可以用它們做些什麼。

原文連結:https://ubpay.io/uvm-vs-evm/,原作者:Maarten Swemmer(UBTC Senior IT Manager高階IT經理)
翻譯:幣圈張三丰

免責聲明:

  1. 本文版權歸原作者所有,僅代表作者本人觀點,不代表鏈報觀點或立場。
  2. 如發現文章、圖片等侵權行爲,侵權責任將由作者本人承擔。
  3. 鏈報僅提供相關項目信息,不構成任何投資建議

推荐阅读

;