BrandLogo
Table of Contents

What is a smart contract?

Types of smart contracts

How to create a smart contract on OpenZeppelin

Smart contracts: empowering DeFi and tokenisation

Smart Contracts 101: The Backbone of DeFi and Tokenisation

By ICR Research Team
5 min read
Sep 23, 2024
LearnPart of a series
Blockchain Basics
Blockchain Architecture Explained: Fundamentals
  • 1. The world’s first blockchain
  • 2. What is blockchain architecture? How is it different from a traditional database?
  • 3. Types of blockchain architecture
  • 4. Core components of blockchain architecture
  • 5. Layers in a blockchain
  • 6. Types of tokens on a blockchain
  • 7. Summing Up
Blockchain of Things (BoT): Applications, Advantages, Disadvantages
  • 1. What is the Blockchain of Things?
  • 2. The Evolution of IoT into BoT
  • 3. Pain Points in IoT Development
  • 4. Applications of the Blockchain of Things
  • 5. Advantages of Blockchain of Things (BoT)
  • 6. Disadvantages of Blockchain of Things (BoT)
  • 7. The Bottomline
Current Article
Smart Contracts 101: The Backbone of DeFi and Tokenisation
  • 1. What is a smart contract?
  • 2. Types of smart contracts
  • 3. How to create a smart contract on OpenZeppelin
  • 4. Smart contracts: empowering DeFi and tokenisation
A Detailed Guide to Blockchain Interoperability
  • 1. What is interoperability in blockchain?
  • 2. How does blockchain interoperability work?
  • 3. Interoperability solutions in blockchain
  • 4. Importance of interoperability in blockchain
  • 5. Interoperability solutions in blockchain: how it could lead to wider adoption
What is a Decentralised Identity?
  • 1. Evolution of the digital identity
  • 2. How does a decentralised identity work?
  • 3. How is a decentralised identity beneficial?
  • 4. The road to a world of decentralised identities
Understanding The Blockchain Explorer - Etherscan
  • 1. Etherscan
  • 2. Address
  • 3. Transaction Hash
  • 4. Token
  • 5. Block
  • 6. Domains
  • 7. Summary
What are Active Addresses in Crypto?
  • 1. Active Address: The Definition
  • 2. Types of Active Addresses
  • 3. Calculation of an Active Address
  • 4. Comparison with Active Users
  • 5. Why Are Active Addresses Important?
  • 6. Conclusion
How Smart Contracts are Reforming Global Industries
  • 1. Introduction
  • 2. Conclusion
Key Takeaways
  • Smart contracts are self-executing digital agreements stored on a blockchain that automatically execute when pre-set conditions are met, eliminating intermediaries. Nick Szabo coined the term in 1994.
  • The three main types are smart legal contracts (for legal agreements), DAOs (for governance and voting) and application logic contracts (for IoT and blockchain integration).
  • Platforms like OpenZepplin Wizard allow users to create smart contracts by selecting token standards, features, voting power, access control, upgradeability, and security contracts.
  • Smart contracts are essential for DeFi and tokenisation.

Think of a world without intermediaries and centralised decision-makers and where trust is built into the system. Smart contracts help to essentially achieve this goal and, thus form the backbone of a blockchain network. These self-executing digital agreements have the potential to revolutionise industries in aspects of security, transparency, and automation. 

The Ethereum platform is touted to be the first network that scaled and popularised how developers could create customisable smart contracts. Today, several blockchain networks like Polkadot and Solana have also emerged as trusted platforms to deploy smart contracts. In this article, we will trace the history of smart contracts in blockchain networks and the way they work, and also explain how you could deploy one yourself!

What is a smart contract?

A ‘smart contract’ may seem like a buzzword in the crypto sector, but it’s more than that - it’s an actual concept with practical applications. 

What is a smart contract, though?

Smart contracts are sets of computer code stored on a blockchain. These codes define the terms of an agreement between two or more parties. When pre-determined conditions of the agreement are met, the smart contract automatically executes the agreed-upon actions, eliminating the need for a third party.

To put it more simply, think of smart contracts as conceptually being similar to the if-then (conditional) statements in computer programming. The code in smart contracts is structured in the same way, according to the conditions of the agreement.

The origin of the term dates back to 1994 when the computer scientist and cryptographer Nick Szabo coined it in one of his research papers. He described smart contracts as ‘computerised transaction protocols,’ that could activate when pre-set conditions were fulfilled.

