What is a Smart Contract?

March 21, 2018

Since its first proven usage in the famed cryptocurrency, Bitcoin, blockchain technology has evolved significantly. But what is it about blockchain that makes it so valuable to various commercial enterprises, the tech community, and even the average consumer?

Well, some might argue that blockchain is most useful for its applications in processes that require recording data/events. Others may place more value in blockchain’s capacity for processing transactions. Yet these — as well as many other blockchain-based functions — can be blended together to create an exceptionally useful application:

Smart contracts.

What is a Smart Contract?

A smart contract is designed to safely and transparently facilitate the exchange of assets, without the need for a middleman.

In short, smart contracts (sometimes called crypto contracts) are programs that are coded to automatically control the transfer of assets between two or more parties, once predefined conditions have been met. This concept was first theorized in 1994 by Nick Szabo, but it would be nearly two decades before the technology came to fruition.

Now for a more in-depth definition: the term “smart contract” is often loosely used by crypto-enthusiasts to describe a several different concepts. The most notable of these concepts are “smart contract code” and “smart legal contracts.”

Smart Contract Code

In the early days of blockchain, the platforms that used the technology were mostly designed to do things like facilitate transactions of cryptocurrencies. Smart contract code is essentially any code within the blockchain that can control assets (cryptocurrency) within the same blockchain. In order to qualify as a smart contract, the code must execute automatically, be trackable, inalterable, and irreversible.

If you need an example of smart contract code, just consider these two basic scenarios:

Example 1

  • Jill rents her apartment from Jack using a blockchain-based rental platform. A smart contract could be used to automatically deliver a predetermined amount of cryptocurrency tokens from Jill to Jack, after Jill has been renting his apartment for 1 month. In this instance, the parameter for the contract to be fulfilled is Jill renting for 1 month and the assets that are being transferred upon fulfillment are the cryptocurrency tokens.

Example 2

  • A retailer implements a smart contract program that is designed to prevent multiple members of the same household from purchasing a specified number of apples using a promotional code for discounts. This could look like code that automatically removes Jack’s ability to purchase apples using the promotional code if Jill has already bought an apple using the code.

Smart Legal Contracts

A smart legal contract utilizes smart contract code to improve upon traditional legal contracts. These improvements could take the form of making agreements more stable or predictable, or to simplify complex operations.

But there is one glaring issue with this: smart contracts are not yet entirely supported by the legislative framework of most societies. Therefore, they cannot be a one-size-fits-all solution for legal contracting until they are supported by legal entities as well.

How Does a Smart Contract Function?

This is how a basic smart contract works:

The Benefits of Using Smart Contracts

Smart contracts have the potential to streamline and automate a wide variety of transactions that take place in every professional sector.

They can help businesses develop trust with their clients. They can ensure that when people enter into a deal, both parties are held fully accountable for the conditions within the contract. And most importantly, they are immutable, therefore they eliminate the risk of someone altering a contract to take advantage of others. These features could prove themselves to be very valuable, especially in sensitive industries like the financial sector or public administration.

Yet although smart contracts are a simple concept, the nuances involved with using them in real world scenarios can sometimes become more complex. In fact, one of the most appealing features of smart contracts — their ability to manage and automate procedures in a decentralized database — is also one of the main limiting factors for them.

The decentralized nature of smart contracts means that keeping confidential information totally private within the blockchain may not be an option. It also means that the contracts are unable to communicate directly with the real world without compromising their efficiency, security, and the integrity of data within the chain. Instead, they need “trusted parties” to push data into the chain.

One solution to this problem is blockchain oracles. Oracles are typically trusted 3rd party data feeds that monitor real-word events and supply that information to the blockchain. This means smart contracts featured within that blockchain can effectively make judgements based on information that wouldn’t normally be available within the network.

Although a primary feature of blockchains is their decentralized nature, it is very important to note that oracles are typically organized by a central institution that has been deemed “trustworthy”.

Popular Smart Contracts Platforms Today

Many organizations are looking to get their hands on smart contracts and the blockchain ecosystem is rapidly adapting to this growing demand in several ways. The 3 following platforms are currently leading in smart contract features.

Using Smart Contracts in the Ethereum Virtual Machine (EVM)

Ethereum is a decentralized platform that prides itself on being the foremost network for creating smart contracts. The Ethereum Virtual Machine (EVM) is an isolated runtime environment that hosts these contracts. Ethereum’s network infrastructure uses the cryptocurrency “ether” to facilitate transactions.

