11-22-2024
BSV
$68.73
Vol 228.88m
-2.21%
BTC
$98779
Vol 125645.36m
3.04%
BCH
$495.11
Vol 2365.05m
10.18%
LTC
$90.16
Vol 1483.33m
7.04%
DOGE
$0.39
Vol 10376.39m
3.63%
Getting your Trinity Audio player ready...

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

Smartphone vs pocket calculator

We compare two smart contract blockchains, Bitcoin and Ethereum, side by side. We find Bitcoin 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

Ethereum: account model and vertical scaling

EVM

In Ethereum, 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 Ethereum: the Ethereum 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.

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

Bitcoin: UTXO model and horizontal scaling

In Bitcoin, smart contracts reside in the so-called Unspent Transaction Outputs (UTXOs). Bitcoin also uses a virtual machine called Bitcoin 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.

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

Vertical vs Horizontal Scaling

Bitcoin 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. Ethereum, by contrast, has been stuck at a mere 15 tps for years, with a history of repeated broken promises and no improvement in sight.

Security

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

Functional/pure vs imperative/impure

Bitcoin’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 Bitcoin 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, Ethereum’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

Ethereum vs Bitcoin SV Avg. Tx Fee: Log Scale

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

Ecosystem maturity

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

Summary

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

Bitcoin vs Ethereum

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

Recommended for you

David Case gets technical with Bitcoin masterclass coding sessions
Whether you're a coding pro or a novice, David Case's livestream sessions on the X platform are not to be...
November 21, 2024
NY Supreme Court’s ruling saves BTC miner Greenidge from closing
However, the judge also ruled that Greenidge must reapply for the permit and that the Department of Environmental Conservation has...
November 20, 2024
Advertisement
Advertisement
Advertisement