Unit Conversions

MNEE uses atomic units for precise calculations and to avoid floating-point arithmetic errors. The SDK provides two methods for converting between human-readable MNEE amounts and atomic units.

Conversion Methods

toAtomicAmount

Converts a human-readable MNEE amount to atomic units.

const atomic = mnee.toAtomicAmount(1.5);
console.log(atomic); // 150000

fromAtomicAmount

Converts atomic units to human-readable MNEE amount.

const human = mnee.fromAtomicAmount(150000);
console.log(human); // 1.5

Understanding Units

  • 1 MNEE = 100,000 atomic units

  • MNEE has 5 decimal places

  • All blockchain operations use atomic units

  • User interfaces should display MNEE amounts

Common Use Cases

Preparing Transfer Amounts

Displaying Balances

Fee Calculations

UTXO Amount Calculations

Input Validation

Precision Handling

Format for Display

Batch Amount Processing

Important Notes

  • Always use atomic units for calculations to avoid rounding errors

  • MNEE amounts in the SDK methods (transfer, etc.) expect decimal MNEE values, not atomic for better UX.

  • Maximum precision is 5 decimal places

  • When displaying to users, consider formatting appropriately

  • Database storage should use atomic units (integers) for accuracy

Conversion Table

MNEE
Atomic Units

0.00001

1

0.0001

10

0.001

100

0.01

1,000

0.1

10,000

1

100,000

10

1,000,000

100

10,000,000

See Also

Last updated