There are two main account types available to Ethereum users:

  • External (Regular) Accounts – These accounts are operated by humans and are used to hold ether, send ether to other accounts, create contracts, and to call (use) functions from contracts that are already established.
  • Contracts – The contract accounts are controlled by the code embedded within them. The code in these contracts cannot be changed by the user, although the values that exist within the contract may be changed by related transactions. Any and all changes made to the contract are automatically recorded to the blockchain.

All accounts have access to their own balance of ether that can be changed via transactions.

For each contract, users will need to spend an amount of ether as “gas”. (Think of gas as the transaction fee used to create/execute smart contracts.) The amount of gas that must be spent is determined based on the amount of work that the Ethereum platform will need to do in order to execute the contract.

When a contract calls for a particular function, the network calculates how much gas that computation will need. If the gas runs out before the transaction is finished, the transaction cannot be completed and gas is still spent. If the amount of gas is in excess of the necessary amount, the remaining gas is returned to the account that called for the function. All of the gas being spent in such contracts is paid out to Ethereum’s miners as compensation for verifying transactions across the network.

The EVM is very robust and offers a vast array of smart contract functionality that is packaged in a way that programmers can mold it to their own specific needs. This is why companies in many different industries, ranging from ecommerce to financial services, have already developed their own Ethereum-based smart contract applications.

For more information about Ethereum, see our article “What is Ethereum?”.

Using Smart Contracts in the NEO Virtual Machine (NeoVM)

NEO is an up-and-coming Chinese blockchain platform that can be used to create smart contracts and develop cryptocurrencies. The contracts function very similarly to those used in Ethereum. But NEO is believed to have a higher level of performance under optimal circumstances.

It is also more flexible/expandable than Ethereum. Unlike Ethereum — which only allows development using their proprietary language, Solidity — NEO allows developers to create contracts using many of the most prominent programming languages, including:

  • C#
  • VB.Net
  • F#
  • Java
  • Kotlin
  • Python

They are also working to introduce the use of C, C++, Golang, and JavaScript as well. This means the bar of entry for developers to use this platform to develop smart contracts is much lower.

Although NEO is still at an early point in its development, the upsides of the platform are expected to help it grow to become a leader in the smart contract development marketplace. They are regarded as the most scalable smart contract platform at the moment, and for good reason (their network can facilitate 1,000+ transactions per second and growing). Yet it’s important to note that creating smart contracts/decentralized applications on this network may be more costly than using Ethereum.

Learn more about NEO here. You can also check out this article that breaks down the differences between NEO and Ethereum.

Using Smart Contracts with EOS Platform

EOS is another blockchain platform that is currently under development and will emphasize smart contract functionality. It uses Web Assembly (WASM) to execute smart contract code and C++ is expected to be the best language for developing contracts on this network.

The contract functions operate similarly to those within the Ethereum network, but there are some noteworthy differences between the two. For example, EOS uses a Proof-of-Stake consensus mechanism to govern transactions while Ethereum uses Proof-of-Work consensus.

Proof-of-Work (PoW) simply means that users will need to do some work in order to request a service from the network, while Proof-of-Stake (PoS) means that the user can access those services based on how many tokens their account holds. PoW networks typically force users to spend on fees (gas), while PoS requires users to own the network token in order to access services.

The most frequently highlighted benefit of a PoS protocol is that it completely removes fees from the platform. It also permits users to have an amount of bandwidth and storage on the network that correlates directly to the amount of tokens they have in their possession.

This difference in protocols also allows EOS applications to be frozen and repaired (without disrupting other EOS smart contracts), while Ethereum-based applications do not have this functionality. To add to this, EOS is also set to feature a legally binding constitution that will be the common jurisdiction for settling disputes between users.

EOS uses Graphene technology, which has the capacity to process between 10,000 and 100,000 transactions per second. Then they will use parallelization to grow the network, possibly pushing the number of transactions per second up into the millions.

These features mean EOS will be uniquely scalable, making it a very commercially viable smart contract platform and a major competitor to Ethereum.

Our article “What is EOS?” tells you more about this platform.

Which Industries Can Benefit From Smart Contracts?

Knowing how smart contracts work and which platforms are used to facilitate them serves as good background knowledge, but understanding the following use cases for the technology will help you to understand the real impact smart contracts can (and will) have on the future.

Here are 5 industries that can benefit from the use of smart contracts.

Smart Contracts Use Cases in Real Estate

Some of the main problems that affect the real estate market are the need to interact directly with agents, landlords, inspectors, and third-party service providers to verify each step in the process of renting/purchasing a property.

Smart contracts that automate rental contracts can simplify many of these processes by cutting out the need for unnecessary face-to-face transactions. They could also improve things like the property search processes and leasing/cash flow management for real estate companies.

