Smart Contracts for Blockchains

by Jan 31, 2022Featured Article, News

What is a smart contract?

A smart contract is a decentralized application that executes business logic in response to events. Smart contract execution can result in the exchange of money, delivery of services, unlocking of content protected by digital rights management or other types of data manipulation such as changing the name on a land title. Smart contracts can also be used to enforce privacy protection by, for example, facilitating the selective release of privacy-protected data to meet a specific request.

There are a variety of architectures for how the programs underpinning smart contracts are developed, distributed, managed and updated. They can be stored as part of a blockchain or other distributed ledger technology, and integrated into various payment mechanisms and digital exchanges that can include bitcoin and other cryptocurrencies.

Despite the name, smart contracts are not legally binding contracts. Their main function is to programmatically execute business logic that performs various tasks, processes or transactions that have been programmed into them to respond to a given set of conditions. Legal steps must be undertaken to link this execution to legally binding agreements between parties.

How do smart contracts work?

A smart contract is a special kind of program that encodes business logic that runs on a special-purpose virtual machine baked into a blockchain or other type of distributed ledger. The process of creating a smart contract starts with business teams working with developers to describe their requirements for the desired behavior of the smart contract in response to various events or circumstances. Simple events could be conditions such as payment authorized, shipment received or a utility meter reading threshold. More sophisticated logic might encode more complex events such as calculating the value of a derivative financial instrument and processing a trade of the derivative, or automatically releasing an insurance payment in the event of a person’s death or a natural disaster.

The developers then work in a smart contract-writing platform to develop the logic and test it to ensure that it works as intended. After the application is written, it is handed off to another team for a security review. This could be an internal expert or a firm that specializes in vetting smart contract security. Once the contract has been approved, it is deployed on an existing blockchain or other distributed ledger infrastructure.

Once the smart contract is deployed, it is configured to listen to event updates from an “oracle,” which is essentially a cryptographically secured streaming data source. The smart contract executes once it receives the appropriate mix of events from one or more oracles.

Smart contract applications and blockchain

Blockchain is ideal for storing smart contracts because of the technology’s security and immutability. Smart contract data is encrypted on a shared ledger, making it virtually impossible to lose the information stored in the blocks.

Flexibility is another advantage of blockchain technology being incorporated into smart contracts. Developers can store almost any type of data in a blockchain, and they have a wide variety of transaction options to choose from.

Blockchain-based smart contracts are helping make transactions and other business processes more secure, efficient and cost-effective, thereby reducing transaction costs.

For example, in 2016, Cook County, Ill., used blockchain to create a database to transfer and track property titles. When these transactions occur, in addition to the traditional paper deed, the buyer receives a digital token that can be used as proof of ownership.

variety of industries could benefit from using blockchain-based smart contracts as part of their supply chains. Automating healthcare payments using smart contracts can reduce overbilling and prevent fraud. The music industry could record the ownership of music in the blockchain and then deploy a smart contract to ensure royalties are paid when the music is used for commercial purposes. Smart contracts and blockchain could benefit the automobile industry by storing readily available information about vehicle maintenance and accident and ownership history.

when the music is used for commercial purposes. Smart contracts and blockchain could benefit the automobile industry by storing readily available information about vehicle maintenance and accident and ownership history.

The most popular smart contract platform is Ethereum, which is also a widely used cryptocurrency platform. The Ethereum community has developed the Solidity language for writing smart contract applications that are designed to run on the Ethereum Virtual Machine (EVM) execution environment.

Other popular programming environments include the WebAssembly (WASM) language and the Digital Asset Modeling Language (DAML). WASM allows developers to create smart contracts that can run in a web browser and be integrated into blockchains and other distributed ledgers using various programming languages such as C, JavaScript, TypeScript and Rust. DAML is an enterprise-focused language that is designed to model various business use cases, and which also helps to enforce privacy safeguards.

Smart contract advantages

There are several potential business advantages from using smart contracts.

