Smart Contracts

Reeshipaul
5 min readAug 6, 2021

What Is a Smart Contract?

A smart contract is a self-executing contract with the terms of the agreement between buyer and seller being directly written into lines of code. The code and the agreements contained therein exist across a distributed, decentralized blockchain network. The code controls the execution, and transactions are trackable and irreversible.

Smart contracts permit trusted transactions and agreements to be carried out among disparate, anonymous parties without the need for a central authority, legal system, or external enforcement mechanism.

While blockchain technology has come to be thought of primarily as the foundation for bitcoin​, it has evolved far beyond underpinning the virtual currency.

Why do we need Smart Contracts?

Bitcoin blockchain is primarily meant for transferring digital currency. Bitcoin added a simple conditional transfer of value through an embedded script. The script was limited in its capabilities. It enabled simple conditional transfers. After Bitcoin, evolved Ethereum. The founders of Ethereum developed smart contract keeping Nick Szabo’s idea of a smart contract from over 20 years ago in mind. A significant contribution of Ethereum is a working smart contract layer that supports any arbitrary code execution over the blockchain. Smart contract allows for user-defined operations of arbitrary complexity. This feature enhances the capability of Ethereum blockchain to be a powerful decentralized computing system.

Cryptocurrencies such as Bitcoin, enable transfer of values such as money or currency from peer-to-peer without any intermediaries. For what? To gift somebody, to buy a product, maybe even renew a driver’s license, or send flowers to someone. Let us elaborate further. We may want the gift to be delivered on a certain date. Buy a product of a particular color and quality. We may need some credentials verified for renewing the license. And we may need a specific tulip bouquet to be delivered to Buffalo. This introduces conditions, rules, policies beyond that of which a simple money transfer cryptocurrency protocols can handle.

Smart contract addresses this need for application specific validation for blockchain applications. Smart contract has some advantages including, a smart contract facilitates transaction for transfer of assets other than value or cryptocurrency. Smart contract allows specification of rules for an operation on the blockchain. It facilitates implementation of policies for transfer of assets in a decentralized network. It also adds programmability and intelligence to the blockchain. The smart contract represents a business logic layer, with the actual logic coded in a special high level language. A smart contract embeds function that can be invoked by messages that are like function calls. These messages and the input parameters for a single message are specified in a transaction. Let us compare Bitcoin transaction and a smart contract transaction. In Bitcoin, all the transactions are about send value. In the case of a blockchain that supports a smart contract, a transaction could embed a function implemented by a smart contract. Here we have a voting smart contract. The functions are ValidateVoter, Vote, Count, Declare Winner. Smart contract provides a layer of computation logic that can be executed on the blockchain, thus availing the features enabled by the blockchain framework. Recall the layers of a decentralized application that we discussed in course one, module two. Observe that smart contract providing the application framework for a domain application. For example, consider home mortgage application. Smart contract could embed all the business logic and the intelligence for the rules and regulation, to allow for automatic computation and initiation of operation.

How might this be different from existing systems? Here, all the operations are transparent and are recorded on the blockchain. Customers can directly access the tools without an intermediary like a bank. It is like the ATM for mortgage initiation. You are holding the assets, it’s therefore an intermediary.

Typically, currency transfer is used to buy a service, a product, or a utility from a person or a business. There may be other conditions besides availability of funds while executing a transaction. For example, a business transaction may involve rules, policies, laws, regulations and governing contexts. Smart contract allows for these other real world constraints to be realized on a blockchain, thus a smart contract enables a wide variety of decentralized application of arbitrary complexity to be implemented on the blockchain. This can run the spectrum from supply chains to disaster recovery. It is likely many of the applications for the blockchain technology have not yet been conceived. It is predicted that online shopping will overtake retail shopping for the first time this holiday season, 2017–2018. Some couldn’t have even imagined online shopping, mobile application or Uber 20 years ago. Smart contract is ushering the next generation blockchain that goes beyond the transfer of value into a visionary realm. Smart contract allows for implementation of rules, policies and with the help of blockchain, supports the methods for governance and provenance.

Decentralized Applications (DApps)

Decentralized applications or DApps, open up the features and services of the blockchain to the whole world for review, interaction, and enjoyment. DApp gives access to people, applications and systems, not necessarily known to each other to transact peer to peer. DApp is an end to end application on a blockchain. We open this course with essential concepts, such as the blockchain server. DApp architecture, and the details of the supporting application programming interfaces or the APIs.

A DApp or a decentralized application depends on the functionality of a blockchain for its infrastructure and operations. In its simplest form, a DApp has a client interface as a front-end, and a back-end that includes a blockchain and a smart contract. Consider, for example, a simple wallet application client, and the Bitcoin blockchain decentralized infrastructure. This is similar to the architecture of a web browser and a web server, but with one significant difference. The blockchain enables a decentralized infrastructure.

Remember, the blockchain is not in one centralized place, but in the computing nodes of the peer participants. The client or the front-end can be a web app, HTML and Javascript framework. A command line interface, CLI, a desktop application, a mobile application, or even an IoT, Internet of Things. Additionally, a DApp can be created with a non-blockchain back-end. Interplanetary file system, IPFS, is an example of such an architecture.

References

Thanking you

Reeshita Paul

--

--