logoAcademy

Building Programs on Blockchain

Learn what a Smart Contract is

First off, thank you for enrolling in this course! We assume that you are taking this course in order to learn how to write smart contracts. This begs the question - what are smart contracts?

From a high-level, you may have heard that smart contracts are just code that automate a process. Want to create a decentralized insurance protocol? You can build a smart contract for that. Want to create and distribute NFTs? You can also build a smart contract for that as well. So while we might understand the capabilities of a smart contract, this course will be focused on defining the actual code (and therefore, business logic) required for such intents.

The EVM Model

In this course, we will learn Solidity, a high-level programming language that we will use to design smart contracts. Before we delve into learning Solidity, it is important to understand how our smart contracts operate in the grand scheme of things.

Smart contracts are defined by the following: their behaviors and their state. Focusing first on the behaviors of a smart contract, this is simply the functions that one can call on the smart contracts. Examples of such behaviors can be found below:

  • Tokens: behaviors include creating tokens, transferring them, getting the balances of token holders
  • Decentralized Exchange: behaviors include swapping tokens, adding liquidity to a pool, getting the adresses of both tokens of a liquidity pools
  • DAO: behaviors include submitting a proposal, voting on a proposal, checking if someone is a governance member

We now focus on the state of a contract. Abstractly, we can define the state of a contract as being the values and stateful data structures that are associated with said contract. Examples of the state of a smart contract are listed below:

  • Tokens: the name of the token, the symbol of the token, the balances of the users
  • Decentralized Exchange: the number of tokens of a liquidity pool, the amount of tokens a liquidity provider is entitled to
  • DAO: a list of all governance members, a list of all outstanding proposals

Understanding what a smart contract under the EVM model consists of, we are now ready to understand the relationship between Solidity and the underlying blockchain.

On this page