What are Token Decimals in Cryptocurrency? Definition and Overview

May 21, 2024 11:52:28 PM

What are Token Decimals in Cryptocurrency?

Token decimals refer to the smallest unit to which a cryptocurrency token can be divided. It indicates how many decimal places a token can have when being transacted or represented. The number of decimals is part of a token’s specifications and is defined in its smart contract. Once set, token decimals should be immutable, as changing the decimal value can lead to inconsistencies and errors in token transactions.

Decimals are used by wallets and exchanges to display token values in a user-friendly format. They allow for fractional ownership and trading of tokens. The number of decimals can vary depending on the token standard and design choices made by the token issuer. Most tokens have between 8 and 18 decimals. Non-fungible tokens (NFTs) can also have decimals to enable fractional ownership.

If you are interested in the implementation details of token decimals, visit our Creating a Coin guide. It explains how to create a token with a specific number of decimals on the Neo blockchain. You can make your token using Python, C#, Java or Go. Join our Discord server if you have any questions or need help.

Token Decimals - Key Concepts

  1. Facilitating Transactions: Decimals allow for transactions involving fractions of a token, making it possible to send small amounts that are less than a whole token.
  2. Enhancing Usability: By allowing for divisibility, decimals improve token usability, especially for microtransactions.
  3. Determining Precision: The number of decimals determines the precision with which a token can be used in calculations and payments.
  4. Smallest Unit: The smallest unit of a token is determined by the number of decimals. For example, a token with 18 decimals can be divided into 10¹⁸ parts.
  5. Price Representation: Decimals affect how token prices are displayed and calculated, influencing market perception and trading behavior.

How Token Decimals Work

The token decimals are defined in the code. Tokens following standards like ERC-20 or NEP-17 have a decimals field in their smart contract that specifies the number of decimal places the token can have. By default, ERC-20 tokens have 18 decimals. On Neo, there isn’t a default number of decimals, but the most common choice is 8 decimals.

When a token is transferred, the value is represented in the smallest unit of the token, which is calculated based on the number of decimals. For example, a token with 18 decimals will have a smallest unit of 0.000000000000000001. This manipulation is done internally by wallets and exchanges, which display the token value based on the whole unit, including decimals. When a transaction is made, the amount is multiplied by 10^decimals to convert it to the smallest unit. If a token has no decimals, it is indivisible and can only be transferred in whole amounts.

Non-Fungible Tokens (NFTs) Decimals

It’s uncommon, but some NFTs may have decimals. Divisible NFTs can have decimals to allow fractional ownership. This can be useful for assets like real estate or art, where the ownership can be shared among multiple parties. Decimals in NFTs are not as common as in fungible tokens.

Token Decimals inside Wallets

When adding a custom token to a wallet like Metamask, users may need to specify the number of decimals to ensure the token’s correct representation and usability.

Most wallets automatically detect the number of decimals for well-known tokens, but some users may need to input the decimal value manually. To find the correct decimal value, users can use blockchain explorers or documentation provided by the token issuer. Using the wrong decimal value will result in incorrect token transfer values.

In general, user-facing applications handle the decimal conversion automatically, so users don’t need to worry about it. Developers, however, need to be aware of the token’s decimal value when working with tokens in their applications.

Example of Token Decimals

  • Bitcoin (BTC): Bitcoin has 8 decimals, and the smallest unit, called a “satoshi,” is 0.00000001 BTC.
  • Ethereum (ETH): Ethereum has 18 decimals, with the smallest unit called a “wei” being 0.000000000000000001 ETH.
  • NEO: NEO is indivisible and has 0 decimals, meaning it cannot be divided into smaller units.
  • GAS: GAS has 8 decimals, the smallest unit being 0.00000001 GAS.
  • LNEO and LRC: Both Linkd Neo and Linkd Reward Coin have 8 decimals.

BNeo Token Decimals

NEO is the token of the Neo blockchain. BNeo is a wrapped version of Neo. It extends Neo’s functionality by allowing it to be divided. Neo has zero decimals, and since Neo’s price can be high, adding decimals made it more usable for trading and payment. BNeo uses 8 decimals and can be unwrapped back to Neo at a 1:1 ratio.

Token Decimals on Price Calculation

Network fees are often calculated based on the smallest unit of a token, determined by the number of decimals. For example, when sending Ethereum, the gas fee is calculated in wei. Wallets and exchanges display token prices based on the unit value, including decimals. For example, if the price of Ethereum is $3,000, it means 1 ETH is worth $3,000, not 0.000000000000000001 ETH.

Lower decimals can give the impression of a higher token price, while higher decimals can make the token appear cheaper. The token’s value remains the same regardless of the number of decimals.

Indivisible Tokens

Some tokens, like NEO, are indivisible and have 0 decimals. This becomes an issue when swapping tokens on decentralized exchanges, as the smallest token unit must be traded in whole amounts. If the price of NEO is $100, users can only trade values that are multiples of $100. This affects flexibility and can lead to a poor trading experience.

Decentralized exchanges and marketplaces use BNeo, which has decimals, to allow for fractional trading of NEO. Choosing the right decimal is part of the token design process, and usability, trading, and fees should be considered, if applicable.