Smart contracts – self-executing pieces of code – are most commonly associated with the ethereum network. Long before Vitalik Buterin tried to sell a fake quantum mining computer and dreamed up his “global supercomputer”, however, Satoshi Nakamoto saw the potential for smart contracts, even though the term had yet to be popularized. The bitcoin blockchain is now a step closer to having its own self-executable agreements thanks to the arrival of Ivy.
Bitcoin is Getting Smarter
Ivy is an open source compiler developed by cryptographic ledger specialists Chain.com. It can be used to write bitcoin smart contracts into Segwit-compatible addresses. The range of functions that Bitcoin Script supports is more limited than those available on the “Turing-complete” ethereum network. This reduced functionality is one of bitcoin’s strengths however: maintaining network security is deemed more important than introducing untested code that has the potential to break things.
While the ethereum blockchain has remained intact, major bugs in its smart contracts have led to hundreds of millions of dollars being stolen or permanently locked away. The range of functions that Bitcoin Script can support is primarily limited to hash commitments, signature checks, and timelocks. Bitcoin’s script functionality has largely been overlooked in the blockchain’s eight years of existence, but Ivy looks set to change that.
Code Compiling Made Easy
In a blogpost announcing the release of Ivy, Chain explained:
Bitcoin allows you to write [smart] contracts using a low-level programming language, Bitcoin Script. Every Bitcoin address corresponds to a Bitcoin Script program. When you send bitcoins to an address, you are essentially locking them in a safety deposit box on the blockchain. These boxes are typically referred to as “unspent transaction outputs,” but we’ll refer to them as “contracts.” Each contract has an address, which corresponds to a program that must be satisfied in order to unlock and spend the bitcoins.
As a low-level assembly language, Bitcoin Script isn’t the most user-friendly codebase to work with, hence Ivy. Chain have now released Ivy Playground, a safe space for developers to play around with bitcoin smart contracts on a testnet. Because Ivy is at an early stage in its development, it still requires rigorous testing before it can be deemed safe for a trial in the wild.
To date, Bitcoin Script’s use cases have primarily been to create multisig wallets, although it’s also a component of scaling solutions such as the Lightning Network. Ivy provides a means of creating contract templates. Thereafter, a developer need only enter certain parameters before deploying the contract on a Segwit-compatible address.
Curiously, Satoshi made no mention of Bitcoin Script in his famous white paper, though it still featured in the first version of bitcoin ever released, 0.1. Although the digital currency’s scripting functionality is believed to have been added as more an afterthought than a key component, it is further evidence of Satoshi’s farsightedness. For all his genius, the first release of bitcoin contained a bug that would have allowed anyone to steal coins simply by using the OP_TRUE OP_RETURN scriptSig. This was hastily fixed.
Early Bitcoin Core developer Mike Hearn once acknowledged:
The scripting system always struck me as a rather late addition to the design. Satoshi admitted as much when he said that he added it after encountering an explosion of special cases as he designed various types of contracts….we never found a use case for 99% of the opcodes despite [Satoshi] having successfully designed (redesigned?) all the contract types he ever mentioned.
We will likely never know what Satoshi’s intentions were for Bitcoin Script. Seven years to the month since Satoshi’s last contact with the public, however, his assembly language is poised to be put to good use with the introduction of Ivy-enabled bitcoin smart contracts.
Do you think smart contracts will benefit bitcoin, or is this a feature best left to other blockchains? Let us know in the comments section below.
Images courtesy of Shutterstock, and Chain.com.
Keep track of the bitcoin exchange rate in real-time.
Use Bitcoin and Bitcoin Cash to play online casino games here.