Cost efficiency. Smart contracts promise to automate business processes that span organizational boundaries. This can eliminate many operational expenses and save resources, including the personnel needed to monitor the progress of a complex process that executes in response to conditions that span companies.

Processing speed. Smart contracts can improve the processing speed of business processes that run across multiple enterprises.

Autonomy. Smart contracts are performed automatically by the network and reduce the need for a third party to manage transactions between businesses.

Reliability. Smart contracts can also take advantage of blockchain ledgers and other distributed ledger technologies to maintain a verifiable record of all activity related to execution of complex processes and that cannot be changed after the fact. It also supports automated transactions that remove the potential for human error and ensure accuracy in executing the contracts.

Common issues and challenges with smart contracts

There are numerous issues and challenges that need to be considered when planning a smart contract rollout.

Security. Smart contracts secure certain key elements in a business process that involves multiple parties. However, the technology is new, and hackers continue to identify new attack surfaces that allow them to compromise the intent of the businesses that specified the rules. In the early days of Ethereum, smart contract hackers managed to steal $50 million in cryptocurrency. The IEEE has also documented concerns about inconsistencies in the tools used to detect different vulnerabilities in smart contract security.

Integrity. One oracle (one of the streaming data sources that sends event updates) needs to protect against hackers faking events that trigger smart contracts into executing when they should not. It must be programmed to accurately generate events, which can be challenging for complex scenarios.

Alignment. Smart contracts can speed the execution of processes that span multiple parties regardless of whether they are in alignment with all parties’ intention and understanding. But this capability can also magnify the impact of the damage that can occur when events spiral out of control, particularly when there is no way to stop or unwind unintended behavior. The Gartner research firm has noted that this issue poses challenges in smart contract scalability and manageability that have yet to be fully addressed.

Management. Smart contracts are complicated to implement and manage. They are often configured in ways that make them difficult or impossible to change. Although this could be considered a security advantage, the parties cannot make any changes to the smart contract agreement or incorporate new details without developing a new contract.

The future of smart contracts

Smart contracts are complex, and their potential goes beyond the simple transfer of assets. They can execute transactions in a wide range of fields, from legal processes to insurance premiums to crowdfunding agreements to financial derivatives. Smart contracts have the potential to disintermediate the legal and financial fields by simplifying and automating routine and repetitive processes for which people currently pay banks and lawyers sizable fees.

The role of lawyers could also shift in the future as smart contracts gain such capabilities as adjudications of traditional legal contracts and customizable smart contract templates. Additionally, smart contracts’ ability not only to automate processes, but also to control behavior, as well as their potential for real-time auditing and risk assessments, can be beneficial for compliance.

Smart contracts also show promise in automating processes that run on IoT and edge computing devices. For example, a utility company might offer a service in which smart contracts execute in response to changes in power rates in coordination with devices built into power meters. For example, when prices reach a given threshold, a smart contract might automatically turn off or turn down power-hungry appliances such as air conditioners using a specially controlled IoT controller.

Another potential use case is integrating smart contracts into vending machines that could release goods in response to cryptocurrency payments.

In a supply chain scenario, smart contracts might unlock funds once a cargo container has arrived at its destination and IoT sensors indicate that it has remained unopened and the contents have been kept at the right temperature, appropriate humidity and not jostled too much on the journey.

Smart contract history and creation

The notion of smart contracts was first proposed by Nick Szabo in 1994. Szabo is a legal scholar and cryptographer known for laying the groundwork for digital currency. Back then, there was little interest or activity in smart contracts because there was no digital platform or distributed ledger technology that could support them.

In 2008, the bitcoin cryptocurrency was developed on a blockchain network with a distributed ledger that tracks monetary transactions. This technology enabled the development of smart contract code that is used to enter the terms of the contract into the blockchain.

Many platforms now allow for the use of smart contracts, including Ethereum, Hyperledger, Tezos and Corda. Today, with the growing adoption of bitcoin and the support of blockchain technologies, smart contracts are growing in popularity.