Smart Contracts: Beginner Guide

Brief History

Smart Contracts were first introduced in 1990 by Nick Szabo, but it became popular only after the advent of the concept of Blockchains almost after 20 years. Nick described Smart Contracts as below:

Smart Contracts Described by Nick Szabo


In simple terms let me try and define a Smart Contract as below.

A Smart Contract is simply a Computer Programme representing a legal Contract which can execute and enforce the terms (like payment, liens, confidentiality) of the Contract.

An ideal Smart Contract should have the below properties:
1. Automatically executable and enforceable: In a normal legal contract it is the State of Law or another trusted third party which is the final authority to enforce and execute a contract. Or generally both the parties involved will abide by what is documented in the contract and execute accordingly. For example, let us take an example of a Contract for a new hire for a project. Suppose the Payment terms of the contract lays out the realization of the monthly salary of the new hire after every 30 days from the day of joining the services.In a normal scenario, a mutual trust is needed between the employer and the employee and after every 30 days the employee expects the employer to process his salary. In the case of any disputes (like payment defaults) the State of Law will intervene and resolve the matter.
Now in the case of Smart Contracts the computer code will enable automatic deduction of salary payments after every 30 days. This is a preset criteria in the Computer code.
Hence in an ideal Smart Contract, there is no need for any third parties for the proper abiding of the terms of the contract.
2. Secure and Unstoppable: An ideal Smart Contract should be secure and unstoppable. This means that the computer code should be non-permeable (secure) from any hacking to tweak the terms and should be unstoppable, meaning should not be dependent on external factors such as system failure, natural calamities.

Note: I am always mentioning “ideal Smart Contract” in place of just “Smart Contract” because the research is still going on in this space to make the Smart Contracts even more automatic, secure and unstoppable.

An Ideal Smart Contract

Computer Language and Frameworks for Creating a Smart Contract

There are Domain Specific Languages (DSL) which target on the creation of Smart Contracts. These are languages which are not as vast as a General Purpose Programming Language (GPL) and are only suited for creating Smart Contracts for the specific domain (domains like insurance, Energy, trading, etc.).
An example of a DSL is Solidity which was introduced with the Ethereum Blockchain. Another lesser popular DSL again introduced with the Ethereum Blockchain is Serpent.

More details on DSL can be found here

Graphical User Interface or Canvas for Non-Programmers

The idea of using a DSL for creating a Smart Contract is further eased for non-programmers who are Domain Experts to create a Smart Contract in their specific domain. Here we are given a platform or a Canvas where the Domain Expert can define the semantics and performance of a Contract. Once the semantics and flow are finalized, the system can emulate it to first test and then implement a Smart Contract which can be transferred to a target platform (which is a Blockchain).

Ricardian Contracts

Ricardian Contracts are a type of Smart Contract which was first used in a bond trading and payment system called Ricardo. The idea is to create a Smart Contract which is acceptable by both a Court of Law and Computer Software. In the general scenario a Smart Contract which is a computer code can be interpreted and validated by a computer programmer but not so easily by the Court of Law. In the case of the Ricardian Contract, the terms and clauses of the contract are written in a code format as well as document format so that it can be well accepted and understandable by the Court of Law and Computer Software.

  • This type of contract is issued by a issuer (of a bond or security) to the holders.
  • The terms and conditions are well documented in legal prose (easily readable by humans) and machine tags (readable by computer software).
  • It is digitally signed by the issuer to establish authenticity of the contract.

Oracles in Smart Contracts

We have seen that a Smart Contract is a computer code which is able to automatically execute a contract once a set of pre-defined conditions are met. For example a Smart Contract in trading and finance can auto release payment of dividends once the value of a Stock reaches a certain amount. Or let us take the example of a Smart Contract which has an in-built code to release the payment to a vendor once the project is completed satisfactorily. But the question arises that how will these External Data such as the value of the stock and whether the project has been satisfactorily completed or not (in the above examples) be fed in the Smart Contract.

Here comes the concept of Oracles. Oracles are the framework or platform which is connected to a Smart contract to provide external data (stock prices, government decisions, corporate news, etc.).

But how can we be ensured that the data that is provided by Oracles is not manipulated for personal interests. Generally Oracles are large trusted houses, but again the problem of Centralization appears in which we are trusting a third party for our critical data.

Hence in order to combat this issue, Decentralized Oracles were introduced in which the Oracle sources data from a Blockchain which is managed by decentralized consensus, and hence the worthiness of the data is ensured.

Conclusion and Summary

We started this article by understanding the basic concept which houses the Smart Contracts. We should know that till now this is an area of research and a formal definition is still not in place. Then we understood traits of Smart Contracts followed by the languages and other GUI used to create a Smart Contract. We further checked a type of Smart Contract, namely Ricardian Contract and then understood the concept of Oracles in Smart Contract. Hope you find it well understandable and in any cases of doubts, request you to reach out to me at

Happy reading:)

Leave a Reply