Rentberry, a decentralized rental platform, is one example of a business that facilitates automation of rent payments, security deposit management, and even hosting open houses using smart contracts. With Rentberry, a rental agreement is signed and verified between a landlord and tenant. This agreement takes the form of a smart contract, which is entered into the blockchain and therefore inalterable.

In the smart contract code, rental payments are set to be delivered automatically according to the predefined schedule. These terms can be negotiated before getting entered into the code. Security deposits terms and conditions are set at the start of the contract, and upon the end of the lease any owed amount is deducted and the remaining deposit is automatically returned to the tenant.

This is a great example of how smart contracts can be used to create a completely traceable record of a rental agreement, preventing fraud by either party throughout the rental process.

Smart Contract Use Cases in Supply Chain Management

Supply chain logistics is an industry to involves the storage and shipping of physical goods via land, sea, and air. This is one of the most complex industries in the world, as each item must be tracked extensively in order to ensure it reaches its target destination and many different transactions must occur to get them there.

Although most supply chain organizations already have some means of digitally tracking packages and managing assets, they are often very costly and require humans to carry out most of the steps, such as scanning packages, updating ledgers, and paying invoices.

Using smart contract technology, supply chain logistics businesses can streamline many aspects of their operations through automation. Chain Business Insights, an independent research firm that is focused on understanding the application of blockchain in supply chain management, recently released a research brief that identified several key benefits of smart contract technology.

These benefits include:

  • Visibility and verification of items in transit
  • Lower Costs
  • Self-execution (automation)
  • Clarity of agreement terms (straightforward contracts)
  • Fraud protection
  • Connectivity

But at the same time, the firm also noted that implementing this technology across the industry may be difficult. As legislation needs to catch up and effective standards and protocols must be established in order to maintain privacy and security when using smart contracts.

ShipChain and VeChain are two blockchain projects that are working to bring smart contract functionality to the supply chain industry. Shipchain aims to improve the tracking of packages and maximize the efficiency of transportation routes using blockchain technology, while VeChain hopes to boost supply chain security by using smart contracts and other blockchain infrastructure to preempt theft and fraud.

Smart Contract Use Cases in Financial Services

In a recent article titled “Smart Contracts and the Future of Banking”, Nasdaq pointed out that the main issue hindering the widespread adoption of smart contracts is the availability of smart interfaces between the blockchain networks in which smart contracts run, and the rest of the world.

With this in mind, industry groups like FinTech Network and Zerado still believe that smart contracts can offer many beneficial applications to banks if they can figure out how to effectively code legal contracts into smart contracts. This would likely require that banks adopt smart contract technology that coincides with the development of blockchain infrastructure that is interoperable with legacy financial services infrastructure (banking networks, insurance networks, etc).

Such a system could eliminate delays that are typically caused by centralized authorities like Clearinghouses by allowing a smart contract to trigger an automatic payment of fiat currency from a bank account once the conditions of the contract are met. Similarly, that same contract could also ensure that any necessary reporting to tax and compliance authority is also completed automatically.

Regulators would also be able to access and read the record of all transactions, allowing them to verify that all parties are compliant with any applicable regulations. If executed correctly, this type of system would assure a secure, private, and scalable platform for all of the transacting parties.

However, in practice, it isn’t that simple; there are other roadblocks keeping smart contracts from being used by most financial services firms.

Firstly, the regulatory entities that govern financial institutions in their respective countries will need to draft smart contract-oriented regulations that can effectively protect the populations that they serve. Such regulations would be necessary to ensure that the contracts are enforceable and secure.

The technology would also have to be secure enough for widespread use in this industry, as transaction records would potentially be visible to all users. This leads to a discussion of questions like, “what data should be shared with all participants?” or “how can the users verify the authenticity of data that is fed into the blockchain via Oracle services?”

Once answers to all of these questions can be clearly answered and issues concerning governance have been ironed out, it is certain that we will see acceleration in the use of smart contracts in the financial services industry.

For a more in-depth review of this complex topic, read this white paper by Cap-Gemini.

Smart Contract Use Cases for Government Institutions

Smart contracts are being considered as a solution to issues in government like contract management, identity verification, and voting.

One example of this is the idea of using blockchains to record the promises that public administrators make and leveraging that data to ensure that they follow through on their statements.

This type of smart contract could be represented by a legislator agreeing to allocate some amount of funds to a certain issue and once the value is sent the contract is executed, resulting in community members being informed that it did happen. If that amount of money is not sent by a predetermined date, the contract will then execute differently, informing constituents that the promise was not upheld.

In another example, the U.S. government is currently looking into ways that blockchain smart contracts can be used to improve the system used to bid for public contracts. Others believe that smart contracts could be used to facilitate an unhackable voting ledger that can be easily accessed by citizens.

