Search code examples
multiversxerdpy

How to format EGLD value send to SC/Account?


I'm trying to send an EGLD value (e.g. 1.5 EGLD) to an account/smart contract but in some cases only BigUInt type seems to be allowed. How does this value work and how should I format it correctly?


Solution

  • In the MultiversX blockchain, each token is configured to have a specific number of decimals (between 0 and 18). EGLD is configured to have 18 decimals. So, 1 EGLD is actually the denominated representation of the integer value of 10^18 actually.

    Using this example, if you have to send 1.5 EGLD, the un-denominated integer value is 1.5 * 10^18 = 1500000000000000000.

    If you send the tx from mxpy or most of any other programmatic way, you should pass the un-denominated value. If you send the tx from web wallet and such user-friendly interfaces, there's a good chance that the values are already denominated automatically, so 1.5 EGLD will be automatically denominated to the actual 1.5 * 10^18 value, which is what the destination address/SC will receive as payment amount.