back

Smart Contracts – Definition, Pros and Cons

31.3.2021
smart contracts

A "smart contract" is a program that runs on IT infrastructures operated by blockchain. It serves as a digital contract made up of a collection of code (its functions) and data (its state) that resides at a specific address on the blockchain. Smart Contract is a type of wallet – thus, it can send transactions over the network and have balances. However, they're not controlled by a central authority or user. Instead they are deployed on the distributed p2p blockchain network and can operate as programmed.

What are smart contracts?

Smart contracts are similar to traditional contracts used in the real world, however, unlike the latter, former are completely virtual. Thus, we can define a smart contract as a virtual computer program stored inside a blockchain and intended to serve as a medium to digitally enforce performance or negotiation of contracts. They facilitate execution of transactions without requiring mediation services of third-parties like banks     , brokers or governments.

A smart contract primarily functions like a ‘multi-sig’ account where funds are spent provided a certain percentage (or majority) of people agree to a set of predetermined conditions. Smart contracts can be executed automatically once the agreement’s conditions are fulfilled. Thus, smart contracts can help you exchange property, shares, money, token, or anything that has value, in a conflict-free and transparent manner, while avoiding a middleman’s services.

Definition and Code Example

By using smart contracts, one is transferring an asset, currency, or token, between wallets – either other smart contracts or wallets belonging to humans     . The program executes this code and automatically validates one or more conditions to determine whether the asset should be transferred or returned back to the original owner. In the interim, the decentralized ledger records and replicates the document, thereby, adding immutability and security to the entire process.

The use of blockchain and tokenization allows smart contracts to inherit some interesting properties. They are distributed and immutable. Since they are distributed, the output is validated by everyone on the network and no single entity has complete control of the money. Thus, an individual is unable to enforce the contract to release funds since others on the network will be able to identify this event and tag it as invalid.

Immutability signifies that once the smart contract is implemented, it cannot be altered. Thus, no one can go behind your back and tamper with smart contract code.

Besides Kickstarter, smart contracts can be applied to several other things – Insurance companies can leverage it to process claims, financial institutions can use it to offer automatic payments and so on.

Below is an example of a crowdfunding smart contract:

contract Crowdfunding {

address owner;

uint256 deadline;

uint256 goal;

mapping(address => uint256) public pledgeOf;

 

function Crowdfunding(uint256 numberOfDays, uint256 _goal) public {

owner = msg.sender;

deadline = now + (numberOfDays * 1 days);

goal = _goal;

How do smart contracts work?

Let’s imagine that Tom wants to buy Jerry’s car. A traditional way of executing this transaction would involve signing of legal agreements that are drafted by lawyers, and involvement of intermediaries like banks, car brokers and motor authorities. However, in the world of blockchain, this agreement can be executed using a smart contract, which contains the agreement between Tom and Jerry. In simple terms, a smart contract example will be something like this:

“WHEN Tom pays Jerry 200 Ether, THEN Tom will receive the ownership of Jerry’s car”.

Once this smart contract agreement has been put into place, it cannot be changed — meaning, Tom can feel safe to pay Jerry 200 Ether for the car.

Pros and Cons of Smart Contracts

Pros:

  • It provides reliability and immutability to transactions and business processes by leveraging the underlying decentralized data storage system in blockchain coreledger.
  • Smart Contracts provide transparency and confidentiality of actions for the parties involved.
  • It can automate operations, thus eliminating the need for central authorities or intermediaries
  • Additionally, exclusion of intermediaries also reduces the price significantly

Cons:

  • There is weak legal regulation for enforcement of smart contracts
  • Current blockchain coreledgers in the market have issues with transaction processing speed and scalability
  • It has a high dependence on programmers and exposure to bugs and vulnerabilities

Practical Examples of smart contracts

Smart contracts are being used in various different industries. Below are some practical examples of smart contracts from the real-world.

  1. Supply Chain – A distributor can leverage smart contracts to sell and distribute products across the globe. Smart contracts can be used to track the location of products to trace them as they change hands throughout the supply chain. They can automatically release products to the correct recipient based on fulfilment of pre-determined conditions. Thus, the entire supply chain process can be automated at a fraction of the price paid for traditional processing.
  2. Insurance – Insurance providers can leverage smart contracts to facilitate the terms of the policy. Every aspect in the policy can be recorded into a blockchain based smart contract, and be digitally accepted by the holder. As long as the holder meets the terms of the policy, the smart contract will keep the policy in effect. If something goes wrong and the policy owner needs to cash in on their insurance policy, the contract will automatically release the insurance payment once the policy holder provides necessary documentation that outlines the damage to their home or car.
  3. Stock and Derivatives Trading – Smart contracts can also be used for management and tracking of the movement of a stock or bond from one owner to another. With smart contracts, traders can buy and sell more quickly because every transaction is automatically verified and recorded on the blockchain coreledger. This can also lower the cost per transaction due to the elimination of intermediaries.

History of Smart Contracts

Smart Contracts were first introduced by Nick Szabo back in 1994. Nick Szabo was an American computer scientist and cryptographer. However, they became popular with the introduction of Ethereum, which uses the Solidity language to program the contracts. In 2009, Bitcoin, the first cryptocurrency appeared. Bitcoin was created on the revolutionary blockchain technology. Even Bitcoin supports smart contracts, but one must have knowledge about opcode programming to use it. Moreover, the limited capabilities to support smart contracts, makes its usage in Bitcoin very limited. Nonetheless, Bitcoin’s appearance served as the impetus for developing smart contracts. In 2014, the blockchain platform, Ethereum, made it possible to use smart contracts in practice. Today, the market offers many platforms that allow for the use of smart contracts, but Ethereum remains one of the most widespread.

Conclusion

  • By definition, smart contracts serve as self-executing agreements with the terms ingrained directly into lines of code, thereby facilitating trade between a buyer and seller, by executing computerized transactions.
  • Smart contracts make transactions transparent, irreversible and traceable.
  • Since these contracts are executed on the blockchain, they get recorded on a public database and cannot be altered.
  • Since the transactions on a smart contract are processed by the blockchain coreledger, they can be sent automatically and do not rely on third-parties.
  • The transactions happen provided certain pre-determined conditions in the agreement are met, thus management of transactions is autonomous.

FAQs

Are smart contracts Really contracts?

Smart contracts are neither really “smart” nor “contracts” in the legal sense. They are simply business rules translated into software

What Is a Smart Contract Audit?

A smart contract audit includes a detailed analysis of the code to detect coding errors, security flaws, and other issues that may result in irreversible damages.

What Are the Vulnerabilities of a Smart Contract?

The most common types of smart contract attacks and security flaws include:

  • Reentry attacks
  • Integer overflow and underflow
  • Timestamp dependence
  • Frontrunning

How secure are smart contracts?

Blockchain is considered to be incorruptible. Once a smart contract has been concluded, it is impossible to alter any of its terms retroactively. The algorithms specified in the contracts are executed reliably and strictly the way they were programmed before deploying on blockchain.