In recent years, smart contracts have become a hot topic in the blockchain world. Still, it is not publicly known that smart contracts are not the new concept. Although not being new in theory, they got put into use only since the invention and adoption of blockchain technology.
Smart contracts are currently the most actively explored field within the blockchain society. They can bring many potential benefits to various business sectors. We will talk more about these benefits later in this article.
When did smart contracts become popular?
A brief history of smart contracts:
The first smart contract theory came out in the late 1990s. The creator of the theory, Nick Szabo, in his work “Formalizing and Securing Relationships on the Public Network” described smart contracts for the first time.
“A smart contract is an electronic transaction protocol that executes the terms of a contract. The general objectives are to satisfy common contractual conditions (such as payment terms, Hens, confidentiality, and even enforcement), minimize exceptions both malicious and accidental, and minimize the need for trusted intermediaries. Related economic goals include lowering fraud loss, arbitrations and enforcement costs, and other transaction costs.”
This theory was published almost 20 years before smart contracts began to apply. The first smart contracts were integrated into bitcoin in 2009. Although that version of the smart contract was limited, it is still considered a smart contract.
Bitcoin uses restricted encrypted language in transactions to enable Peer-2-Peer transfer of value where transaction participants do not necessarily trust each other, or involve an intermediary (such as bank) to ensure the transparent execution of the transaction.
What is a smart contract and how does it work?
A smart contract is a computer protocol designed to digitally facilitate, validate or negotiate or execute a contract. Smart contracts allow credible transactions to be performed without a broker providing transparency. In this case, transparency is provided by blockchain technology.
The smart contract is safe and unstoppable, it represents an agreement that is automatically enforceable. Recognizing this definition further reveals that a smart contract is actually a computer program that is written in a language that can be understood by the computer or some other machine.
It also covers parties’ agreements in the form of business logic. Another basic idea is that smart contracts are automatically executed when certain conditions are met. They are “automatically executable”. This means that all contractual terms are executed as defined and expected, even in the presence of certain obstacles.
Enforcement is a broader term that encompasses traditional enforcement within the law, together with the implementation of specific measures and controls that allow contract conditions to be enforced without the need for any mediation.
It should be noted that true smart contracts should not rely on traditional methods of enforcement. Instead, they should work on the principle that “program code is the law!”, meaning that arbitration or a third party can not have the control or influence over execution of a smart contract.
Smart contracts are self-executing, unlike legally enforceable contracts.
In short, a smart contract has the following four features:
• Automatically executable
• Safe and unstoppable
• Semantically sound
The first two features are obligatory, while the last two will not be needed or implementable in some scenarios.
For example, a derivative contract may not be semantically reliable and unstoppable. Still, it should at least automatically perform the action at a fundamental level.
On the other hand, the ownership form must be semantically reliable and complete, so that in order to be implemented as a smart contract, the language must be understood by both computers and humans.
Ian Grigg addressed this interpretation issue with his invention of the Ricardian Contracts. We will describe it in detail in the next technical article.
How are smart contracts implemented?
Smart contracts can be applied to any industry where they are needed. The most current use cases are for the financial industry. This is due to the fact that blockchain has found many use cases in the finance industry. It has fueled the fintech industry’s strong interest in blockchain technology.
In the recent scientific work in the field of smart contracting, the idea for a new use of smart contracts in the financial industry was proposed. The idea is to build standard templates that provide a framework to support legal agreements for financial instruments.
This idea was suggested by Clack Et Al in a paper published in 2016 called “SM. Contract templates, foundations, landscape design and research directions”. The paper also suggested that domain-specific languages (DSLs) should be designed to support the design and implementation of smart contract templates.
A language called CLACK, a common language for expanding contract knowledge, has been proposed. This language is designed to provide a wide variety of features ranging from supporting legal prose to being able to run across multiple platforms and multiple cryptographic features.
Recent work on developing smart contract templates that support legally-enforceable smart contracts has been conducted by Clack Et Al. In this paper, they propose working on smart contract forms that have two main goals. The forms of requirements in smart contracts and the possibility of design.
The main objective of this paper is to explore how the legal interface can be linked to code using the “markup” programming language.
The paper also covers the section on how smart legal storage and transport contracts can be created, formatted, executed and serialized. It is an ongoing work and is an open area for further research and development.
Contracts in the financial industry are not a new concept, and various DSLs are already being used in the financial industry. For example, there are available DSLs that support the development of insurance products, represent energy derivatives, or are used to develop trading strategies.
It is also important to understand the concept of DSLs as this type of programming language can be developed to program smart contracts. These languages have been developed with limited expressiveness for a particular domain or area of interest.
Domain-specific languages (DSLs) are different from general-purpose programming languages (GPLs). DSLs have a small set of features that are sufficient and optimized for the domain where this programming language is intended and, unlike GPLs, are not typically used to build large, general-purpose application programs.
Based on the design philosophy of DSLs, it can be predicted that such languages will be developed specifically for writing smart contracts. Such DSLs already exist, and Solidity is one such language introduced in the Ethereum blockchain for the purpose of writing smart contracts.
The idea of using domain-specific languages when programming smart contracts can be further extended to a domain-specific graphic language.
With them, a possibility of a smart contract modeling platform emerges, where an expert in a particular domain (such as a lawyer) can use a graphical interface to define and compose the semantics and financial parameters of a contract.
Once a contract is defined and completed, it can first be released on a testnet, to check if it functions properly. It is then implemented from testnet to the target platform, which is predominantly blockchain.
What is an Oracle?
Oracle is an important part of the smart contract ecosystem. It is an interface that delivers data from an external source to smart contracts.
The limitation of smart contracts is that they cannot access external data, which may be required to control the execution of business logic. For example, the price of a stock or other value product that is required by the contract to release dividends. Oracle can be used to provide external data for smart contracts.
Depending on the industry and requirements, Oracle can deliver different types of data, from weather reports, real-world news and corporate action to data coming from the Internet of Things (loT). Oracles are confidential entities that use a secure channel to transfer data to a smart contract.
They can also digitally “sign” the data, which proves that the data source is credible. Smart contracts can then be subscribed to oracles. Then smart contracts can extract data from oracle, or oracles can automatically send the data to smart contracts. It is also important that Oracles cannot manipulate the information they provide and must be able to provide credible information.
Although the smart contract automatically “trusts” oracle, in some cases it may be possible that the data is incorrect due to manipulation. Therefore, it is imperative that oracles cannot change the data. With innovative technology, oracle is verifiable, and there is also Smart Oracle.
Introducing smart contracts on the blockchain
Smart contracts may or may not be deployed on the blockchain. But it makes sense to deploy them on the blockchain because of the distributed and decentralized consensus mechanism provided by the blockchain.
Ethereum is an example of a blockchain platform that originally supports the development and implementation of smart contracts. Smart contracts on the Ethereum blockchain are usually only part of a wider application like the Decentralized Autonomous Organization (DAOs), an example of a DAO system can be seen in the UBIK administrative system.
UBIK is Croatian blockchain and cryptocurrency association. Smart contracts implemented in bitcoin are much simpler versions than those implemented on ethereum’s blockchain. These smart contracts are for conducting “deferred payment” transactions and things like that.
These time blocks allow the transaction to be locked up to a certain time or up to a certain number of blocks, thus imposing a basic agreement that a particular transaction can only be unlocked if certain conditions (elapsed time or number of blocks) are met.
For example, you could implement terms such as “Pay Company X, Y amount of bitcoin after 3 months.” However, this is very limited and should only be seen as an example of a basic smart contract.
In addition to the example above, Bitcoin’s encrypted language, although limited, can be used to build basic smart contracts. One example of a basic smart contract is to fund a Bitcoin address. It can be spent by anyone who demonstrates a “hash collision attack”.
This was a competition posted on the Bitcointalk forum, where bitcoins are set up as a reward for anyone who can find a hash collision for hash functions. This conditional unlocking of Bitcoin only when demonstrating a successful attack is a basic type of smart contract.
Various other blockchain platforms support smart contracts, such as Monax, Lisk, Counterparty, Stellar, Hyperledger fabric, Corda and Axoni core.
Smart contracts can be developed in different languages. A critical requirement, however, is very important determinism. It is vital that no matter where the smart contract takes place. Also, it produces the same results every time and everywhere.
This requirement of a deterministic nature in smart contracts is ONLY applicable if the smart contract software code is absolutely error-free. Smart contract validation and verification is an active area of research in the blockchain community.
There are almost unlimited potential applications of smart contracts and the forms in which they can be found. We hope you have learned something from this technical article! Feel free to contact us if you have any questions!