Jumping into Solidity —The ERC721 Standard (Part 1)

“Architect draws blueprints with a ruler on a table” by Daniel McCullough on Unsplash

What is the ERC721 Standard?

The ERC721 Standard is a (draft) standard for creating Non-Fungible Token (NFT) contracts. Non-fungible means not completely interchangeable. A dollar coin is fungible, because if I give you a dollar coin and you give me a dollar coin, neither of us are better or worse off — a dollar is a dollar. However, if I give you my pet cat and you give me your pet cat, we may not be happy, because pet cats are not completely interchangeable — they are non-fungible.

So what actually is it?

An ERC standard is basically a set of rules which enables your contract play to well with other developers’ contracts (or DApp, website, other software, etc). By providing some guidelines for required functions, and some restrictions on how they should behave, other programmers can write code that interacts with yours without having to know your entire codebase.

function balanceOf(address _owner) external view returns (uint256);
/// @dev NFTs assigned to the zero address are considered invalid, and this function throws for queries about the zero address.
balanceOf(0x0)

Some things to note

The standard doesn’t prevent you from adding extra functions, or extra rules to your contract. As long as your additions don’t conflict with the rules laid out by the standard, they’re perfectly acceptable.

  • If you’re new to Solidity, there are plenty of excellent resources out there, but be careful because Solidity is rapidly evolving so a lot of the online resources may be out of date. At the time of writing, we’re up to Solidity 0.4.21, and any resources that cover versions below about 0.4.16 may not be useful. I found this Udemy course particularly helpful as an entry point.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Andrew Parker

Andrew Parker

Codeslinger. Melbourne based Solidity developer for hire.