Tokens
Lesson 2 Module 1
There are two types of tokens: fungible tokens and non-fungible tokens.
Fungible tokens are all identical. Non-fungible tokens are all unique. Fungibility implies equal value - thus a fungible token is identical in value to every other token of the same type. The easiest way to really internalize this is using fiat money as an example. One $1 USD bill is the exact same as any other $1 USD bill. They both can be exchanged (buy) for exactly $1 of something. It doesn't matter which one you use - and that's the essence of fungibility.
By contrast - non-fungible tokens each have a different inherent value. Something unique about them adds or subtracts value so that you can not interchangeably use one for another. It may be that two non-fungible tokens that are unique happen to have the similar or even the same values (based on some kind of valuation) in which case they could be considered fungible tokens in that environment.
NEAR tokens are NEAR protocol's fungible tokens. The smallest divisible portion of 1 NEAR is 1 yocto ( 10^24). I won't cover the full breadth of the economics model here, but NEAR protocol's economics refer to NEAR tokens as the lifeblood of the network and as NEAR's native currency NEAR is envisioned to have several use cases:
- Security of the Network - NEAR Protocol is a Proof of Stake network, thus Sybil resistance is achieved by staking Near.
- Network Usage Fees - the network charges transaction fees for processing changes to stored application data (state) as well as collateral for storage on chain.
- Medium of Exchange - used to transfer value across NEAR applications and accounts. It's a monetary function.
- Unit of Account - apps and external parties can use NEAR as the means to affect exchange.
- Store of Value - decoupled from network utility - in the long-term NEAR becomes a representation of the value stored on the network.
If interested, there is a more detailed discussion of the NEAR token supply and distribution available.
Alrighty - so shifting focus completely to fungible tokens - let's consider how they are useful and thus the need for a fungible token standards specification.
In much the same way NEAR's tokens exist to achieve the five use cases above, most Layer 1 Protocols (NEAR, Ethereum, Bitcoin, etc...) use a token to power it (pay for gas). These are their native currencies and they are different than tokens built on top of them.
A token, at its core, is simply a contract (also referred to as a smart contract or even program/script) running on top of one of these chains. The contract describes the token's behaviour - what it can do and has an associated data storage structure that is basically a record of who owns how many tokens taking into account any transfers that have taken place. When the contract receives a valid transaction, it updates the data structure accordingly.
These token contracts are different than the native currencies that are hard-coded and built in to each of the chains. Every time a transaction is sent to a contract that can change state (storage) it needs gas in the form of the chain's native currency. That gas is used by the chain as an incentive to reward the miners or validator's expending computing resources to run the whole thing securely. The other reason these exist is to prevent transaction spam given that it would be prohibitively expensive to continually send transactions that have a cost associated with them. Native tokens don't represent anything - they are things in and of themselves.
In more concrete terms, tokens are digital assets that represent pretty much anything you can think of. For example, we've seen tokenization of digital in-game assets, real-estate, people, loyalty points, art, financial products, and more. Most of these tend to be non-fungible tokens as they have unique values attached, but things like traditional loyalty points fall into the fungible token category. When allocated to you in the token's digital ledger, you own them and control them including reassigning ownership to someone else if you so choose. Rather than receiving and controlling the token itself, you control a key that allows you to make a new entry on that digital ledger thus proving your ownership.
Fungible tokens tend to come in variations of two forms: asset backed tokens or as a utility tokens.
Asset Backed Tokens
In these cases, token value is derived from the asset that it represents. As an example, in the good ol days, one would take some amount of gold to a goldsmith who would hold it and hopefully secure it and issue a receipt (token). Rather than carry gold, people carry around the receipts and when they want they gold - they go back to the goldsmith and collect it by presenting the receipt. Anyone holding the receipt gets the gold.
Asset backed tokens are the blockchain equivalent to this. but instead of having receipts issued, ownership and transactions are recorded on the blockchain which obviously offers some security and convenience advantages. To get the underlying asset back, you send your token to the issuer and the issuer (ideally) gives you your asset back. Whether that happens of course, depends on the liquidity of the issuer. If they've taken the physical assets you've provided and used them in some way, might be a delay before you get your asset back as the issuer must liquidate whatever position your asset is backing to free it up and get it back to you.
In this sense, the token can also represent ownership and prove provenance of a specific physical object (as a non-fungible token).
As a variation of asset-backed tokens, token sales occur when companies are looking to raise money for development or other use cases. In these cases they will sell a portion of the token supply in exchange for fiat money (say USD). The people buying the tokens are doing so typically with the expectation that the value of the token will rise and they'll make a profit by selling it at a later date (much in the way shares in a company work). This type of token and token sale would be classified as a security and thus likely incurs regulation from the securities industry.
Next Up
Now that we understand the origins and "why" surrounding specification standards and tokens that are created and issued, we're going to turn to the technical side of things to go through the standard itself and how to build and issue a token on NEAR.