XinFin TOKENS: XRC-20 VS. XRC-223 VS. XRC-777

  • Get the total supply of tokens by using the “total supply” function.
  • Retrieve the token balance from another owner account.
  • Send the tokens to another owner account. These are “EOA” accounts. For this, we use the transfer function.
  • Send the tokens from one address to the other. Token addresses are contract addresses. For this, we will use the “transferFrom” function.
  • Allow another account to repeatedly withdraw funds from your account, within a specified limit. For this, we use the “approve” function.
  • By using the allowance function, spenders can return unused tokens to owners.
  • It considers transactions on the XinFin blockchain as events.
  • If users use the “transfer” function, it will display an error and subsequently cancel the transaction.
  • Though the user pays the XDC as a “Gas price,” he doesn’t lose any token.
  • An additional parameter of checking whether the receiving address is a contract account is added to the “transfer” function.
  • If it finds that the recipient address is a contract account and not an EOA account, it assumes that the contract has implemented a “tokenFallback.”
  • Using a “toeknFallback” function, we can call back the token so that the transaction doesn’t burn the token.
  • Though the XRC-223 function solves the XRC-20 bug to a great extent, there is a weak point in this proposal. In case the recipient smart contract does not have the “tokenFallback” function, the “Fallback” function will run, resulting in the loss of tokens.
  • New functions introduced are “send” instead of “transfer,” “authoriseoperator” instead of “approve,” and “tokensReceived” instead of “tokenFallback.”
  • Until now, developers couldn’t identify the functions which can be implemented by smart contracts. Another token standard called the XRC-820 has implemented a central registry of contracts on the network. So, it is now possible to know the interfaces and functions a smart contract has. XRC-777 uses this to identify the interfaces a smart contract uses. Developers will now know beforehand if a contract has the functions required to receive tokens sent through certain functions.
  • “Whitelisting” of operators is possible with XRC-777. So, XinFin network users will now be capable of rejecting payment from blacklisted addresses. An address can be blacklisted due to reasons such as a history of illegal activities and attempts to hack the network.
  • You will now be able to understand that out of these three tokens, the XRC-777 token provides developers with multiple options to prevent the loss of tokens. However, the XRC-777 standard is also associated with risks such as:
  • Some XinFin developers are of the opinion that the “authoriseoperator” function is deprecated; so developers shouldn’t use it. This function will need more “Gas,” and it will put additional strain on the network.
  • Using a central registry of smart contracts to look up the interfaces a contract uses is risky. It is possible for the central registry to have bugs, and anything that depends on it will have an adverse impact.

--

--

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