Of course, such a system would need to be entirely secure and it would need to be able to verify a person’s identity without compromising their private personal information on a public blockchain.

Smart Contract Use Cases in Healthcare

Healthcare is a massive industry. Healthcare transactions  account for a major portion of the economy in many countries, especially in the USA where it represents approximately a fifth of spending in the nation.

With so many transactions occurring globally, healthcare organizations obviously transfer enormous volumes of data to one another. This data can range from public to extremely confidential, therefore secure storage of that data is a primary concern for medical institutions. Yet accuracy is arguably just as important as privacy, as an inaccurate patient chart could lead to incorrect treatment which may worsen a patient’s condition.

Blockchains can be used to store a variety of different health data in a way that is accurate, totally encrypted, and signed digitally. Patients can then choose who is allowed to access their health information by distributing their access key directly to trusted health professionals.

This minimizes the risk of fraud and makes it simpler for patients, insurers, and healthcare organizations to transact with one another. Patientory, a blockchain project that raised more than $7 million in the first 3 days of their ICO, aims to achieve this goal of improving the storage and management of patient data.

This would allow health institutions to create smart contracts that instantly communicate verifiably accurate health data to insurers or other medical institutions, giving them the ability to process interorganizational payments much faster. Payments that would, ideally, be sent automatically using a smart contract.

Smart Contracts Are Not Perfect: Challenges in the Use of Smart Contracts

Introducing smart contracts in our world could be transformative. However, smart contracts as they exist today are not perfect. Here are 3 challenges that smart contracts need to address.

Instilling Trust in the Use of Smart Contracts

Achieving widespread use of this technology will require accumulating the trust of the general public by ensuring that their personal rights, assets, identity, and safety will be protected with smart contracts. In this regard, the most pressing concern with smart contracts today is the necessity of bridging the gap between traditional legal contracts and smart contract code/smart legal contracts.

In order to provide these protections, smart contract developers will need to figure out how to develop entirely bug-free, secure smart contract applications. These contracts will need to be flexible in their design, as the contracts may need to be adapted to ensure compliance to constantly changing laws and regulations. At the same time, the blockchain must be able to offer users a reasonable level of privacy, as sharing too much information about certain transactions can inadvertently put users at risk.

The Oracle Problem

The oracle problem is an obstacle in the widespread implementation of smart contracts. It basically acknowledges that the execution of smart contracts cannot be triggered in real-time based on the occurrence of events in the physical world. To overcome this limitation, as mentioned above, oracles must be introduced to the blockchain.

Oracles can bridge the gap of available data for smart contracting, but things get more complicated when physical items are involved. Unlike sending a straightforward data stream from a financial institution or software service into the blockchain, physical items can require far more data feeds to track and thereby require significantly more data to be sent into the blockchain.

Furthermore, all of this data must be analyzed and/or verified before being introduced into the blockchain in order to prevent costly mistakes. Verifying and uploading larger volumes of data can become expensive. This, coupled with the fact that oracles are inherently centralized, pulls some of the power away from using oracles to inform smart contracts.

The fact that oracles are not typically decentralized means that they introduce human interference into the blockchain. If the data being submitted by the oracle is not entirely accurate, it could lead to a malfunction in the smart contracts within that network.

Specific Platform Limitations

Finally, the design of the blockchain platform used to create smart contracts can be a major concern too. If the network is not scalable and built to sustain a high volume of transactions, the smart contracts being hosted on that platform will not perform optimally.

Costs associated with using that platform may rise as well, especially in the case of PoW-based platforms like Ethereum. Similarly, if the network does not have viable security features, the smart contracts on that platform may be compromised by cyber criminals or bugs in the network.

The Future of Smart Contracts: Revolutionary Potential

There is currently a lot of research being done to reduce the impact of these limitations.

Here are two possible solutions (out of several) for the oracles problem that are being discussed:

  • Levying hefty fines against oracle services that provide faulty data
  • Always using multiple oracles as information sources within blockchain networks to ensure a reasonable level of consensus on data before it is entered

As thought leaders push to solve this problem, we will come closer to a true solution.

At the same time, smart contract platforms are being designed to be more autonomous, accurate and transparent. The technology used to harden their defences from the inside out is also evolving with every day.

The benefits of taking business into the digital realm are wide-reaching and the value of fraud prevention offered by smart contracts is undeniably huge. By that logic, it’s only a matter of time until smart contract solutions are developed and adopted in almost every high-volume industry.

This practically guarantees that smart contracts will be a cornerstone of the future global economy and a part of every consumer’s daily life.

Source: Read Full Article