How do smart contracts work?

Nick Szabo explained the workings of a smart contract using the example of a vending machine. A vending machine delivers an item to a customer once the latter honours the ‘agreement’, which is the payment for the particular item. Thus, it works conditionally. 

Smart contracts in blockchain networks work in a similar way. 

The conditional statements within the smart contract’s code help it work in an automated manner without any centralised intervention.

Types of smart contracts

The various types of smart contracts can be mainly categorised as :

Smart legal contract: These contracts can be associated with legal agreements that are done between two or more parties. In the case of a smart legal contract, the stakeholders usually sign it with digital signatures, while the legal clauses are encoded into the contract itself. It gets executed once a pre-set condition is met. Otherwise, it may also impose ramifications if any one of the parties does not adhere to them.

A simple example where it can be used in the case of pre-agreed payments. When the date of payment is reached, the smart legal contract will automatically execute and make a decision based on whether the payment was made.

Decentralised autonomous organisations (DAOs): These blockchain-based organisations are community-driven and have no one central authority heading them. As a result, they solely depend on smart contracts to empower the DAO stakeholders with voting and governance rights. These are counted as one of the most popular types of smart contracts. For example, Uniswap is a DAO that leverages smart contracts to create liquidity pools.

Application logic contracts: Smart contracts between devices or blockchains are known as application logic contracts. These contracts are very helpful for Internet of Things (IoT) smart devices and for blockchain integration or communication. A differentiating feature of these contracts is that they are not signed between organisations or humans.

How to create a smart contract on OpenZeppelin

OpenZeppelin is a smart contract generator that aids in creating and deploying smart contracts in blockchain networks. To create one yourself, first head to the OpenZeppelin Contracts Wizard, and then follow these steps:

1. Select the standard for your smart contract token. Let's suppose you select ERC-20, which is a standard for smart contract tokens on Ethereum. Further, add a name and symbol for the token. You can fill out the 'premint' section if you wish to create an initial number of tokens for deployment.

2. Next, you can select various features for your smart token. The code on the right gets modified accordingly.

Mintable: It will ensure the token supply can be expanded using a mint function. If it is not mintable, even consensus activities will not be able to mint it.

Burnable: This feature will enable the owner and token holders to burn and destroy their tokens using the burn function.

Pausable: The pausable feature is for emergency situations. It helps the contract owner to pause or unpause the token contract and is particularly useful in DeFi protocols if a hack is detected.

Permit: This function allows token holders to make approvals with signatures, without an on-chain transaction. Thus, they will be able to allow third parties to transfer from their account without paying gas fees.

Flash minting: It allows the minting of a random amount of tokens for flash loans, without any collateral. However, the borrowed tokens must be returned in the same transaction.

3. In the next step, you can select 'votes' to record and trace the voting power of each account. You can also delegate voting power to a specific account. Either block number or timestamp can be selected to express voting durations.

4. Further, you may decide on an option that decides who can access the functions of the smart contract and when they can do it, in ‘access control.’

5. Smart contracts are immutable by default. But you can change this by choosing an upgradeable proxy in ‘upgradeability.’

6. The last step is to enter a security contact for your smart contract. Once you do, your code for a smart contract token is ready! Download the code, compile it, and make it ready for deployment!

Smart contracts: empowering DeFi and tokenisation

Smart contracts foundationally support and enable the use cases of blockchain technology like decentralised finance (DeFi) and tokenisation. From lending and borrowing to even decentralised exchanges, smart contracts are essential for all applications in DeFi. 

Tokenisation can also be facilitated with smart contracts, which can be programmed with conditions that will control the ownership, distribution, supply, governance and other tasks associated with tokenised assets. However, Real World Assets (RWAs) will require proof of reserves. Hence, for the tokenisation process to work effectively, the process will involve a combination of on-chain and off-chain operating procedures.

 In a way, smart contracts are the building blocks of blockchain technology!

Head to India Crypto Research for detailed insights on crypto and blockchain!

Disclaimer

India Crypto Research operates independently. The information presented herein is intended solely for educational and informational purposes and should not be construed as financial advice. Before making any financial decisions, it's essential to undertake your own thorough research and analysis. If you're uncertain about any financial matters, we strongly recommend seeking guidance from an impartial financial advisor.