The Ethereum network has been around for quite some time now and with that comes the inevitable improvements to its token standards. One such improvement is ERC827 which aims at fixing what was seen as one of its biggest shortcomings – executing calls in transfers or approvals easily without any hassle whatsoever!
Coins vs. Tokens
Before we can dive into the function and therefore purpose of a token, we will need to understand what it is not.
Most who are new to crypto believe coins and tokens to be the same however, they are not. Essentially all coins are considered tokens but not all tokens are coins. Why? A coin is a representation of potential value while a token is an absolute value.
If you can understand the utility of crypto, you will be able to distinguish between a coin and a token.
A coin is usually native to a blockchain and used for currency transactions and value storage. A token is pretty similar, but it tends to use another coin’s blockchain. For example, Ether is the native coin on the Ethereum network however, several other tokens can operate on this same blockchain.
Coins represent a proposed medium of exchange while tokens, on the other hand, represent an asset that can be held for value or traded. Some examples of tokens are Uniswap, Chainlink, and Polygon.
Crypto coin transactions are handled by blockchain and tokens rely on smart contracts for trade.
When you spend a token, it moves from one place to another. For example, the change in ownership of NFTs (no-fungible tokens) must be handled manually. Because a coin doesn’t have to be moved from one place to another, all transactions are recorded on blockchains.
Types of Tokens
DeFi users are likely to encounter five major token types when they enter the space. There is an understanding that each type of these tokens serves a unique role in helping the overall ecosystem function well and grow. At this time, there is no one-size-fits-all approach for how people should be using them – but instead, different strategies will apply depending on what you want out of your experience.
Transactional Tokens: DeFi’s Money Supply
The three functions of a transactional token are as follows: 1) means of payment; 2) store-of-value that may be preserved for future use (i.e., investments); 3). Unit or account necessary to measure monetary worth across any given period (a dollar Bill).
Stablecoins such as USDC, TUSD, and Dai all track different currencies but they still maintain this core definition making them transactional tokens.
Governance Tokens: Community Decision-Making
With Governance tokens, users can now engage in collective decision-making with other holders through blockchain-based voting.
The ability to hide behind anonymity when exercising this right protects them against reprisal both during timesharing activities such as trading cryptocurrencies or even just interacting online across different social media platforms because all data remains encrypted until it is manually unlocked preventing anyone else besides its intended recipient from accessing any personal information sent.
These tokens are distributed in a variety of ways including, but not limited to, direct sales, airdrops to users, or as rewards for being active. They are also available for anyone to purchase on the secondary market via centralized and decentralized exchanges.
Utility Tokens: In-App Payment Currencies
Utility tokens are a way to represent value in an ecosystem. They function much like local currencies, and each token can be used as payment within its specific network or industry sector for goods/services offered by participating businesses who accept them at face value (with no additional fees).
Liquidity Provider (LP) Tokens: The IOUs of the DeFi Space
Liquidity provider tokens are a type of cryptocurrency that provides services to traders on decentralized exchanges. This includes acting as an automated market maker, meaning they can match buy and sell orders for users at set prices without human intervention to match them up with other people who want trades completed simultaneously across different markets or stocks – kind of how automatic trading systems work.
Uniswap is one example among many popular DEXs distributing these LPT which represent liquidity providers’ interest by giving power back into user’s hands by holding onto risky assets during volatile periods instead of just fading away when things get calm again.
NFTs: An Emerging Form of DeFi Collateral
Non-fungible tokens are a new type of cryptocurrency that represents ownership in an item, be it digital or physical. They have gained traction with collectors and artists because they provide greater security than fungible cryptocurrencies like Bitcoin while still maintaining portability–you can carry your NFT around on paper just as easily without worrying about losing private keys unlike when dealing directly from web3 browsers.
The most popular way to trade these assets is through decentralized applications (DApps) built using Ethereum’s ERC 721 token standard rather than its predecessor ERC 20, which was adopted by many DeFi coins.
ERC Token Standards
The Ethereum Request for Comments (ERC) is a program that allows any party to create their own cryptocurrency with specific standards. ERCs are Ethereum application-level specifications, such as token standards.
Creators must clarify what they are offering with their ERC token and gain approval from other stakeholders for it to become recognized by all parties involved as an accepted form of payment or exchangeable commodity on the Ethereum blockchain network such as gas powers smart contracts through processing transactions within these applications.
ERC Token Function
Ethereum is based on the use of tokens, which can be bought, sold, or traded. The Ethereum system is a blockchain that supports tokens that represent a diverse range of digital assets, such as vouchers, IOUs, or even real-world, tangible objects.
These virtual currencies can be used to trade goods and services with other users on the platform without having any need for fiat money like dollars – instead, they rely solely upon cryptocurrency value growth over time, based on user demand.
Essentially, Ethereum tokens are smart contracts that make use of the Ethereum blockchain and its function simply tells the token what to do.
Fallback Function: An unnamed external function without any input or output parameters. EVM executes the fallback function on a contract if none of the other functions match the intended function calls.
Function Approve: Using the approve() function,the owner of an NFT can approve another account so that the approved account can transfer the approved NFT from the owner’s account. The function takes two arguments;
- to: The address to which approval is to be given;
- tokenId: The NFT tokenId for which approval is given.
Function Transfer: The transfer() function is used to transfer the tokens from the owner of the token to some other address. As per the standard, the transfer() function must emit the Transfer event on a successful transferral of tokens. The transaction should revert if msg. the sender does not have enough tokens to spend. A transfer of a 0 (zero) must also be treated as a valid transfer and must log the Transfer event. The address that’s calling the function must have sufficient tokens to transfer to another address.
Function Allowance: This function asks for a series of user permissions. These permissions allow the smart contract to transfer from our address to an address defined by the smart contract a certain amount of its token (called allocation).
Function BalanceOf: Another public function with a view modifier making it accessible to all and gas-free. It takes in an Ethereum address and returns the number of tokens allocated to that address.
Function Totalsupply: Public function totalSupply, is accessible to all, and it displays the number of tokens in circulation.
Function TransferFrom: The transferFrom() function transfers the tokens from an owner’s account to the receiver account, but only if the transaction initiator has sufficient allowance that has been previously approved by the owner to the transaction initiator.
ERC 20 is One of the most well-known Ethereum ERC Token Standards. A standard interface for fungible tokens or interchangeable tokens like voting tokens, staking tokens, or virtual currencies, the ERC 20 standard token has been an important piece of technology on the Ethereum network since 2015.
The success and adoption rate for this particular cryptocurrency is largely due to its use as a means by which digital assets can be sent between users throughout different blockchains or networks worldwide without any third-parties getting involved in transactions.
The use of the Ethereum blockchain for promoting new cryptocurrencies was a major trend in 2017 and 2018. However, this standard is still current as it continues to be an important tool amongst developers who build on top of or customize blockchains like Bitcoin’s Blockchain technology. Services providers also endorse its validity because they depend upon these tokens being able to trade freely across all platforms without restrictions
ERC 20 Functionality
The functionality of ERC 20 is possible by defining a set of functions that allow a smart contract to emulate a digital token.
The ERC 20 standard code has 6 functions:
Total Supply Function: Determines the total number of tokens in circulation. If the amount cannot be changed or altered by anyone else, then this function allows an instance of contract to calculate and return with accurate data on what they think exists out there as opposed to just guessing at random numbers like most other cryptocurrencies when generating new ones through the mining process.
BalanceOf Function: Shows the balance on the account of a certain address specified by the address owner parameter, where the owner is, and the desired address. This function allows for the storage and return of balance. It takes an address as input so it should be noted that any public ledger has this information available to anyone who requests them from your smart contract!
Transfer function: Transfers tokens from the primary address to the address of an individual user. In this function, one can send a given amount of their token to another address just like any other cryptocurrency transaction.
TransferFrom function: Used to send tokens from one user to another. This process is automated and sends a specified amount of tokens on the owner’s behalf.
Some may question why both the transfer and transferFrom function are necessary but the transfer function is when you handle the transaction on your own and the transferFrom is when the transaction is completed automatically on your behalf.
Approve function: checks whether tokens have remained in the smart contract and allow funds withdrawal from the account up to the maximum allowed amount, which is specified as a parameter of the function. When a given address is authorized by the owner to approve a withdrawal.
Allowance function guarantees that there are enough tokens at the sender’s address for sending them to the recipient’s address. Moves the number of tokens from sender to recipient, the amount is then deducted from the initiator’s allowance.
Concerns With ERC 20
ERC 20 being the first token standard developed on the Ethereum network, issues were bound to surface. The two most critical issues that are causing money losses for token users are lack of transaction handling and the approve + transferFrom mechanism being potentially insecure.
According to some developers, the execution of smart contracts can be a focal point to transactional issues. A transaction can only be considered complete if all funds are successfully transferred and no errors or malware occur during that time if an error does occur, the transfer should be rejected.
This is what happens when transferring ETH.
When transferring ETH, this is exactly what happens; the receiving party will not be able to receive funds if they are sent via a contract that is incompatible with this cryptocurrency. However, with ERC 20 standard tokens, things occur a bit differently. If crypto is sent to a smart contract that does not support this standard, the transaction won’t be rejected but it will not be completed either resulting in a loss of tokens.
Why does this take place? Because to transfer ERC 20 tokens one of the two functions has to be activated. The transfer function allows you to send tokens to a specific address and the approve + transferFrom function is used to deposit tokens into a smart contract.
With the approve function, the user allows a smart contract to withdraw his funds, which is done with the transferFrom function.
Of course, we always need to consider user error so let’s assume that by mistake the user deposits a smart contract using the first transfer function? The transaction will be considered successful and the network will recognize it, but the smart contract itself will not see this transaction and therefore will not credit it. For example, if you send tokens to a decentralized exchange contract, the contract will receive these funds, but they will not appear on the balance. Moreover, if a contract cannot implement the function of emergency token withdrawal, it will be impossible to return the sent funds. It is because of this activity that the Ethereum ecosystem has already lost millions of dollars.
Because there is also no definitive way to link the token transfer to the function call, possibilities are limited. To combat this problem, members of the Ethereum community have released alternative token standards that can work with but also may replace ERC 20 in the future.
ERC 223 allows token transactions to behave in the same way as ETH transactions — in case of an error in the transfer function the transaction is canceled and the funds remain with the sender. For this purpose, ERC 223 introduces new functions that are not available in ERC-20 such as a single transfer function (instead of transfer and transferFrom) with three parameters – address to, uintvalue, bytes data, and the tokenFallBack function for the receiving contract, which defines the type of coins sent.
So, if an error is made in one of these three parameters of the transfer function, or the contract does not support the tokenFallBack, the transaction will not take place and the funds will be returned to the sender’s address.
ERC 777’s main goal is to solve ERC-20 problems in the area of transaction processing mechanisms. Therefore, this token standard offers a wide range of tools to process token transactions in contrast to ERC 223.
Instead of the transfer function, there is a single send function, instead of approving, authoriseOperator is used and instead of tokenFallback, there are tokensReceived.
This approach ensures that these functions will not interfere with functions of other token standards. Of course, there are some deficiencies; developers note that the new token functions of ERC-777 can indirectly take the place of ERC-20 token defects because unlike ERC 223, they will not block them.
ERC 721 isn’t so much a solution as it is an alternative. ERC 721 is considerably an Ethereum Improvement Proposal or EIP and functions as a non-fungible token. This token standard does follow a specific collection of standards like the ERC 20 tokens; they just focus more on aspects for deciding ownership and approaches for the creation of tokens.
The components of these functions are; Functions name, Symbol, totalSupply, balanceOf, ownerOf, approve, transfer, takeOwnership, tokenMetadata and tokenOfOwnerByIndex.
The standards also dictate the approaches for destroying and transferring the tokens.
ERC 721 tokens help smart contracts for working as tradable tokens just like ERC-20 but from a more uniquely tradeable experience.
They can be traded on almost any exchange. However, the value of ERC-721 tokens depends on the uniqueness and rarity associated with each token.
Where the ERC 721 tokens can solve some of the concerns of ERC 20 is by providing better prospects for defining the events of transfer and approval. The introduction of this standard has opened up new possibilities for smart contracts to serve as non-fungible assets.
ERC-827 is a new cryptocurrency token standard that improves existing blockchain technology by addressing some of its limitations. The most notable example is the inability for tokens issued through Ethereum’s previous contract blueprint, ERC 20 – which currently does not allow calls or approvals during transfers in particular–to be used as input data when computing an agreement between two parties who need security but do not want it trapped within their smart contracts forever (for instance because these functions require more time than just one transaction). With this update though comes some tradeoffs; there was initial concern over whether implementers would have enough flexibility.
As it is yet another extension of ERC 20, ERC 827 intends to resolve the problem that ERC 223 tries to solve, in a more embellished and flexible manner. If this standard is implemented, a token holder can transfer tokens while also approving a 3rd party to spend them.
Think in terms of writing a check, With both ERC 20 and ERC 223 you can write a personal check regardless of the fund in your bank; ERC 20 will approve it without verification resulting in a loss of funds (or fees from the bank) whereas ERC 223 will only approve the transaction if funds are available. The ERC 827 standard will allow that same check to be endorsed by a third party and deposited into their account.
This ERC standard, also allows tokens to be reused with wallets and exchanges because both parties agree on specific criteria for a 3rd party to spend a dynamic amount.
ERC 827 Functionality
ERC 827 uses primarily the same standard of functions as the ERC 20 token, therefore, becoming backwards compatible. The signature and logic are updated within only three functions; approve, transfer and transferFrom.
Approve Function: It allows the approval of the transfer of value and executes a call with the data sent during the approve function call.
Changing an allowance with this method does bring about the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to alleviate this condition is to first reduce the spender’s allowance to 0 and set the desired value afterward.
Transfer Function: This function transfers tokens to a specified address and executes a call with the sent data on the same transaction. It will return true if the call function is executed successfully.
TransferFrom: Like the transfer function, transferFrom also transfers tokens from one address to another and makes a contract call on the same transaction. But this can be used in coordination with the approve function and execute different logic while approving and transferring tokens.
In certain instances, the ERC 827 token standard has not followed through with how calls should be executed on behalf of a token contract. As it turns out, many projects have different ways to handle calls; however, every smart contract handling tokens assume common methods and maybe one callback implemented by each project. If you’re trying to integrate into existing solutions with different methods, it becomes difficult since they all execute arbitrary code.
This issue was solved by adding a simple proxy to the token which would forward all calls coming from the token contract. This ensures that only messages sent through this new interface can reach their destination through on-chain verification, preventing the token address to be used as msg. sender allowing integration with other contracts or systems.
The future of ERC Token Standards
As Ethereum becomes increasingly usable, new token standards are expected to emerge for various purposes.
The developers who work on the Ethereum blockchain are constantly coming up with new ideas for how to tokenize assets. Even though there’s not yet an exhaustive list of all possible standards, it seems like they’ll always find ways around this problem because as long as their network exists – no matter what use cases you can think about- Someone will develop a way that works best!
In the coming years, it will be virtually impossible to imagine a world without blockchain and cryptocurrency. Many people believe that ERC-20 is still an acceptable standard because of its simplicity or how popular it has become over time but some want more from their tokens than just being able to store value on a digital marketplace; they need security features such as interoperability in case one project uses another’s codebase (which we’ve seen happen), accident prevention mechanisms when hacking Ethereum accounts becomes easier.
A perfect segue into adopting the ERC 827 token standard. It is a way to utilize both old and new token standards for users by reaping the benefits of the new ERC 827 token standard, but also being able to continue utilizing the ERC20 token standard that they have become accustomed to.
Not only will users be able to enjoy all those benefits from ERC 20 but they’ll also have access to classes like Non-fungible tokens which are interesting because it’s useful for trading items without having any third-party interference or regulation get in between them… So essentially, it’s a win-win.