top of page
Search
  • Writer's pictureNeeraj

Smart Contracts: A PM's intro

This's the second instalment, the first part's here.


What're smart contracts?


Remember how uber-cool sounding NFTs turned out to be just records on a blockchain? Smart contracts are a bit underwhelming too - they're just programs running on a blockchain. If you ever started with C programming, you probably remember the "Hello World" program. That's what smart contracts are really - a slightly advanced version of your first program.


Here's what a smart contract looks like:


There are a few ways in which smart contracts differ from traditional programs though

  • They're written and stored in a blockchain, for one.

  • They're also written in a different language - usually in Solidity, but sometimes in Rust or Viper etc.


What're the parts of a smart contract?


Depends on the kind of smart contract (yes, there are many types). Since we're talking about NFTs here, let's talk about two specific standards - ERC721 and ERC1155. The standards simply provide a structure around how the program should be written, what all it should include and so on. Why're there two of these? Because that's how standards proliferate:



Just kidding, ERC721 & ERC1155 are legit


A ERC721 or ERC1155 smart contract would consist of two sections:

  1. Functions: These perform actions like read, write, change or store data

  2. Events: These log actions and notify the chain about changes

As you'd expect, the smart contract does NOT hold any data. Neither does it refer to a metadata or image file. It simply creates the NFT. So...


What happens when a smart contract is executed?


If you create a smart contract using either of these standards and run it on a blockchain, you should end up with a NFT on the same blockchain. Creating a NFT by running a smart contract is what's known as "minting" a NFT. A record is "written" onto the blockchain.


Btw, you need to pay a transaction fee known as "gas fees" when you "write" anything to a blockchain. This means you'll end up paying gas fees every time you

  • Deploy a smart contract on a blockchain

  • Execute the smart contract to mint a NFT

Sounds about right...

Source: https://www.atimetolaugh.org/gasprices.html


Generally, the creator of the NFT - i.e., the wallet which executed the smart contract - doubles up as the owner of the NFT created. But the default ownership can be changed by altering the smart contract. The NFT can also be sold, as in the ownership can be transferred to other addresses. But at any given point in time, there can only be one owner of a NFT.


Now that we know about NFTs & Smart Contracts, we should ask...


17 views0 comments

Recent Posts

See All
bottom of page