{"id":1732,"date":"2021-04-17T10:14:25","date_gmt":"2021-04-17T15:14:25","guid":{"rendered":"https:\/\/blog.iqonda.net\/?p=1732"},"modified":"2021-04-17T10:19:20","modified_gmt":"2021-04-17T15:19:20","slug":"token-balance-decimals","status":"publish","type":"post","link":"https:\/\/blog.ls-al.com\/token-balance-decimals\/","title":{"rendered":"Token Balance Decimals"},"content":{"rendered":"
Noting my python code for reference. If familiar with crypto currency tokens you may find the token balance does not have decimals but rather store the decimal value separately.<\/p>\n
For example this query shows the balance:<\/p>\n
$ curl -s https:\/\/api.ethplorer.io\/getAddressInfo\/0xbcB79558e0d66475882A36FaF4124Ec45aA70dA3\\?apiKey\\=freekey | jq -r '.tokens[0].balance' \n1001193304561787500000<\/code><\/pre>\nIf you look at the token detail you see the decimals recorded:<\/p>\n
$ curl -s https:\/\/api.ethplorer.io\/getAddressInfo\/0xbcB79558e0d66475882A36FaF4124Ec45aA70dA3\\?apiKey\\=freekey | jq -r '.tokens[0].tokenInfo.decimals'\n18<\/code><\/pre>\n