One $DOGE equals 100,000,000 koinu in the protocol; koinu is the smallest accounting unit.
Coin amounts are written to 8 decimal places, while the blockchain stores whole numbers of koinu. The 0.058759 shown in the interface is the converted value. If the API returns 1234000000, that represents 12.34 coins. These two numbers mean the same thing.
When writing your own scripts to check balances, compare integers; don’t convert them to floating-point numbers before adding or subtracting. In floating-point arithmetic, 0.1 plus 0.2 does not equal exactly 0.3. Any difference won’t affect the balance table you see, but it can create extra discrepancies during reconciliation.
The 0.058759 shown in the browser and the 5875900 koinu returned by the API refer to the same balance, with no digits omitted.
#Dogecoin #Crypto
Technical information. Investing involves risk.
Coin amounts are written to 8 decimal places, while the blockchain stores whole numbers of koinu. The 0.058759 shown in the interface is the converted value. If the API returns 1234000000, that represents 12.34 coins. These two numbers mean the same thing.
When writing your own scripts to check balances, compare integers; don’t convert them to floating-point numbers before adding or subtracting. In floating-point arithmetic, 0.1 plus 0.2 does not equal exactly 0.3. Any difference won’t affect the balance table you see, but it can create extra discrepancies during reconciliation.
The 0.058759 shown in the browser and the 5875900 koinu returned by the API refer to the same balance, with no digits omitted.
#Dogecoin #Crypto
Technical information. Investing involves risk.