Today we are going to look into fungible vs Non-Fungible Tokens, aka NFTs, aka nifty. They burst into the mainstream with the sudden popularity of cryptokitties – a virtual cat collectible game. While the Ethereum-based ERC-721 remains the most popular NFT in the market, there are several projects out there, like RSK, that have produced their own collectible tokens. So, before we go into any of this, let’s do some background research.
What is A Token?
In real life, a token is a thing which serves as a visible or tangible representation of a fact, quality, feeling, etc. you can empty your pockets right now and the chances are that you will stumble across a lot of real-life tokens.
- Your office ID card shows that a company gainfully employs you.
- Your driving license is a token, representing the fact that you have taken the training required to drive in your country.
- Your hotel key card shows that you have paid the hotel for your room.
Similarly, in the cryptoverse, a token is a representation of “something” in its particular ecosystem. It could value, stake, voting right, or anything. A token is not limited to one specific role; it can fulfill many roles in its native ecosystem. A token represents an asset or utility that a company has, and they usually give it away to their investors during a public sale.
The Roles of a Token
A token is a representation of something in its particular ecosystem. It could be value, stake, voting right, or anything. A token is not limited to a specific role; it can fulfill a lot of functions in its native ecosystem, such as:
- Toll: A token can act as a gateway to the Dapp. Basically, to access the Dapp, you will need to hold the tokens.
- Voting Rights: The tokens may also qualify the holders to have certain voting rights. Think of EOS, holding EOS tokens will allow you to vote for block producers.
- Value Exchange: This is one of the more traditional roles of tokens within the ecosystem. Tokens can help create an internal economic system within the application.
- User Experience Enhancement: The token can also enable the holders to enrich the user experience inside the confines of the particular environment. Eg. In Brave (a web browser), holders of BAT (tokens used in Brave) will get the right to enrich the customer experience by using their tokens to add advertisements or other attention-based services on the Brave platform.
- Currency: It can be used as a store of value to conduct transactions both inside and outside the given ecosystem.
- Ownership of something unique: A non-fungible token can represent something unique for that particular user. Eg. Cryptokitties.
Fungible vs Non-Fungible Tokens
Alright, we have gained some background info on how tokens work, let’s look at the difference between fungible and non-fungible tokens. According to Investopedia:
“Fungibility is a good or asset’s interchangeability with other individual goods or assets of the same type.”
Let’s understand this with an example.
Suppose you borrow a $100 note from a friend. To pay her back, do you really need to pay her back with the exact same note?
You can pay her back with another $100 note. In fact, you can give your friend 2 50-dollar notes or even 10 10-dollar notes. It will be perfectly fine because dollars (or paper currencies in general) are, for the most part, fungible.
Now, let’s suppose you borrow your friend’s car. Will she be ok with you returning some other car to her? What if you break up her car and return her the engine, wheels, doors, etc.? You’ll be lucky if she doesn’t file a complaint against you!
So, what happened here?
A car counts as a collectible, which is why it is non-fungible.
This is the fundamental difference between a fungible asset and a non-fungible asset.
Currencies gain more value by its fungibility. The more widely regarded and accepted a specific currency is, the more people will use it, and hence more it’s perceived value will be. So, if payment is one of the main utilities of the token that you are interested in, then you should check whether the token is fungible or not.
Non-fungibility is a desired asset when your token is a collectible and gains its values from its uniqueness.
Ethereum Token Standards: ERC-20 vs ERC-721
To create a healthy ecosystem, it is essential that the Dapps built on top of Ethereum can seamlessly interact with one another. However, what will happen if we have two tokens, say Token Alpha and Token Beta, and both of them have different smart contract structures?
For the two tokens to interact, the developers will need to carefully study both their contracts and map out exactly how these tokens will work with each other.
Now, this doesn’t really bode well for scalability, does it?
If there are 100 different tokens with 100 different contracts, then to narrow down on all the qualifications and conditions required to make sure that transfers can go through between all these tokens will need a humongous amount of complex calculations. This is not an ideal scenario at all.
This is why a decision was taken to standardize the rules that govern the token’s underlying architecture. These sets of rules are called ERC-20. The “ERC” stands for “Ethereum Request for Comment,” while the number ’20’ is assigned to this request.
Let’s look into what builds the foundations of ERC20:
Now, these are the rules and functions that the ERC-20 tokens must mandatorily have. However, they can also have the following 3 optional characteristics.
- Token Name
- Decimal (up to 18)
These rules define the ERC-20, fungible standard.
Properties of Fungible Tokens
- Another token of the same type can replace one token.
- The underlying rules that are governing the tokens are the same.
- Fungible tokens are divisible, and various smaller fractions could be used to pay back a larger amount. E.g. 1 BTC can be paid back with 0.50 BTC, 0.30 BTC, and 0.20 BTC.
ERC-721 – The Non-Fungible Standard
The ERC-721 token standard helps create non-fungible tokens. In many ways, it is pretty similar to ERC-20 in functionality. This similarity exists for two reasons:
- Firstly, it is easier for developers to make the transition. , they won’t have to learn a host of new things
- It makes life much easier for users who can store these tokens in ordinary wallets and trade them on exchanges.
The interface for ERC-721 provides two methods:
- ownerOf: to query a token’s owner
- transferFrom: to transfer ownership of a token
The ERC-721 standard defines the following functions: name, symbol, totalSupply, balanceOf, ownerOf, approve, takeOwnership, transfer, tokenOfOwnerByIndex, and tokenMetadata. It also describes two events: Transfer and Approval.
Before we go into individual function discussions, you must know what we mean by the Token Ownership and Token Creation of the ERC-721 functions.
When you buy ERC-20 tokens, your rights of ownership will be written in the smart contracts. The smart contract also has data on how much tokens each address will have after the deal…and that’s it. The thing is that these contracts don’t need to worry about specific tokens because they are fungible, so they are all the same.
However, the value of one ERC-721 token is not the same as another ERC-721 token because of its non-fungibility. Adding an address and balance to the contract won’t be enough; a token’s unique ownership details also need to be added.
Events are fired whenever a contract calls them, and they’re broadcasted to any listening programs.
Programs outside the contract listen to the events so that they can execute the code upon execution. The ERC-721 standard deals with two events:
Whenever a token changes hands, this event is fired. Every single time a token’s ownership moves from one person to another, this event is fired away. It details the following:
- Which account sent the token?
- Which account received the token?
- Which token was transferred (by ID checking)?
This second event is fired whenever a user allows another user to take ownership of a particular token. The event details which account has been currently owning the token and which account is getting the permission to own it in the future. It also checks the token ID to determine which particular token has been approved to transfer ownership.
Other non-fungible token standards
ERC-1155 is another non-fungible token standard popularized by the Enjin team. The IDs defined here don’t represent a single asset, but classes of assets. So, if we want to make a “cards” collectible, we could have an ID representing “cards.” A wallet could have 50 of these.
An advantage that ERC-1155 has over ERC-721, a user would have to transfer these 50 cards by modifying the smart contract’s state. However, the disadvantage of ERC-1155 is in the loss of traceability.
Composables like ERC-998 provide a template by which NFTs can own both non-fungible and fungible assets.
Pros and Cons of Non-fungible tokens
- ERC-721 standard can be a way with which every significant asset could be tokenized on a public or hybrid blockchain with complete immutability and security.
- Non-fungible tokens can be designed with way more resources than available to most during that time. Users can do this, adding extra context and information to the asset’s metadata.
- The ERC-721 token standard is still relatively new.
- Fungible tokens are divisible upto a certain extent. ERC-721 simply can’t be divided and must be bought or sold whole.
As mentioned before, several projects have started issuing NFT tokens. One of those happens to be RSK.
What is RSK?
Rootstock (RSK) is a smart contract platform that is connected to the Bitcoin blockchain through sidechain technology. Rootstock was born to be compatible with Ethereum’s applications (the web3/EVM/Solidity model) . The idea behind the creation of RSK was to give the Bitcoin blockchain smart contract functionalities. At its very core, Rootstock is a combination of:
- A Turing-complete resource-accounted deterministic virtual machine (for smart contracts) compatible with Ethereum’s EVM.
- A two-way pegged Bitcoin sidechain (for BTC denominated trade) based on a strong federation.
- A SHA256D merge-mining consensus protocol (for consensus security relying on Bitcoin’s miners) with 30-seconds block interval. (for fast payments).
RSK: NFT Use Cases
Its partnership with Watafan can perfectly describe RSK’s advances in the field of non-fungible tokens.
Watafan will allow celebrities to create their own digital trading cards, aka watacards.
- Celebrities can give away the watacards to their fans as a gift or autograph.
- They can use their personal wallet to sign these cards cryptographically.
- Smart contracts protect the intellectual property of the idols.
- Every time fans trade watacards in the secondary market among each other. The concerned celebrity will receive a chunk of the shares.
- Watafan aims to propel the digital property to the next level by leveraging smart contracts. Watafan idols can secure their copyright and digital identity with RSK smart contracts.
- Long-term, watacards will cement themselves as a new kind of asset that can help preserve the intellectual copyrights of artists, athletes, musicians, actors, and others.
How to build an RSK NFT?
The steps required to build your RSK NFT tokens are as follows:
- Installation basic requirements such Node.js and NPM (Node Package Manager), Visual Studio Code (VSCode) or any other editor of your choice, Truffle, and Metamask wallet.
- Initialize a project using Truffle and OZ;
- Configure Truffle to connect to RSK testnet;
- Get a wallet with some testnet R-BTCs;
- Initialize the client side application;
- Add more configurations to Truffle;
- Create smart contract of the token and compile it;
- Create deploy instructions file in Truffle;
- Deploy a smart contract on RSK Testnet using Truffle;
- Create client-side application;
- Interact with the smart contract.
Here´s a good resource to get started coding your non-fungible token and a video with step-by-step instructions to create your own collectable token on RSK´s network.
The post Fungible vs Non-Fungible Tokens – What is The Difference? appeared first on Blockgeeks.