【LongHash Column】How to Build Advanced Smart Contracts on Bitcoin?

share
【LongHash Column】How to Build Advanced Smart Contracts on Bitcoin?

Bitcoin is currently the most popular cryptocurrency in the world. Whether in terms of liquidity, on-chain transaction volume, or any other indicator, Bitcoin's dominant position is undeniable.

However, due to technical reasons, developers often prefer Ethereum. This is because Ethereum is more flexible in building various applications and smart contracts. Over the years, many platforms have focused on developing advanced smart contract features, but Ethereum is clearly the leader in this particular field.

As these technologies are rapidly developing on Ethereum, Bitcoin is gradually becoming a tool for value storage. Some are trying to narrow the gap between Bitcoin and Ethereum by utilizing technologies such as the RSK sidechain compatible with Ethereum and the TBTC ERC-20 token.

Advertisement - Continue scrolling for more content

Another option is to upgrade the script functionality of Bitcoin itself. This is where the Simplicity language comes into play.

What is Simplicity?

Simplicity is a new Bitcoin programming language that offers greater flexibility in building smart contracts than the current Bitcoin network. This low-level language was created by Russell O'Connor, a developer at Blockstream.

Blockstream's CEO Adam Back explained in a recent online seminar: "It's a next-generation scripting language for Bitcoin and networks like Elements, Liquid (sidechains), and so forth."

While not Turing complete, Simplicity provides enough expressive power for developers looking to build most of the same types of applications currently on Ethereum.

Furthermore, Simplicity aims to make it easier for developers and users to verify the correctness, security, and cost of deploying smart contracts. "For security reasons, we really want to analyze before running programs," said David Harding, a technical writer focused on open-source software documentation, in the Noded Bitcoin podcast. "For Bitcoin, we don't allow Turing completeness, so we can statically analyze programs. Simplicity also doesn't achieve Turing completeness, so you can statically analyze programs."

It's worth noting that TBTC, mentioned above, was shut down shortly after its release on the Ethereum mainnet due to a bug found in the smart contract supporting ERC-20 tokens. Over the years, Ethereum smart contracts have faced several security issues, such as the Parity wallet multi-sig bug and the infamous DAO incident.

What Does Simplicity Mean for Bitcoin?

To explore the practical implications of Simplicity for Bitcoin, LongHash reached out to Dan Robinson, a Partner at Paradigm Research who has studied both Simplicity and Ethereum.

Robinson told us, "Simplicity is a broad upgrade to Bitcoin's scripting capabilities, rather than a collection of individual script upgrades throughout Bitcoin's history. As a 'feature-complete' instruction set, there will be little need for additional script upgrades in Bitcoin's future, although some upgrades may be necessary for efficiency improvements."

This can be viewed from the perspective of a soft fork. In the past, Bitcoin script upgrades were achieved through soft forks, requiring community consensus to activate on the network. With Simplicity enabled, anyone can effectively implement common soft fork changes using this language without requiring network nodes to update Bitcoin's consensus rules.

This approach serves two purposes: it accelerates Bitcoin development compared to the past and helps address the potential issue of Bitcoin protocol ossification. However, protocol ossification in Bitcoin is ultimately desirable as it effectively reflects the fundamental rules of the network, such as token policies, which are immutable and help thwart potential social attack vectors against the primary factors that give Bitcoin value.

An interesting implication is that "if today's Bitcoin deployed Simplicity scripts, it would be self-extensible," wrote Adam Back on Reddit, "improvements like Schnorr/Taproot and SIGHASH_NOINPUT could be directly realized."

Here, Back illustrates a soft fork solution, which is a type of addition that can be made without changing Bitcoin's consensus rules after enabling Simplicity. When asked for his thoughts on this, he clarified, "I think technically, Taproot extension can't be realized in the Simplicity language as Pieter Wuille said, but Schnorr can."

For Robinson, if Simplicity is indeed added to Bitcoin, the first noticeable effects would likely involve improvements that developers are currently researching, such as designs for payment channels like Eltoo, new signature algorithms, and possibly enhancements in privacy.

Robinson added, "What I'm more excited about is the development of a token standard, similar to Ethereum's ERC-20, which could lead to new applications like stablecoins, decentralized exchanges, and leveraged trading."

Differences in Simplicity between Ethereum and Bitcoin

If the Simplicity language is added to the Bitcoin mainnet, some may conclude that there is no longer a reason to continue using Ethereum. However, even with Simplicity in Bitcoin, there are still significant differences between it and Ethereum.

Robinson stated, "My interest in Simplicity isn't to make Bitcoin more 'Ethereum,' but to make Bitcoin more 'Bitcoin.'"

Despite the use of Simplicity, Bitcoin will continue to operate under the UTXO (Unspent Transaction Output) model opposed to Ethereum's account-based setup.

Robinson explained, "The UTXO model is excellent for efficiency in verification, but its trade-off is that it's hard to build applications to meet the needs of multi-party and contract interactions."

Additionally, Ethereum has made significant progress in network effects as a development platform, especially in the realm of smart contracts.

"The tools and developer ecosystem around Simplicity may take a long time to develop," said Robinson. "Simplicity isn't a human-readable language, so someone will need to develop a language to compile it and make it accessible to regular developers. Furthermore, a lot of research is needed for developing smart contract design platforms compatible with the UTXO model."

From a development perspective, Ethereum's network effects explain why RSK (a Bitcoin sidechain in Ethereum's style) has designed its platform to be compatible with Ethereum's virtual machine.

However, it remains unclear whether Bitcoin users will still need cryptocurrency applications similar to those on the Ethereum network in the end.

According to Robinson, many Bitcoin users have been critical of Ethereum for a long time due to oracle issues. The oracle problem has become an increasingly concerning issue in developing various decentralized applications (DeFi).

When Can Simplicity Be Implemented?

It's important to note that there is still a long way to go before Simplicity lands on the Bitcoin mainnet. However, it is expected that later this year, we may see this scripting language added to the Liquid sidechain first.

This marks a significant step towards real-world assets using the Simplicity language, but some developers, such as those focusing on privacy wallets for Bitcoin, have shown little interest in the Liquid sidechain due to its federated model.

When asked about this, Robinson said, "I don't think the federated nature of Liquid will compromise transactions. But it indeed makes it more challenging to attract a large number of developers or users."

According to Greg Maxwell, a long-time Bitcoin Core contributor and co-founder of Blockstream (known as nullc on Reddit), Simplicity can be added to Bitcoin through a soft fork by introducing a script versioning system via the SegWit upgrade. Of course, this is based on the assumption that community consensus can be established around changes that revolve around Bitcoin's consensus rules.

Grubles, working at Blockstream, told us, "I'm not sure how it would be deployed via a soft fork, but it won't replace anything on the mainnet or Liquid sidechain. It will only be a new address type that can be used alongside existing address types like Legacy, P2SH, Bech32."

Grubles added that they believe Ethereum has damaged the reputation of "smart contracts" as many problematic smart contracts have been deployed on the platform for years. Therefore, they feel that Bitcoin users who have been keeping an eye on Ethereum are unlikely to want to see smart contracts flexibly utilized on Liquid.

"I think it will be an interesting topic, but it will take a few years," Back added. "Precedents can be verified first on the sidechain."

This article is from our partner LONGHASH