Coins:

Market Cap: $0 0% (1d)

24H Vol: $0 0% (1d)

Dominance:

Coins:

Market Cap: $0 0% (1d)

24H Vol: $0 0% (1d)

Dominance:

BrandLogo
SearchIconSearch

Table of Content

How are New Bitcoins Created, and Why There Will be Only 21 Million of Them Ever?

But how are bitcoins created in the first place? What is crypto mining? How do new bitcoins come into circulation?

Interoperability: Bridging the Technological Divide

The Bitcoin Revolution

CBDC vs cryptocurrency: acceptance rate across countries

What is blockchain architecture? How is it different from a traditional database?

The takeaway

Share:
  • share-icon
  • share-icon
  • share-icon
  • share-icon

Smart Contracts 101: The Backbone of DeFi and Tokenisation

September 23, 2024

6 min read

img

Source | What is a smart contract?

Key takeaways

  • BulletIcon

    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.

  • BulletIcon

    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).

  • BulletIcon

    Platforms like OpenZepplin Wizard allow users to create smart contracts by selecting token standards, features, voting power, access control, upgradeability, and security contracts.

  • BulletIcon

    Smart contracts are essential for DeFi and tokenisation.

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: The information provided in this blog is based on publicly avail­able information and is intended solely for personal information, awareness, and educational purposes and should not be considered as financial advice or a recommendation for investment decisions. We have attempted to provide ac­curate and factual information, but we cannot guarantee that the data is timely, accurate, or complete. India Crypto Research or any of its representatives will not be liable or responsible for any losses or damages incurred by the Readers as a result of this blog. Readers of this blog should rely on their own investigations and take their own professional advice.

Related Blogs