How smart contracts on UnitedBitcoin are different from Ethereum

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.

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).

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.

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.

If we further compare the UVM and EVM, the following differences between EVM and UVM can be observed. See the table below.

EVM (Ethereum) UVM (UnitedBitcoin)
1. Transactions per second <20 100
2. History state Saved Not saved
3. Supported languages Solidity C#, LUA, Java, Kotlin
4. Sandbox No Yes
5. Architecture Dependent on the Ethereum chain architecture Independent of the chain
6. In case of execution failure Fee is consumed Fee is returned
7. Transaction model Account UTXO
8. Contract naming Not unique Unique on chain
9.Destroy a contract No Yes

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.

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.

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.

7. Transaction model
UVM follows the UTXO model of UnitedBitcoin and Bitcoin.

8. Contract naming
Contract names in UVM are unique. This provides benefits in certain cases.

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.

Make sure you subscribe to our newsletter to stay informed and feel free to test UVM smart contracts on our test net.