This article assumes a basic understanding of blockchain technology in order to fully understand how smart contracts work.
Blockchain-based smart contracts have generated ample buzz recently as they could eventually build entirely autonomous organizations, enable self-regulated peer-to-peer insurance models, and facilitate the renting of all internet-connected-things. This article explores how smart contracts work. It provides a brief primer on the topic, then compares the coding, storage and execution of smart contracts on Bitcoin and Ethereum, the two permissionless blockchain protocols that have achieved scale thus far. While plenty of healthy skepticism still exists around smart contracts, ARK Invest believes Bitcoin and Ethereum will be instrumental in validating the potential of this budding innovation.
Primer on Smart Contracts
A smart contract refers to coded logic that moves digital assets when triggered by necessary events. It is akin to a series of “IF, THEN” statements, where the “ifs” are preconditions that must be met in order to trigger the “thens.” The idea fits well within blockchain technology because blockchains offer a guarantee of future execution, in a decentralized manner, once the smart contract logic is stamped within a block.
The term smart contracts often puts mental imagery of complex documents in people’s minds, which ARK believes is misleading. This misconception explains why Mike Hearn, an early pioneer within the Bitcoin space, called smart contracts a misnomer in a November 2013 conversation on the matter. While he preferred the term conditional payments, ARK prefers broadening the term to conditional transactions to capture the idea that this technology can facilitate more than the transfer of money for goods and services.
Conditional transactions executed via a blockchain are computationally expensive because every computer that is part of the network needs to execute the same logic and update the state of the blockchain. In other words, each time a smart contract is triggered, every computer has to perform the same task, consuming considerable resources and making the process inefficient when compared to parallel processing architectures. Therefore, not every conditional transaction will be appropriate for execution via a blockchain, but rather only those use cases that demand the distributed and secure nature of a shared ledger. Once more sophisticated solutions are implemented—like sharding, which can help to better parallelize computing tasks and storage— conditional transactions may prove less computationally expensive to the network, further widening the scope of applications.
Coding of Smart Contracts
While Nick Szabo conceived the concept in the 1990s, Ethereum popularized the idea of smart contracts. It remains a common misconception that Bitcoin can’t facilitate the same range of functionality. Even though Ethereum currently has more flexibility in the programming languages that can be used—because it was designed with developers keenly in mind—the two blockchain platforms can accommodate the same smart contract functionality.
With its source code written in C++, coding for Bitcoin applications often occurs at a more granular layer, making it a less desirable sandbox for many new-age web and application developers. The high-level languages readily available within Ethereum, however, make smart contracts accessible to most developers. For example, Geth is available to Ethereum developers, which is implemented in Go, the easy-to-learn open source programming language that Google [GOOG] released in 2009. Go was created in part because the founders hated the complexity of C++. ARK believes people confuse “difficult” and “impossible” with regard to encoding complex smart contracts in Bitcoin. While it may currently be more difficult to encode complex smart contracts in Bitcoin, that does not mean it is impossible.
Storage and Execution of Smart Contracts
Bitcoin and Ethereum differ in the storage and execution of smart contracts, which became clear to us during conversations with relevant parties at Coala’s NYU Blockchain Workshops. We will start with Ethereum because it was designed specifically with smart contracts in mind and therefore easier to understand—while smart contracts are cleverly layered into bitcoin transactions.
Ethereum users load smart contracts into its blockchain via a transaction to the network that has a payload containing the logic of the contract. The transaction is not sent to a particular address. Instead, the nodes processing the transaction on the network recognize the “smart contract payload,” and create a smart contract address. The underlying logic and interactions for smart contracts can be seen on blockchain explorer sites like Ether.Camp. Once uploaded to the blockchain, the logic underlying a smart contract can be activated by sending to its address a transaction with the preconditions necessary to trigger it. Triggering a smart contract can lead to the sending of another transaction, triggering another contract, theoretically ad infinitum.
With Bitcoin smart contracts, it’s important to understand that each transaction exists as a data structure composed of inputs and outputs, as can be seen in a Bitcoin block explorer. In order to send bitcoin, users must provide certain inputs meeting pre-determined requirements that prove they own, and therefore have the authority to send, the bitcoin they claim to own. Users can also create contract transactions that require a more complex set of inputs in order to trigger the release of bitcoin. A simple example of more complex inputs is a multi-signature transaction, which requires more than one entity to sign off on the release of bitcoin, proving useful in escrow situations where perhaps two of three parties must vouch for a transfer.
Often surprising is the complexity of operations that can be created from the combination of simple operators. With the introduction of Segregated Witness (SegWit), the flexibility of Bitcoin’s scripting system will increase. Since the scripting system is responsible for creating the logic embedded within Bitcoin transactions, making the scripting system more dynamic will allow transaction types to be more dynamic as well. Additionally, Rootstock is working on building an easy to use smart contracts platform atop Bitcoin. Given the many ways to construct and execute a smart contract using the Bitcoin network, we recommend those further interested to read BitFury’s white paper, “Smart Contracts on the Bitcoin Blockchain.”
The promise of smart contracts is that once the logic is live, the underlying blockchain guarantees future execution as long as the necessary conditions are met. For example, a company employing smart contracts within Ethereum is Slock.it, which ties the unlocking of real world devices with blockchain technology. Imagine a world where you rent a house via AirBnB and all of the internet-connected-devices within the house are updated with information about your digital wallet and date of arrival. Then, whenever you want to release a service within that house, whether unlocking the fridge to get a beer, the WiFi to sip megabytes of data, or the autonomous car for a trip, you send a transaction to the house with a request for that service. The funds are deducted automatically from your account and the device is unlocked with no credit card intermediaries and perfect record keeping via the decentralized ledger of the underlying blockchain. If the house were connected to the bank which services its loan, you can imagine homes that pay off their own mortgages with the funds they accrue from renters.
One of the more abstract implementations of smart contracts is The DAO, with “DAO” standing for decentralized autonomous organization. Such an organization has no concrete leader, but is instead composed of a series of logic and rules embedded in an interconnected web of smart contracts. While it may seem like science fiction, in May 2016 The DAO raised $160 million in the world’s largest crowdfunding to date.
Smart contracts could increase capacity utilization of houses and other assets, decrease legal disputes thanks to flawless ledgers, and cut intermediary costs across the board. Given the efficiency, transparency and economic value that smart contracts will provide to a multitude of sectors and services, they could enable a productivity boost from currently stranded assets. ARK Invest believes Bitcoin likely will be the environment of choice for mission critical contracts requiring utmost security, while Ethereum will continue to push consensus past what previously was thought possible.
Please contact Chris Burniske on his Twitter handle @ARKBlockchain if you have any questions, concerns, or would like to discuss the topic further.