Explore Knowledge Base

Cryptocurrency Supporting

26. 12. 2024

The system supports cryptocurrencies such as Bitcoin by allowing the configuration of custom currency fractions and scale. It performs high-precision calculations without rounding, ensuring accurate processing of all cryptocurrency operations.

Fraction

The Currency entity includes a fraction field, which defines the smallest unit of a currency. Fraction is set when the currency is created, with a maximum allowed value of 10^-18.

Example:

  • USD fraction = 100

  • Bitcoin fraction = 100,000,000

Fractions are handled on the back end. The front end receives amounts that are already adjusted according to the specified fraction.

Note: The front end does not use the fraction parameter for input validation. The only validation applied is that the maximum number of decimal places allowed for input is 18.

Scale

The currency scale defines how many decimal places are used. Scale is set when the currency is created, with a maximum allowed value of 18.

The system automatically adds 2 extra decimal places to the defined scale to increase calculation accuracy and avoid rounding errors.

All values are stored using 20 decimal places by default, but only (scale + 2) digits after the decimal point are considered significant in calculations.

Example:

  • USD: defined scale = 2 → effective scale = 4

  • Bitcoin: defined scale = 8 → effective scale = 10