Understanding ERC20 and ERC721 smart contract standards

To understand ERC20 and ERC721 contract standards, first, let's look at the concept of fungibility. Fungibility is used to describe the property of an asset where individual units do not hold a special value and can be replaced with another unit of the asset. A good example of this a 10 dollar bill. If you have a 10 dollar bill and I have a 10 dollar bill, they both hold the same value, which is 10 dollars. The bill would not have a higher or lower value depending on who is the owner of the bill. The bills can replace each other very easily. Hence, a 10 dollar bill is a fungible asset. All currency is essentially fungible in nature.

Now, take the case of a different kind of asset. If both of us owned a 400-square foot apartment and yours was in New York City and mine in New Delhi, the monetary value of both the apartments would be different because of the average price of a property per square foot being much higher in New York. In this case, the apartment is an example of a non-fungible asset—essentially, an asset that cannot be replaced by a random asset from the same group. The asset has some additional properties attached to it that make it "special." 

In the world of finance, we use both fungible and non-fungible assets and goods extensively. Currency, loyalty tokens, food coupons, gift cards, commodities, and so on are fungible in nature, wherein one can replace the other. Real estate, people, pre-owned automobiles, artworks, and so on are non-fungible in nature, where each unit has some distinguishing features that make it irreplaceable.

The Ethereum community has devised numerous smart contract standards suited for different use cases. These are meant to be starting points for developers and introduce uniformity among developers coding for the public Ethereum blockchain. For fungible tokens, the most popular contract standard is ERC20. ERC20 tokens have been implemented in multiple use cases such as payment tokens, loyalty coins, gift cards, and so on but their most popular implementation by far is as Initial Crypto Offering (ICO) tokens. ERC20 contracts are easy to understand, build, and deploy and, owing to this, it is often this first contract standard that developers work with.

ERC 721 is the token standard used to build smart contracts that issue Non-Fungible Tokens (NFTs). Popular implementations include government documents, land titles, digital identities, and real estate. In its native implementation, it does not define a protocol for capturing metadata of the token. However, OpenZeppelin provides us with a sample URI framework for implementing NFTs as part of its ERC721 contract templates. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.230.44