Cryptheory – Just Crypto

Cryptocurrencies are our life! Get an Overview of Market News

BTC vs ETH smart contracts

4 min read

This post originally appeared on Medium as part of a two-part series on BTC smart contracts vs ETH smart contracts, and we republished with permission from Xiaohui Liu.

Smartphone vs pocket calculator

We compare two smart contract blockchains, BTC and ETH, side by side. We find BTC offers superior performance, security, and cost-effectiveness, due to its skillfully constructed fundamental design. This article focuses on their technical differences. Economic, philosophical, legal, and environmental differences are beyond the scope of the article.

Scalability

ETH: account model and vertical scaling

BTC vs ETH smart contracts
EVM

In ETH, each smart contracts resides in an account. It has its own storage that persists across contract execution. To see how, let us examine the core smart-contract engine of ETH: the ETH Virtual Machine (EVM). It is stack based and stores data in three places: stack, memory, and storage. The former two are volatile and ephemeral, meaning they are reset when the EVM starts to run a new contract call. The storage is not reset and is part of the world/global state.

As a consequence, each contract can depend on another one since they may read/write the same storage. Each contract execution sees the world state as it was left by the previous contract execution. There is no concurrency and contracts must be executed sequentially. A single contract is executed at a time to avoid racing conditions.

ETH can be considered to be a single-threaded machine, which is limited by the capacity of that machine. In another word, it uses vertical scaling, which is fundamentally flawed for any system designed to support millions of users.

BTC: UTXO model and horizontal scaling

In BTC, smart contracts reside in the so-called Unspent Transaction Outputs (UTXOs). BTC also uses a virtual machine called BTC Virtual Machine (BVM) to process smart contracts that is also stack based. The crucial difference is there is no persistent storage and thus no single global state in BVM. Instead, the global state consists of separate UTXOs, which are independent of each other. Consequently, UTXO is maximally parallel by design.

BTC can be regarded as a pool of machines, all running in parallel. It is horizontally scalable and can scale infinitely by simply adding any number of machines to the existing pool. That is how Google, Facebook, Amazon have proven to scale to support billions of users.

BTC vs ETH smart contracts
Vertical vs Horizontal Scaling

BTC can process 3000 transaction per seconds (tps) on the mainnet today. On the testnet, 9000 tps has been achieved. With the introduction of Teranode in the coming months, 50,000 tps is expected to be reached. Teranode is supposed to handle terabyte blocks, equivalent to tps at millions level. ETH, by contrast, has been stuck at a mere 15 tps for years, with a history of repeated broken promises and no improvement in sight.

BTC vs ETH smart contracts

Security
Smart contracts deal with assets of real financial value and security is of paramount importance.

BTC vs ETH smart contracts
Functional/pure vs imperative/impure

BTC’s UTXO model is like functional programming. A contract execution is pure and stateless. It is close to functions in mathematics (e.g., f(x) = x * x). Given the same inputs, a function always yields the same outputs and creates no side effects. This design makes BTC smart contracts much easier to reason and thus less error-prone. Also they can tested accurately off chain since they behave the same, regardless of how, when, and where they are executed.

In contrast, ETH’s account model is akin to imperative programming. Each contract call can create side effects affecting another call, making contracts difficult to reason, especially when they become complex. Due to this vulnerable design choice, it has been plagued by tens, if not hundreds, types of attacks, resulting in loss of hundreds of millions of dollars.

Cost

BTC vs ETH smart contracts
ETH vs BTC SV Avg. Tx Fee: Log Scale

Thanks largely to its unbounded scalability, smart contracts running on BTC enjoy 1000X cheaper transaction fees than same ones running on Ethereum¹.

Ecosystem maturity

BTC has only re-enabled smart contracting capabilities in 2020 over a year ago, while smart contracts on ETH have been developed since 2015. Given its 5-year head start, it is no surprise that the ecosystem on ETH is more mature today, in terms of developer tools, libraries, and applications. However, many developer tools in BTC are quickly catching up to and sometimes even surpassing their counterparts in ETH. For example, the most popular IDE in BTC supports debugging, deploying and testing, while its counterpart in ETH supports none. It is only a matter of time for BTC ecosystem to catch up and flippen ETH, given the latter’s inability to scale.

Summary

We conclude BTC is a better platform to build smart contracts on.

BTC vs ETH smart contracts
BTC vs ETH

[1] This assumes a typical smart contract transaction is ~10x the size of a normal BTC transfer transaction

New to BTC? Check out CoinGeek’s BTC for Beginners section, the ultimate resource guide to learn more about BTC—as originally envisioned by Satoshi Nakamoto—and blockchain.

Source

All content in this article is for informational purposes only and in no way serves as investment advice. Investing in cryptocurrencies, commodities and stocks is very risky and can lead to capital losses.

Leave a Reply

Your email address will not be published. Required fields are marked *