Skip to main content

Ivy Playground for Bitcoin: Experimenting With the Future of Bitcoin Smart Contracts

Technical - Ivy Playground for Bitcoin: Experimenting With the Future of Bitcoin Smart Contracts

Blockchain developer Chain is releasing an open-source compiler and development environment for writing Bitcoin smart contracts using Ivy, a smart contract language developed in-house.

Chain is best known for the open-source Chain protocol and Chain Core, an enterprise blockchain infrastructure that facilitates financial transactions on scalable, private blockchain networks. An open-source developer edition of Chain Core is available to developers, with a testnet operated by Chain. Ivy was developed at Chain as a smart contract language for Chain Core. With Ivy for Bitcoin, which compiles to Bitcoin Script, Chain wants to make it easier for average programmers to write smart contracts for the public Bitcoin network.

By design, Bitcoin doesn’t include a Turing-complete programming language for smart contracts of arbitrary complexity. But this doesn’t mean that Bitcoin doesn’t support smart contracts. In fact, the simple, low-level, primitive operations included in Bitcoin’s native scripting language (Bitcoin Script) can be exploited to write smart contracts of significant complexity. “Bitcoin Script does provide a set of useful primitives — signature checks, hash computations, and absolute and relative timelocks — and the freedom to combine those primitives,” notes the Chain news release.

However, Bitcoin Script is not being fully used by software developers, which according to Chain is due to “the relative difficulty of reading and writing Bitcoin Script programs, and of creating and using addresses from those programs.” In fact, Bitcoin Script is a very low-level, assembly-like language, which doesn’t offer the readability and ease of use of high-level programming languages. Therefore, most Bitcoin programmers limit themselves to simple applications, without pushing Bitcoin Script to its limits.

The Chain developers want to change that with Ivy, a higher-level language that allows developers to create custom, SegWit-compatible Bitcoin addresses that enforce arbitrary combinations of conditions supported by the Bitcoin protocol, including signature checks, hash commitments and timelocks.

Earlier this year, Chain released Ivy Playground, a tool for designing, drafting and testing smart contracts on a Chain Core blockchain network with Ivy. Now, Chain is making Ivy available to Bitcoin developers and releasing Ivy Playground for Bitcoin, which allows developers to design, create and spend simulated Bitcoin contracts. The playground includes preloaded smart contract templates for Bitcoin and developer documentation.

A disclaimer states that Ivy is relatively untested prototype software and should be used for educational and research purposes only. “Do not attempt to use Ivy to control real Bitcoins,” warns the front-page document.

Besides Chain, other developers are realizing that Bitcoin needs more sophisticated smart contracts and user-friendly programming environments for smart contracts. Recently, blockchain developer Blockstream introduced Simplicity, a new programming language for blockchain-based smart contracts, intended for inclusion in Blockstream’s sidechains and eventually in Bitcoin. Lead developer Russell O’Connor said that “after extensive vetting,” Simplicity support could be considered for inclusion in one of the next releases of Bitcoin.

In the Blockstream announcement, O’Connor noted that Ivy’s programming language development efforts may be suitable for being compiled to Simplicity. But it now appears that Ivy’s progress toward these more sophisticated Bitcoin smart contracts is advancing faster than some might have expected.